<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Amazon on Evan Hoffman</title><link>https://evan.wtf/tags/amazon/</link><description>Recent content in Amazon on Evan Hoffman</description><generator>Hugo</generator><language>en-US</language><copyright>Evan Hoffman</copyright><lastBuildDate>Thu, 07 Aug 2014 13:16:19 +0000</lastBuildDate><atom:link href="https://evan.wtf/tags/amazon/index.xml" rel="self" type="application/rss+xml"/><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>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>Amazon knows customer service.</title><link>https://evan.wtf/2012/09/27/amazon-knows-customer-service/</link><pubDate>Thu, 27 Sep 2012 10:13:18 +0000</pubDate><guid>https://evan.wtf/2012/09/27/amazon-knows-customer-service/</guid><description>&lt;p&gt;I bought the &lt;a href="http://www.amazon.com/gp/product/B009B50QOU/ref=as_li_ss_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=B009B50QOU&amp;amp;linkCode=as2&amp;amp;tag=evanhoffmasho-20"&gt;latest Green Day album&lt;/a&gt; for $5. After downloading and playing it I realized I was listening to a censored version of the album. I didn&amp;rsquo;t think there was much recourse since it was an MP3 download, and there&amp;rsquo;s no way to &amp;ldquo;return&amp;rdquo; it. But I figured it was worth a try anyway. The worst that could happen is they say no. I started a chat session and to my surprise, they refunded my purchase price within 5 minutes! That&amp;rsquo;s what I call service.&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>Amazon SES: "illegal headers" with ses-send-email.pl (followup)</title><link>https://evan.wtf/2011/08/02/amazon-ses-illegal-headers-with-ses-send-email-pl-followup/</link><pubDate>Tue, 02 Aug 2011 14:39:45 +0000</pubDate><guid>https://evan.wtf/2011/08/02/amazon-ses-illegal-headers-with-ses-send-email-pl-followup/</guid><description>&lt;p&gt;A few people have emailed me asking me to integrate &lt;a href="https://evan.wtf/2011/05/16/amazon-ses-illegal-header-errors/"&gt;the perl code snippet into I wrote to strip illegal headers&lt;/a&gt; when sending email via Amazon SES into something actually usable. I&amp;rsquo;ve done so! I haven&amp;rsquo;t really tested this beyond sending some test emails, but here it is. Use this at your own risk, I make no warranty, blah blah blah.&#10;This fix requires editing &lt;code&gt;ses-send-email.pl&lt;/code&gt;, so I&amp;rsquo;d advise making a backup copy, though I imagine you can always get a fresh version from Amazon if necessary.&lt;/p&gt;</description></item><item><title>Amazon SES - "Illegal Header" errors</title><link>https://evan.wtf/2011/05/16/amazon-ses-illegal-header-errors-2/</link><pubDate>Mon, 16 May 2011 12:37:49 +0000</pubDate><guid>https://evan.wtf/2011/05/16/amazon-ses-illegal-header-errors-2/</guid><description>My thoughts on the &amp;ldquo;illegal header&amp;rdquo; error some people are encountering when relaying mail through postfix/SES. Plus some perl code that should help fix it.</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>Relaying through Google Apps using Sendmail to bypass EC2 spam blockage</title><link>https://evan.wtf/2010/12/01/relaying-through-google-apps-using-sendmail-to-bypass-ec2-spam-blockage/</link><pubDate>Wed, 01 Dec 2010 14:48:06 +0000</pubDate><guid>https://evan.wtf/2010/12/01/relaying-through-google-apps-using-sendmail-to-bypass-ec2-spam-blockage/</guid><description>&lt;p&gt;Update 3 May 2011: I&amp;rsquo;ve subsequently modified our EC2 systems to &lt;a href="https://evan.wtf/2011/04/28/integrating-amazon-simple-email-service-with-postfix-for-smarthost-relaying/"&gt;relay SMTP mail through Amazon&amp;rsquo;s SES&lt;/a&gt; which doesn&amp;rsquo;t have the 500 messages per day limit that Google Apps does.&lt;/p&gt;&#10;&lt;p&gt;A few months ago I moved a site into EC2. I didn&amp;rsquo;t want to move the existing IMAP server (ugh) so I moved the email to Google Apps. There are only about 10 mailboxes so we went with &amp;ldquo;Standard&amp;rdquo; edition (free). Once we completed the move to EC2 we discovered that emails from our webserver were bouncing due to our EC2 IP address being listed in a spam RBL. This sucked, so I looked into relaying the mail from the EC2 webserver through our Google Apps account. Fortunately this turned out to be pretty easy.&lt;/p&gt;</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>