<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Aws on Evan Hoffman</title><link>https://evan.wtf/tags/aws/</link><description>Recent content in Aws on Evan Hoffman</description><generator>Hugo</generator><language>en-US</language><copyright>Evan Hoffman</copyright><lastBuildDate>Tue, 14 Oct 2014 12:01:49 +0000</lastBuildDate><atom:link href="https://evan.wtf/tags/aws/index.xml" rel="self" type="application/rss+xml"/><item><title>Installing a new SSL certificate in your ELB via CLI</title><link>https://evan.wtf/2014/10/14/installing-a-new-ssl-certificate-in-your-elb-via-cli/</link><pubDate>Tue, 14 Oct 2014 12:01:49 +0000</pubDate><guid>https://evan.wtf/2014/10/14/installing-a-new-ssl-certificate-in-your-elb-via-cli/</guid><description>&lt;p&gt;For future me:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Create the key and CSR:&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;$ openssl req -out wildcard.site.com.csr -new -newkey rsa:2048 -nodes -keyout wildcard.site.com.key&#10;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Upload the CSR to your SSL vendor (in this case, DigiCert) and obtain the signed SSL certificate.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Create a PEM-encoded version of the signing key. This is required for AWS/IAM certs. To check if your key is already PEM-encoded, just &amp;ldquo;head -1 site.key&amp;rdquo;. If the first line says &amp;ldquo;&amp;mdash;&amp;ndash;BEGIN PRIVATE KEY&amp;mdash;&amp;ndash;&amp;rdquo; then it&amp;rsquo;s NOT PEM-encoded. The first line should be &amp;ldquo;&amp;mdash;&amp;ndash;BEGIN RSA PRIVATE KEY&amp;mdash;&amp;ndash;&amp;rdquo;.&lt;/p&gt;</description></item><item><title>The m3.medium is terrible</title><link>https://evan.wtf/2014/08/12/the-m3-medium-is-terrible/</link><pubDate>Tue, 12 Aug 2014 13:51:08 +0000</pubDate><guid>https://evan.wtf/2014/08/12/the-m3-medium-is-terrible/</guid><description>&lt;p&gt;I&amp;rsquo;ve been doing some testing of various instance types in our staging environment, originally just to see if Amazon&amp;rsquo;s t2.* line of instances is usable in a real-world scenario. In the end, I found that not only are the t2.mediums viable for what I want them to do, but they&amp;rsquo;re far better suited than the m3.medium, which I wouldn&amp;rsquo;t use for anything that you ever expect to reach any load.&lt;/p&gt;</description></item><item><title>Using OpenSWAN to connect two VPCs in different AWS regions</title><link>https://evan.wtf/2014/08/07/using-openswan-to-connect-two-vpcs-in-different-aws-regions/</link><pubDate>Thu, 07 Aug 2014 13:16:19 +0000</pubDate><guid>https://evan.wtf/2014/08/07/using-openswan-to-connect-two-vpcs-in-different-aws-regions/</guid><description>&lt;p&gt;Amazon has a pretty decent writeup on how to do this (&lt;a href="https://aws.amazon.com/articles/5472675506466066"&gt;here&lt;/a&gt;), but in trying to establish Postgres replication across regions, I found some weird behavior where I could connect to the port directly (telnet to 5432) but psql (or pg_basebackup) didn&amp;rsquo;t work. tcpdump showed this:&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;16:11:28.419642 IP 10.121.11.47.35039 &amp;gt; 10.1.11.254.postgresql: Flags [P.], seq 9:234, ack 2, win 211, options [nop,nop,TS val 11065893 ecr 1811434], length 225&#10;16:11:28.419701 IP 10.121.11.47.35039 &amp;gt; 10.1.11.254.postgresql: Flags [P.], seq 9:234, ack 2, win 211, options [nop,nop,TS val 11065893 ecr 1811434], length 225&#10;16:11:28.421186 IP 10.1.11.254.postgresql &amp;gt; 10.121.11.47.35039: Flags [.], ack 234, win 219, options [nop,nop,TS val 1811520 ecr 11065893,nop,nop,sack 1 {9:234}], length 0&#10;16:11:28.425273 IP 10.1.11.254.postgresql &amp;gt; 10.121.11.47.35039: Flags [P.], seq 2:1377, ack 234, win 219, options [nop,nop,TS val 1811522 ecr 11065893], length 1375&#10;16:11:28.425291 IP 10.1.96.20 &amp;gt; 10.1.11.254: ICMP 10.121.11.47 unreachable - need to frag (mtu 1422), length 556&#10;16:11:28.697397 IP 10.1.11.254.postgresql &amp;gt; 10.121.11.47.35039: Flags [P.], seq 2:1377, ack 234, win 219, options [nop,nop,TS val 1811590 ecr 11065893], length 1375&#10;16:11:28.697438 IP 10.1.96.20 &amp;gt; 10.1.11.254: ICMP 10.121.11.47 unreachable - need to frag (mtu 1422), length 556&#10;16:11:29.241311 IP 10.1.11.254.postgresql &amp;gt; 10.121.11.47.35039: Flags [P.], seq 2:1377, ack 234, win 219, options [nop,nop,TS val 1811726 ecr 11065893], length 1375&#10;16:11:29.241356 IP 10.1.96.20 &amp;gt; 10.1.11.254: ICMP 10.121.11.47 unreachable - need to frag (mtu 1422), length 556&#10;16:11:30.333438 IP 10.1.11.254.postgresql &amp;gt; 10.121.11.47.35039: Flags [P.], seq 2:1377, ack 234, win 219, options [nop,nop,TS val 1811999 ecr 11065893], length 1375&#10;16:11:30.333488 IP 10.1.96.20 &amp;gt; 10.1.11.254: ICMP 10.121.11.47 unreachable - need to frag (mtu 1422), length 556&#10;16:11:32.513418 IP 10.1.11.254.postgresql &amp;gt; 10.121.11.47.35039: Flags [P.], seq 2:1377, ack 234, win 219, options [nop,nop,TS val 1812544 ecr 11065893], length 1375&#10;16:11:32.513467 IP 10.1.96.20 &amp;gt; 10.1.11.254: ICMP 10.121.11.47 unreachable - need to frag (mtu 1422), length 556&#10;16:11:36.881409 IP 10.1.11.254.postgresql &amp;gt; 10.121.11.47.35039: Flags [P.], seq 2:1377, ack 234, win 219, options [nop,nop,TS val 1813636 ecr 11065893], length 1375&#10;16:11:36.881460 IP 10.1.96.20 &amp;gt; 10.1.11.254: ICMP 10.121.11.47 unreachable - need to frag (mtu 1422), length 556&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After quite a bit of Google and mucking in network ACLs and security groups, the fix ended up being this:&lt;/p&gt;</description></item><item><title>OpenVPN CLI Cheat Sheet</title><link>https://evan.wtf/2014/07/22/openvpn-cli-cheat-sheet/</link><pubDate>Tue, 22 Jul 2014 10:58:21 +0000</pubDate><guid>https://evan.wtf/2014/07/22/openvpn-cli-cheat-sheet/</guid><description>&lt;h3 id="adding-a-regular-user-called-testing"&gt;Adding a regular user called testing&lt;a class="heading-anchor" href="#adding-a-regular-user-called-testing" aria-label="Link to this section"&gt;&#10; &lt;svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"&#10; stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&#10; &lt;path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/&gt;&#10; &lt;path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/&gt;&#10; &lt;/svg&gt;&#10; &lt;/a&gt;&#10;&lt;/h3&gt;&#10;&lt;p&gt;/usr/local/openvpn_as/scripts/sacli -u testing -k type -v user_connect UserPropPut&lt;/p&gt;&#10;&lt;h3 id="add-an-autologin-user-called-knock"&gt;Add an autologin user called knock&lt;a class="heading-anchor" href="#add-an-autologin-user-called-knock" aria-label="Link to this section"&gt;&#10; &lt;svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"&#10; stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&#10; &lt;path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/&gt;&#10; &lt;path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/&gt;&#10; &lt;/svg&gt;&#10; &lt;/a&gt;&#10;&lt;/h3&gt;&#10;&lt;p&gt;/usr/local/openvpn_as/scripts/sacli -u knock -k prop_autologin -v true UserPropPut&lt;/p&gt;</description></item><item><title>Create CloudWatch alerts for all Elastic Load Balancers</title><link>https://evan.wtf/2014/07/18/create-cloudwatch-alerts-for-all-elastic-load-balancers/</link><pubDate>Fri, 18 Jul 2014 10:29:57 +0000</pubDate><guid>https://evan.wtf/2014/07/18/create-cloudwatch-alerts-for-all-elastic-load-balancers/</guid><description>&lt;p&gt;I manage a bunch of ELBs but we were missing an alert on a pretty basic metric: how many errors the load balancer was returning. Rather than wade through the UI to add these alerts I figured it would be easier to do it via the CLI.&lt;/p&gt;&#10;&lt;p&gt;Assuming aws-cli is installed and the ARN for your SNS topic (in my case, just an email alert) is $arn:&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;for i in `aws elb describe-load-balancers | grep LoadBalancerName | &#10;perl -ne &amp;#39;chomp; my @a=split(/s+/); $a[2] =~ s/[&amp;#34;,]//g ; print &amp;#34;$a[2] &amp;#34;;&amp;#39; ` ; &#10;do aws cloudwatch put-metric-alarm --alarm-name &amp;#34;$i ELB 5XX Errors&amp;#34; --alarm-description &#10;&amp;#34;High $i ELB 5XX error count&amp;#34; --metric-name HTTPCode_ELB_5XX --namespace AWS/ELB &#10;--statistic Sum --period 300 --evaluation-periods 1 --threshold 50 &#10;--comparison-operator GreaterThanThreshold --dimensions Name=LoadBalancerName,Value=$i &#10;--alarm-actions $arn --ok-actions $arn ; done&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That huge one-liner creates a CloudWatch notification that sends an alarm when the number of 5XX errors returned by the ELB is greater than 50 over 5 minutes, and sends an &amp;ldquo;ok&amp;rdquo; message via the same SNS topic. The for loop creates/modifies the alarm for every ELB.&lt;/p&gt;</description></item><item><title>Setting hostname in an EC2 instance from the name tag</title><link>https://evan.wtf/2014/05/19/setting-hostname-in-an-ec2-instance-from-the-name-tag/</link><pubDate>Mon, 19 May 2014 15:24:09 +0000</pubDate><guid>https://evan.wtf/2014/05/19/setting-hostname-in-an-ec2-instance-from-the-name-tag/</guid><description>&lt;pre tabindex="0"&gt;&lt;code&gt;# pip install awscli&#10;# HOSTNAME=`aws ec2 describe-tags --region us-east-1 --filters Name=resource-id,Values=`curl http://169.254.169.254/latest/meta-data/instance-id 2&amp;gt; /dev/null` Name=key,Values=Name --output text --query &amp;#39;Tags[*].Value&amp;#39;`&#10;# hostname $HOSTNAME&#10;# hostname &amp;gt; /etc/hostname&#10;&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>Goodbye, pg_dump</title><link>https://evan.wtf/2013/09/26/goodbye-pg_dump/</link><pubDate>Thu, 26 Sep 2013 09:12:05 +0000</pubDate><guid>https://evan.wtf/2013/09/26/goodbye-pg_dump/</guid><description>&lt;p&gt;I&amp;rsquo;ve been a Postgres user and administrator for a while. Over the years, my views on backups have evolved.&lt;/p&gt;&#10;&lt;p&gt;Originally, like most people, I started out with good old pg_dump. With a reasonably small database (under 50 GB) dumping to a flat text file is a fine option. I&amp;rsquo;d generally do something like &lt;code&gt;pg_dump -Upostgres dbname | gzip &amp;gt; dbname.sql.gz&lt;/code&gt; to compress it on the fly and save space. For years this seemed perfect: dumping the entire database in a single transaction into a single file that can be restored anywhere.&lt;/p&gt;</description></item><item><title>Load balancing in EC2 with Nginx and HAProxy</title><link>https://evan.wtf/2012/01/09/load-balancing-in-ec2-with-nginx-and-haproxy/</link><pubDate>Mon, 09 Jan 2012 17:00:22 +0000</pubDate><guid>https://evan.wtf/2012/01/09/load-balancing-in-ec2-with-nginx-and-haproxy/</guid><description>&lt;p&gt;We wanted to setup a loadbalanced web cluster in AWS for expansion. My first inclination was to use &lt;a href="http://aws.amazon.com/elasticloadbalancing/"&gt;ELB&lt;/a&gt; for this, but I soon learned that ELB doesn&amp;rsquo;t let you allocate a static IP, requiring you to refer to it only by DNS name. This would be OK except for the fact that our current DNS provider, &lt;a href="http://dyn.com/dns/dynect-managed-dns/"&gt;Dyn&lt;/a&gt;, requires IP addresses when using their GSLB (geo-based load balancer) service.&lt;/p&gt;&#10;&lt;p&gt;Rather than let this derail the whole project, I decided to look into the software options available for loadbalancing in EC2. I&amp;rsquo;ve been a fan of hardware load balancers for a while, sort of looking down at software-based solutions without any real rationale, but in this case I really had no choice so I figured I&amp;rsquo;d give it a try.&lt;/p&gt;</description></item><item><title>Integrating Amazon Simple Email Service with postfix for SMTP smarthost relaying.</title><link>https://evan.wtf/2011/04/28/integrating-amazon-simple-email-service-with-postfix-for-smarthost-relaying/</link><pubDate>Thu, 28 Apr 2011 12:23:47 +0000</pubDate><guid>https://evan.wtf/2011/04/28/integrating-amazon-simple-email-service-with-postfix-for-smarthost-relaying/</guid><description>How I configured an EC2 instance to relay mail through Amazon&amp;rsquo;s SES, and some of the bumps I encountered along the way.</description></item><item><title>Amazon EC2 - ext3 mkfs takes 30+ minutes?</title><link>https://evan.wtf/2010/08/02/amazon-ec2-ext3-mkfs-takes-30-minutes/</link><pubDate>Mon, 02 Aug 2010 11:33:42 +0000</pubDate><guid>https://evan.wtf/2010/08/02/amazon-ec2-ext3-mkfs-takes-30-minutes/</guid><description>&lt;p&gt;I&amp;rsquo;ve been playing around with Amazon EC2 for a new project I&amp;rsquo;m working on and so far I&amp;rsquo;m really impressed. One thing I&amp;rsquo;ve noticed, however, is that it takes forever to create an ext3 filesystem on a new volume. For example, the below command took over 30 minutes to create the filesystem on a 300 GB volume:&lt;/p&gt;&#10;&lt;blockquote&gt;&#10;&lt;h1 id="mke2fs--j--m0-devsdf1"&gt;mke2fs -j -m0 /dev/sdf1&lt;a class="heading-anchor" href="#mke2fs--j--m0-devsdf1" aria-label="Link to this section"&gt;&#10; &lt;svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"&#10; stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&#10; &lt;path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/&gt;&#10; &lt;path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/&gt;&#10; &lt;/svg&gt;&#10; &lt;/a&gt;&#10;&lt;/h1&gt;&#10;&lt;p&gt;mke2fs 1.40.4 (31-Dec-2007)&#10;Filesystem label=&#10;OS type: Linux&#10;Block size=4096 (log=2)&#10;Fragment size=4096 (log=2)&#10;39321600 inodes, 78642183 blocks&#10;0 blocks (0.00%) reserved for the super user&#10;First data block=0&#10;Maximum filesystem blocks=4294967296&#10;2400 block groups&#10;32768 blocks per group, 32768 fragments per group&#10;16384 inodes per group&#10;Superblock backups stored on blocks:&#10;32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,&#10;4096000, 7962624, 11239424, 20480000, 23887872, 71663616&lt;/p&gt;</description></item></channel></rss>