<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Elb on Evan Hoffman</title><link>https://evan.wtf/tags/elb/</link><description>Recent content in Elb 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/elb/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>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>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></channel></rss>