<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
    <title>Alestic.com</title>
    <link rel="alternate" type="text/html" href="http://alestic.com/" />
    
    <id>tag:alestic.com,2009-04-25://1</id>
    <updated>2009-11-12T09:50:51Z</updated>
    <subtitle>Ubuntu on Amazon EC2</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type Pro 4.25</generator>

<link rel="self" href="http://feeds.feedburner.com/alestic" type="application/atom+xml" /><feedburner:emailServiceId>alestic</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><entry>
    <title>New --mysql-stop option for ec2-consistent-snapshot</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/alestic/~3/2oRIriyOwn8/ec2-mysql-stop" />
    <id>tag:alestic.com,2009://1.66</id>

    <published>2009-11-12T09:50:45Z</published>
    <updated>2009-11-12T09:50:51Z</updated>

    <summary>The ec2-consistent-snapshot software tries its best to flush and lock a MySQL database on an EC2 instance while it initiates the EBS snapshot, and for many environments it does a pretty good job. However, there are situations where the database...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="ebs" label="EBS" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2consistentsnapshot" label="ec2-consistent-snapshot" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="google" label="Google" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="innodb" label="InnoDB" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="innodb_disallow_writes" label="innodb_disallow_writes" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="innodb_log_file_size" label="innodb_log_file_size" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="mysql" label="MySQL" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ourdelta" label="OurDelta" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="patches" label="patches" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="snapshots" label="snapshots" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="volumes" label="volumes" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;The &lt;a href="http://alestic.com/2009/09/ec2-consistent-snapshot"&gt;&lt;code&gt;ec2-consistent-snapshot&lt;/code&gt;&lt;/a&gt; software tries its best to flush and lock a MySQL database on an EC2 instance while it initiates the EBS snapshot, and for many environments it does a pretty good job.&lt;/p&gt;

&lt;p&gt;However, there are situations where the database may spend time performing crash recovery from the log file when it is started from a copy of the snapshot.  We are seeing this behavior at &lt;a href="http://www.campusexplorer.com/"&gt;CampusExplorer.com&lt;/a&gt; where the database is constantly active and we have &lt;code&gt;innodb_log_file_size&lt;/code&gt; set (probably too) high.  The delay is doubtless exacerbated by the fact that the blocks on the new EBS volume are being recovered from S3 as it is being built from the snapshot.&lt;/p&gt;

&lt;p&gt;Google has created an &lt;a href="http://code.google.com/p/google-mysql-tools/wiki/InnodbFreeze"&gt;&lt;code&gt;innodb_disallow_writes&lt;/code&gt; MySQL patch&lt;/a&gt; which I think points out the problem we may be hitting.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;em&gt;&amp;#8220;Note that it is not sufficient to run FLUSH TABLES WITH READ LOCK as there are background IO threads used by InnoDB that may still do IO.&amp;#8221;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It would be very nice to have this patch incorporated in MySQL on Ubuntu.  It looks like the OurDelta folks have already &lt;a href="http://ourdelta.org/docs/innodb-freeze"&gt;incorporated the patch&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In any case, when we bring up a database using an EBS volume created from an EBS snapshot of an active database, it can take up to 45 minutes recovering before it lets normal clients connect.  This is too long for us so we&amp;#8217;re trying a new approach.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;ec2-consistent-snapshot&lt;/code&gt; now has a &lt;code&gt;--mysql-stop&lt;/code&gt; option which shuts down the MySQL server, initiates the snapshot, and then restarts the database.  Our hope is that this will get us a snapshot which can be restored and run without delay.  If any MySQL experts can point out the potential flaws in this, please do.&lt;/p&gt;

&lt;p&gt;Since we obviously can&amp;#8217;t stop and start our production database every hour, we are performing this snapshot activity on a replication slave that is dedicated to snapshots and backups.&lt;/p&gt;

&lt;p&gt;We continue to perform occasional snapshots on the production database EBS volume just to help keep it reliable per Amazon&amp;#8217;s instructions, but we don&amp;#8217;t expect to be able to restore it without crash recovery.&lt;/p&gt;

&lt;p&gt;If you&amp;#8217;d like to test the new &lt;code&gt;--mysql-stop&lt;/code&gt; option, please upgrade your &lt;code&gt;ec2-consistent-snapshot&lt;/code&gt; package from the Alestic PPA and let me know how it goes.&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/2oRIriyOwn8" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/11/ec2-mysql-stop</feedburner:origLink></entry>

<entry>
    <title>Understanding Access Credentials for AWS/EC2</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/alestic/~3/Pjy8j0LKoJY/ec2-credentials" />
    <id>tag:alestic.com,2009://1.65</id>

    <published>2009-11-09T14:29:37Z</published>
    <updated>2009-11-09T21:04:32Z</updated>

    <summary>Amazon Web Services (AWS) has a dizzying proliferation of credentials, keys, ids, usernames, certificates, passwords, and codes which are used to access and control various account and service features and functionality. I have never met an AWS user who, when...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="aws" label="AWS" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="certificates" label="certificates" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="credentials" label="credentials" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ids" label="ids" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="keys" label="keys" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="passwords" label="passwords" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="s3" label="S3" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="security" label="security" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ssh" label="ssh" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;Amazon Web Services (AWS) has a dizzying proliferation of credentials, keys, ids, usernames, certificates, passwords, and codes which are used to access and control various account and service features and functionality.  I have never met an AWS user who, when they started, did not have trouble figuring out which ones to use when and where, much less why.&lt;/p&gt;

&lt;p&gt;Amazon is fairly consistent across the documentation and interfaces in the specific terms they use for the different credentials, but nowhere have I found these all listed in one place.  (Update: Shlomo pointed out &lt;a href="http://www.elastician.com/2009/06/managing-your-aws-credentials-part-1.html"&gt;Mitch Garnaat&amp;#8217;s article&lt;/a&gt; on this topic which, upon examination, may even have been my subconscious inspiration for this. Mitch goes into a lot of great detail in his two part post.)&lt;/p&gt;

&lt;p&gt;Pay close attention to the exact names so that you use the right credentials in the right places.&lt;/p&gt;

&lt;p&gt;(1) AWS &lt;strong&gt;Email Address&lt;/strong&gt; and (2) &lt;strong&gt;Password&lt;/strong&gt;.  This pair is used to log in to your AWS account on the &lt;a href="http://aws.amazon.com/account/"&gt;AWS web site&lt;/a&gt;.  Through this web site you can access and change information about your account including &lt;a href="http://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=edit-payment-method"&gt;billing information&lt;/a&gt;.  You can view the &lt;a href="http://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&amp;amp;action=activity-summary"&gt;account activity&lt;/a&gt;. You can control many of the AWS services through the &lt;a href="http://aws.amazon.com/console/"&gt;AWS console&lt;/a&gt;.  And, you can generate and view a number of the other important &lt;a href="http://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=access-key"&gt;access keys&lt;/a&gt; listed in this article.  You may also be able to order products from &lt;a href="http://www.amazon.com/"&gt;Amazon.com&lt;/a&gt; with this account, so be careful.  You should obviously protect your password.  What you do with your email address is your business.  Both of these values may be changed as needed.&lt;/p&gt;

&lt;p&gt;(3) MFA &lt;strong&gt;Authentication Code&lt;/strong&gt;.  If you have ordered and activated a &lt;a href="http://aws.amazon.com/mfa/"&gt;multi-factor authentication&lt;/a&gt; device, then parts of the AWS site will be protected not only by the email address and password described above, but also by an authentication code.  This is a 6 digit code displayed on your device which changes every 30 seconds or so.  The AWS web site will prompt you for this code after you successfully enter your email address and password.&lt;/p&gt;

&lt;p&gt;(4) AWS &lt;strong&gt;Account Number&lt;/strong&gt;.  This is a 12 digit number separated with dashes in the form &lt;code&gt;1234-5678-9012&lt;/code&gt;.  You can find your account number under your name on the top right of most pages on the AWS web site (when you are logged in).  This number is not secret and may be available to other users in certain circumstances.  I don&amp;#8217;t know of any situation where you would use the number in this format with dashes, but it is needed to create the next identifier:&lt;/p&gt;

&lt;p&gt;(5) AWS &lt;strong&gt;User ID&lt;/strong&gt;.  This is a 12 digit number with &lt;em&gt;no&lt;/em&gt; dashes.  In fact, it is simply the previously mentioned AWS Account Number with the dashes removed (e.g., &lt;code&gt;12345678912&lt;/code&gt;).  Your User ID is needed by some API and command line tools, for example when bundling a new image with ec2-bundle-vol.  It can also be entered in to the &lt;a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=609"&gt;ElasticFox&lt;/a&gt; plugin to help display the owners of public AMIs.  Again, your User ID does not need to be kept private.  It is shown to others when you publish an AMI and make it public, though it might take some detective work to figure out who the number really belongs to if you don&amp;#8217;t publicize that, too.&lt;/p&gt;

&lt;p&gt;(6) AWS &lt;strong&gt;Access Key ID&lt;/strong&gt; and (7) &lt;strong&gt;Secret Access Key&lt;/strong&gt;.  This is the first of two pairs of credentials which can be used to access and control basic AWS services through the API including EC2, S3, SimpleDB, CloudFront, SQS, EMR, RDS, etc.  Some interfaces use this pair, and some use the next pair below.  Pay close attention to the names requested.  The Access Key ID is 20 alpha-numeric characters like &lt;code&gt;022QF06E7MXBSH9DHM02&lt;/code&gt; and is not secret; it is available to others in some situations.  The Secret Access Key is 40 alpha-numeric-slash-plus characters like &lt;code&gt;kWcrlUX5JEDGM/LtmEENI/aVmYvHNif5zB+d9+ct&lt;/code&gt; and must be kept very secret.  &lt;/p&gt;

&lt;p&gt;You can change your Access Key ID and Secret Access Key if necessary.  In fact, Amazon recommends regular rotation of these keys by generating a new pair, switching applications to use the new pair, and deactivating the old pair.  If you forget either of these, they are both &lt;a href="http://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=access-key"&gt;available from AWS&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;(8) X.509 &lt;strong&gt;Certificate&lt;/strong&gt; and (9) &lt;strong&gt;Private Key&lt;/strong&gt;.  This is the second pair of credentials that can be used to access the AWS API (SOAP only).  The EC2 command line tools generally need these as might certain 3rd party services (assuming you trust them completely).  These are also used to perform various tasks for AWS like encrypting and signing new AMIs when you build them.  These are the largest credentials, taking taking the form of short text files with long names like  &lt;code&gt;cert-OHA6ZEBHMCGZ66CODVHEKKVOCYWISYCS.pem&lt;/code&gt; and &lt;code&gt;pk-OHA6ZEBHMCGZ66CODVHEKKVOCYWISYCS.pem&lt;/code&gt; respectively.&lt;/p&gt;

&lt;p&gt;The Certificate is supposedly not secret, though I haven&amp;#8217;t found any reason to publicize it.  The Private Key should obviously be kept private.  Amazon keeps a copy of the Certificate so they can confirm your requests, but they do not store your Private Key, so don&amp;#8217;t lose it after &lt;a href="http://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=access-key"&gt;you generate it&lt;/a&gt;.  Two of these pairs can be associated with your account at any one time, so they can be rotated as often as you rotate the Access Key ID and Secret Access Key.  Keep records of all historical keys in case you have a need for them, like unencrypting an old AMI bundle which you created with an old Certificate.&lt;/p&gt;

&lt;p&gt;(10) Linux &lt;strong&gt;username&lt;/strong&gt;.  When you ssh to a new EC2 instance you need to connect as a user that already exists on that system.   For almost all public AMIs, this is the &lt;code&gt;root&lt;/code&gt; user, but on Ubuntu AMIs published by Canonical, you need to connect using the &lt;code&gt;ubuntu&lt;/code&gt; user.  Once you gain access to the system, you can create your own users.&lt;/p&gt;

&lt;p&gt;(11) &lt;strong&gt;public ssh key&lt;/strong&gt; and (12) &lt;strong&gt;private ssh key&lt;/strong&gt;.  These are often referred to as a &lt;strong&gt;keypair&lt;/strong&gt; in EC2.  The ssh keys are used to make sure that only you can access your EC2 instances.  When you run an instance, you specify the name of the keypair and the corresponding public key is provided to that instance.  When you ssh to the above username on the instance, you specify the private key so the instance can authenticate you and let you in.&lt;/p&gt;

&lt;p&gt;You can have multiple ssh keypairs associated with a single AWS account; they are created through the API or with tools like the &lt;code&gt;ec2-add-keypair&lt;/code&gt; command.  The private key must be protected as anybody with this key can log in to your instances.  You generally never see or deal with the public key as EC2 keeps this copy and provides it to the instances.  You download the private key and save it when it is generated; Amazon does not keep a record of it.&lt;/p&gt;

&lt;p&gt;(13) &lt;strong&gt;ssh host key&lt;/strong&gt;.  Just to make things interesting, each EC2 instance which you run will have its own ssh host key.  This is a private file generated by the host on first boot which is used to protect your ssh connection to the instance so it cannot be intercepted and read by other people.  In order to make sure that your connection is secure, you need to verify that the (14) &lt;strong&gt;ssh host key fingerprint&lt;/strong&gt;, which is provided to you on your first ssh attempt, matches the fingerprint listed in the console output of the EC2 instance.&lt;/p&gt;

&lt;p&gt;At this point you may be less or more confused, but here are two rules which may help:&lt;/p&gt;

&lt;p&gt;A. Create a file or folder where you jot down and save all of the credentials associated with each AWS account.  You don&amp;#8217;t want to lose any of these, especially the ones which Amazon does not store for you.  Consider encrypting this information with (yet another) secure passphrase.&lt;/p&gt;

&lt;p&gt;B. Pay close attention to what credentials are being asked for by different tools.  A &amp;#8220;secret access key&amp;#8221; is different from a &amp;#8220;private key&amp;#8221; is different from a &amp;#8220;private ssh key&amp;#8221;.  Use the above list to help sort things out.&lt;/p&gt;

&lt;p&gt;Use the comment section below to discuss what I missed in this overview.&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/Pjy8j0LKoJY" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/11/ec2-credentials</feedburner:origLink></entry>

<entry>
    <title>How *Not* to Upgrade to Ubuntu 9.10 Karmic on Amazon EC2</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/alestic/~3/ZrUIlRAi1LM/how-not-to-upgrade-to-ubuntu-910-karmic-on-amazon-ec2" />
    <id>tag:alestic.com,2009://1.64</id>

    <published>2009-10-29T18:38:12Z</published>
    <updated>2009-10-29T17:41:16Z</updated>

    <summary>WARNING! Though most Ubuntu 9.04 Jaunty systems can upgrade to 9.10 Karmic in place, this is not possible on EC2 and should not be attempted. If you do try this, your system will become unusable on reboot and there will...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="amis" label="AMIs" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="jaunty" label="Jaunty" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="karmic" label="Karmic" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="kernels" label="kernels" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="udev" label="udev" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="upgrades" label="upgrades" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;&lt;strong&gt;WARNING!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Though most Ubuntu 9.04 Jaunty systems can upgrade to 9.10 Karmic &lt;a href="https://help.ubuntu.com/community/KarmicUpgrades"&gt;in place&lt;/a&gt;, this is &lt;em&gt;not&lt;/em&gt; possible on EC2 and should not be attempted.  If you do try this, your system will become unusable on reboot and there will be no recovery and no access to any of the data on the boot disk or ephemeral storage.&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s why: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Ubuntu 9.10 Karmic has a version of udev which requires a newer kernel than you would be running for Ubuntu 9.04 Jaunty (especially on EC2).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You cannot upgrade the kernel used by a running instance on Amazon EC2 (not even rebooting).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When an EC2 instance cannot boot (as in the case of the udev/kernel mismatch) your only option is to terminate it, losing the local storage.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;How &lt;em&gt;To&lt;/em&gt; Upgrade&lt;/h2&gt;

&lt;p&gt;In order to upgrade to Karmic you will need to start a new EC2 instance running a fresh copy of the appropriate Karmic AMI.  I post the latest AMI ids for Karmic in the second table on &lt;a href="http://alestic.com/"&gt;http://alestic.com/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Keep your old instance(s) running while you configure and test the new Karmic instances.  EC2 makes it easy to have multiple sets of servers running in parallel instead of upgrading in place.  When you are confident your new servers are functioning properly, you can discard the old ones.&lt;/p&gt;

&lt;p&gt;The Ubuntu 9.10 Karmic AMIs released by Canonical have a number of &lt;a href="http://alestic.com/2009/04/official-ubuntu-ec2"&gt;differences&lt;/a&gt; from the community Ubuntu AMIs which have been published on &lt;a href="http://alestic.com"&gt;http://alestic.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;One of the biggest differences is that you will ssh to &lt;code&gt;ubuntu@&lt;/code&gt; instead of to &lt;code&gt;root@&lt;/code&gt; on your instance.  You can then sudo to perform commands as the root user.  Back in April I wrote a guide about &lt;a href="http://alestic.com/2009/04/ubuntu-ec2-sudo-ssh-rsync"&gt;Using sudo, ssh, rsync on the Official Ubuntu Images for EC2&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The Ubuntu server team has put a lot of work into making Ubuntu 9.10 Karmic function beautifully on Amazon EC2 and it&amp;#8217;s been a pleasure to have a small part in the process.  I&amp;#8217;m already using the Karmic AMIs on EC2 for one of my production processes.  Please give these AMIs a spin and give feedback.&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/ZrUIlRAi1LM" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/10/how-not-to-upgrade-to-ubuntu-910-karmic-on-amazon-ec2</feedburner:origLink></entry>

<entry>
    <title>1 TB of Memory in 1 Minute with 1 Command</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/alestic/~3/qHAWYF1Kvbw/ec2-4xlarge" />
    <id>tag:alestic.com,2009://1.63</id>

    <published>2009-10-27T09:38:18Z</published>
    <updated>2009-10-27T08:42:01Z</updated>

    <summary>Amazon Web Services just announced the release of two new instance types for EC2. These new types have 34.2 GB and 68.4 GB of RAM with a decent amount of CPU capacity on modern CPUs to go along with it....</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="cpu" label="CPU" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="instancetypes" label="instance types" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="instances" label="instances" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="m22xlarge" label="m2.2xlarge" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="m24xlarge" label="m2.4xlarge" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="memory" label="memory" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ram" label="ram" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;Amazon Web Services just announced the release of two new instance types for EC2.  These new types have 34.2 GB and 68.4 GB of RAM with a decent amount of CPU capacity on modern CPUs to go along with it.&lt;/p&gt;

&lt;p&gt;Others have already done a great job of describing the instance types:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://aws.typepad.com/aws/2009/10/two-new-ec2-instance-types-additional-memory.html"&gt;Jeff Barr&amp;#8217;s AWS blog&lt;/a&gt;&lt;/p&gt;
  
  &lt;p&gt;&lt;a href="http://blog.rightscale.com/2009/10/26/amazon-relational-database-service/"&gt;RightScale&amp;#8217;s blog&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;but when it comes to flexing the raw power at my fingertips with AWS, sometimes I can&amp;#8217;t help myself.  So&amp;#8230; &lt;/p&gt;

&lt;p&gt;sitting on my couch with my laptop watching an episode of &amp;#8220;Lie to me&amp;#8221; on TiVo I just typed:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-run-instances            \
  --instance-type m2.4xlarge \
  --key KEYPAIR              \
  --instance-count 19        \
  ami-e6f6158f
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and in under a minute and about $45 later, I had ssh access to well over 1 TB (1,000 GB) of free memory.  To be sure, it was spread over 19 Ubuntu servers, but still, there&amp;#8217;s gotta be something I can do with that, no?&lt;/p&gt;

&lt;p&gt;Here are the results on a single one of these servers running Ubuntu 8.04 Hardy:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;root@domU-12-31-39-08-7F-51:~# free
             total       used       free     shared    buffers     cached
Mem:      71687580    1521464   70166116          0       2632      17704
-/+ buffers/cache:    1501128   70186452
Swap:            0          0          0

root@domU-12-31-39-08-7F-51:~# free -g
             total       used       free     shared    buffers     cached
Mem:            68          1         66          0          0          0
-/+ buffers/cache:          1         66
Swap:            0          0          0
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Wait, I&amp;#8217;d better do whatever I&amp;#8217;m gonna do quick or I&amp;#8217;m going to be charged another $45.60 for the next hour&amp;#8217;s worth of fun!&lt;/p&gt;

&lt;p&gt;Ok, time to cut my losses:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-describe-instances | 
  egrep m2.4xlarge | 
  cut -f2 | 
  xargs ec2-terminate-instances
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In case you didn&amp;#8217;t feel like spending $2.40 to find out the CPUs on one of these beasts, here&amp;#8217;s one of the ones I ran:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;vendor_id   : GenuineIntel
cpu family  : 6
model       : 26
model name  : Intel(R) Xeon(R) CPU           X5550  @ 2.67GHz
stepping    : 5
cpu MHz     : 2666.760
cache size  : 8192 KB
bogomips    : 5203.00
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And remember that there&amp;#8217;s 8 of these on the m2.4xlarge instance size.  (Exact CPUs not guaranteed, your results my vary, etc.)&lt;/p&gt;

&lt;p&gt;Amazon Web Services seems to keep releasing new features in advance of when &lt;a href="http://www.campusexplorer.com/"&gt;our growing startup&lt;/a&gt; needs them.  As we start to think about whether we are going to need to trim some tables or split up the database, here comes an instance type that will let us grow a lot longer just focusing on our core business challenges instead of on the infrastructure.&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/qHAWYF1Kvbw" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/10/ec2-4xlarge</feedburner:origLink></entry>

<entry>
    <title>New Releases of Ubuntu and Debian Images for Amazon EC2 (Kernel, Security, PPA, runurl, Tools)</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/alestic/~3/-hr1mdX7ZEM/ec2-ubuntu-ami-release-kernel" />
    <id>tag:alestic.com,2009://1.62</id>

    <published>2009-10-12T14:56:02Z</published>
    <updated>2009-10-12T14:13:43Z</updated>

    <summary>New updates have been released for the Ubuntu and Debian AMIs (EC2 images) published on: http://alestic.com The following notes apply to this release: The images have been upgraded to use the newest 2.6.21 kernel, ramdisk, and kernel modules from Amazon....</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="amis" label="AMIs" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="images" label="images" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="kernels" label="kernels" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ppa" label="ppa" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="release" label="release" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="runurl" label="runurl" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="security" label="security" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="tools" label="tools" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;New updates have been released for the Ubuntu and Debian AMIs (EC2 images) published on:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://alestic.com"&gt;http://alestic.com&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The following notes apply to this release:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The images have been upgraded to use the newest 2.6.21 kernel, ramdisk, and kernel modules from Amazon.  This fixes a serious security hole in the previous 2.6.21 kernel.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;a href="https://launchpad.net/~alestic/+archive/ppa"&gt;Alestic PPA&lt;/a&gt; (personal package archive) has been added to the Ubuntu AMIs.  This makes it easy to install software packages listed in this PPA, including &lt;a href="http://alestic.com/2009/09/ec2-consistent-snapshot"&gt;ec2-consistent-snapshot&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;a href="http://alestic.com/2009/08/runurl"&gt;&lt;code&gt;runurl&lt;/code&gt;&lt;/a&gt; package from the Alestic PPA has been pre-installed on the Ubuntu AMIs.  This can be a handy tool for setting up new instances with &lt;a href="http://alestic.com/2009/06/ec2-user-data-scripts"&gt;user-data scripts&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The EC2 AMI tools have been upgraded to version 1.3-34544.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The ec2-ami-tools package version has been pinned so it does not get downgraded if the official Ubuntu archives still have older versions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;All packages have been upgraded to their respective latest versions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Ubuntu Karmic images were not updated and have been removed from the listings at the top of &lt;a href="http://alestic.com"&gt;http://alestic.com&lt;/a&gt;.  If you would like to use Ubuntu Karmic Beta, please test with the AMIs published by Canonical listed a bit lower down on the page.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Please give these new images a spin and let us know if you run into any problems.&lt;/p&gt;

&lt;p&gt;Enjoy&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/-hr1mdX7ZEM" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/10/ec2-ubuntu-ami-release-kernel</feedburner:origLink></entry>

<entry>
    <title>Encrypting Ephemeral Storage and EBS Volumes on Amazon EC2</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/alestic/~3/KR3hZt2iJAA/ec2-disk-encryption" />
    <id>tag:alestic.com,2009://1.61</id>

    <published>2009-10-07T11:07:19Z</published>
    <updated>2009-10-07T10:46:25Z</updated>

    <summary>Over the years, Amazon has repeatedly recommended that customers who care about the security of their data should consider encrypting information stored on disks, whether ephemeral storage (/mnt) or EBS volumes. This, even though they take pains to ensure that...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="cryptsetup" label="cryptsetup" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="disks" label="disks" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ebs" label="EBS" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="encryption" label="encryption" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="luks" label="LUKS" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="privacy" label="privacy" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="security" label="security" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="storage" label="storage" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;Over the years, Amazon has repeatedly recommended that customers who care about the security of their data should consider encrypting information stored on disks, whether ephemeral storage (&lt;code&gt;/mnt&lt;/code&gt;) or EBS volumes.  This, even though they take pains to ensure that disk blocks are wiped between uses by different customers, and they implement policies which restrict access to disks even by their own employees.&lt;/p&gt;

&lt;p&gt;There are a few levels where encryption can take place:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;File level.  This includes tools like GnuPG, freely available on Ubuntu in the &lt;code&gt;gnupg&lt;/code&gt; package.  If you use this approach, make sure that you don&amp;#8217;t store the unencrypted information on the disk before encrypting it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;File system level.  This includes useful packages like &lt;code&gt;encfs&lt;/code&gt; which transparently encrypt files before saving to disk, presenting the unencrypted contents in a virtual file system.  This can even be used on top of an &lt;code&gt;s3fs&lt;/code&gt; file system letting you store encrypted data on S3 with ease.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Block device level.  You can place any file system you&amp;#8217;d like on top of the encrypted block interface and neither your application nor your file system realize that the hardware disk never sees unencrypted data.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The rest of this article presents a simple way to set up a level of encryption at the block device level using cryptsetup/LUKS.  It has been tested on the 32-bit Ubuntu 9.10 Jaunty server AMI listed on &lt;a href="http://alestic.com"&gt;http://alestic.com&lt;/a&gt; and should work on other Ubuntu AMIs and even other distros with minor changes.&lt;/p&gt;

&lt;p&gt;This walkthrough uses the &lt;code&gt;/mnt&lt;/code&gt; ephemeral storage, but you can replace &lt;code&gt;/mnt&lt;/code&gt; and &lt;code&gt;/dev/sda2&lt;/code&gt; with appropriate mount point and device for 64-bit instance types or EBS volumes.&lt;/p&gt;

&lt;h2&gt;Setup&lt;/h2&gt;

&lt;p&gt;Install tools and kernel modules:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo apt-get update
sudo apt-get install -y cryptsetup xfsprogs
for i in sha256 dm_crypt xfs; do 
  sudo modprobe $i
  echo $i | sudo tee -a /etc/modules
done
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Before you continue, make sure there is nothing valuable on /mnt because we&amp;#8217;re going to replace it!&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo umount /mnt
sudo chmod 000 /mnt
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Encrypt the disk and create your favorite file system on it:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo luksformat -t xfs /dev/sda2
sudo cryptsetup luksOpen /dev/sda2 crypt-sda2
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Remember your passphrase!  It is not recoverable!&lt;/p&gt;

&lt;p&gt;Update &lt;code&gt;/etc/fstab&lt;/code&gt; and replace the &lt;code&gt;/mnt&lt;/code&gt; line (or create a new line for an EBS volume):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;fstabentry='/dev/mapper/crypt-sda2 /mnt xfs noauto 0 0'
sudo perl -pi -e "s%^.* /mnt .*%$fstabentry%" /etc/fstab
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Mount the file system on the encrypted block device:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo mount /mnt
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You&amp;#8217;re now to free to place files on &lt;code&gt;/mnt&lt;/code&gt; knowing that the content will be encrypted before it is written to the hardware disk.&lt;/p&gt;

&lt;p&gt;After reboot, &lt;code&gt;/mnt&lt;/code&gt; will appear empty until you re-mount the encrypted partition, entering your passphrase:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo cryptsetup luksOpen /dev/sda2 crypt-sda2
sudo mount /mnt
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Notes&lt;/h2&gt;

&lt;p&gt;See &amp;#8220;&lt;code&gt;man cryptsetup&lt;/code&gt;&amp;#8221; for info on adding keys and getting information from the LUKS disk header.&lt;/p&gt;

&lt;p&gt;It is possible to auto-mount the encrypted disk on reboot if you are willing to put your passphrase in the root partition (almost ruins the point of encryption).  See the documentation on &lt;code&gt;crypttab&lt;/code&gt; and consider adding a line like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;crypt-sda2 /dev/sda2 /PASSPHRASEFILE luks
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Study the &lt;code&gt;cryptsetup&lt;/code&gt; documentation carefully so that you understand what is going on.  Keeping your data private is important, but it&amp;#8217;s also important that you know how to get it back in the case of problems.&lt;/p&gt;

&lt;p&gt;This article does not attempt to cover all of the possible security considerations you might need to take into account for data leakage on disks.  For example, sensitive information might be stored in /tmp, /etc, or log files on the root disk.  If you have swap enabled, anything in memory could be saved in the clear to disk whenever the operating system feels like it.&lt;/p&gt;

&lt;p&gt;How do you solve your data security challenges on EC2?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was based on a post made on the &lt;a href="http://groups.google.com/group/ec2ubuntu/web/encrypting-mnt-using-cryptsetup-on-ubuntu-7-10-gutsy-on-amazon-ec2"&gt;EC2 Ubuntu group&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/KR3hZt2iJAA" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/10/ec2-disk-encryption</feedburner:origLink></entry>

<entry>
    <title>Creating Consistent EBS Snapshots with MySQL and XFS on EC2</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/alestic/~3/6jzRv1R6udQ/ec2-consistent-snapshot" />
    <id>tag:alestic.com,2009://1.60</id>

    <published>2009-09-29T12:20:52Z</published>
    <updated>2009-11-12T12:42:36Z</updated>

    <summary>In the article Running MySQL on Amazon EC2 with Elastic Block Store I describe the principles involved in using EBS on EC2. Though originally published in 2008, it is still relevant today and is worth reviewing to get context for...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="ebs" label="EBS" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2consistentsnapshot" label="ec2-consistent-snapshot" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="mysql" label="MySQL" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ppa" label="PPA" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="snapshots" label="snapshots" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="volumes" label="volumes" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="xfs" label="XFS" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;In the article &lt;a href="http://ec2ebs-mysql.notlong.com/"&gt;Running MySQL on Amazon EC2 with Elastic Block Store&lt;/a&gt; I describe the principles involved in using EBS on EC2.  Though originally published in 2008, it is still relevant today and is worth reviewing to get context for this article.&lt;/p&gt;

&lt;p&gt;In the above tutorial, I included a sample script which followed the basic instructions in the article to initiate EBS snapshots of an XFS file system containing a MySQL database.  For the most part this script worked for basic installations with low volume.&lt;/p&gt;

&lt;p&gt;Over the last year as I and my co-workers have been using this code in production systems, we identified a number of ways it could be improved.  Or, put another way, some serious issues came up when the idealistic world view of the original simplistic script met the complexities which can and do arise in the brutal real world.&lt;/p&gt;

&lt;p&gt;We gradually improved the code over the course of the year, until the point where it has been running smoothly on production systems with no serious issues.  This doesn&amp;#8217;t mean that there aren&amp;#8217;t any areas left for improvement, but does seem like it&amp;#8217;s ready for the general public to give it a try.&lt;/p&gt;

&lt;p&gt;The name of the new program is &lt;a href="https://launchpad.net/ec2-consistent-snapshot"&gt;&lt;code&gt;ec2-consistent-snapshot&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Features&lt;/h2&gt;

&lt;p&gt;Here are some of the ways in which the &lt;code&gt;ec2-consistent-snapshot&lt;/code&gt; program has improved over the original:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Command line options for passing in AWS keys, MySQL access information, and more.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can be run with or without a MySQL database on the file system.  This lets you use the command to initiate snapshots for any EBS volume.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can be used with or without XFS file systems, though if you don&amp;#8217;t use XFS, you run the risk of not having a consistent file system on EBS volume restore.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Instead of using the painfully slow ec2-create-snapshot command written in Java, this Perl program accesses the EC2 API directly with orders of magnitude speed improvement.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A preliminary &lt;code&gt;FLUSH&lt;/code&gt; is performed on the MySQL database before the &lt;code&gt;FLUSH WITH READ LOCK&lt;/code&gt;.  This preparation reduces the total time the tables are locked.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A preliminary &lt;code&gt;sync&lt;/code&gt; is performed on the XFS file system before the &lt;code&gt;xfs_freeze&lt;/code&gt;.  This preparation reduces the total time the file system is locked.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The MySQL &lt;code&gt;LOCK&lt;/code&gt; now has timeouts and retries around it.  This prevents horrible blocking interactions between the database lock, long running queries, and normal transactions.  The length of the timeout and the number of retries are configurable with command line options.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The MySQL &lt;code&gt;FLUSH&lt;/code&gt; is done in such a way that the statement does not propagate through to slave databases, negatively impacting their performance and/or causing negative blocking interactions with long running queries.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cleans up MySQL and XFS locks if it is interrupted, if a timeout happens, or if other errors occur.  This prevents a number of serious locking issues when things go wrong with the environment or EC2 API.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can snapshot EBS volumes in a region other than the default (e.g., &lt;code&gt;eu-west-1&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can initiate snapshots of multiple EBS volumes at the same time while everything is consistently locked.  This has been used to create consistent snapshots of RAIDed EBS volumes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Installation&lt;/h2&gt;

&lt;p&gt;On Ubuntu, you can install the &lt;code&gt;ec2-consistent-snapshot&lt;/code&gt; package using the new &lt;a href="https://launchpad.net/~alestic/+archive/ppa"&gt;Alestic PPA&lt;/a&gt; (personal package archive) hosted on Launchpad.net.  Here are the steps to set up access to packages in the Alestic PPA:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;codename=$(lsb_release -cs)
echo "deb http://ppa.launchpad.net/alestic/ppa/ubuntu $codename main"|
  sudo tee /etc/apt/sources.list.d/alestic-ppa.list    
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BE09C571
sudo apt-get update
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Once this is set up, you can install and upgrade packages in the Alestic PPA just as you would with any other Ubuntu package.  Here&amp;#8217;s the command to install the &lt;code&gt;ec2-consistent-snapshot&lt;/code&gt; package:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo apt-get install -y ec2-consistent-snapshot
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This will also install all of the dependency packages except for the &lt;code&gt;Net::Amazon::EC2&lt;/code&gt; Perl module which does not yet have an Ubuntu package.  You can install this with the command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo PERL_MM_USE_DEFAULT=1 cpan Net::Amazon::EC2
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now you can read the documentation using:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;man ec2-consistent-snapshot
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and run the &lt;code&gt;ec2-consistent-snapshot&lt;/code&gt; command itself.&lt;/p&gt;

&lt;h2&gt;Feedback&lt;/h2&gt;

&lt;p&gt;If you find any problems with &lt;code&gt;ec2-consistent-snapshot&lt;/code&gt;, please &lt;a href="https://bugs.launchpad.net/ec2-consistent-snapshot/+filebug"&gt;create bug reports in launchpad&lt;/a&gt;.  The same mechanism can be used to submit ideas for improvement, which are especially welcomed if you include a patch.&lt;/p&gt;

&lt;p&gt;Other questions and feedback are accepted in the comments section for this article.  If you&amp;#8217;re reading this on a planet, please click through on the title to read the comments.&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/6jzRv1R6udQ" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/09/ec2-consistent-snapshot</feedburner:origLink></entry>

<entry>
    <title>Hidden Dangers in Creating Public EBS Snapshots on EC2</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/alestic/~3/u_BiTU0J7iI/ec2-public-ebs-danger" />
    <id>tag:alestic.com,2009://1.59</id>

    <published>2009-09-27T03:20:06Z</published>
    <updated>2009-09-27T04:21:22Z</updated>

    <summary>Amazon EC2 recently released a feature which lets you share an EBS snapshot so that other accounts can access it. The snapshot can be shared with specific individual accounts or with the public at large. You should obviously be careful...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="challenges" label="challenges" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ebs" label="EBS" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="privacy" label="privacy" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="rewards" label="rewards" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="security" label="security" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="snapshots" label="snapshots" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="volumes" label="volumes" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;Amazon EC2 recently released a feature which lets you &lt;a href="http://aws.typepad.com/aws/2009/09/shared-snapshots-for-ec2s-elastic-block-store-volumes.html"&gt;share an EBS snapshot&lt;/a&gt; so that other accounts can access it.  The snapshot can be shared with specific individual accounts or with the public at large.&lt;/p&gt;

&lt;p&gt;You should obviously be careful what files you put on a shared EBS snapshot because other people are going to be able to read them.  What may not be so obvious to is that you also need to be wary of what files are not &lt;em&gt;currently&lt;/em&gt; on the snapshot but once &lt;em&gt;were&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;For example, if you copied some files onto the EBS volume, then realized a few contained sensitive information, you might think it&amp;#8217;s sufficient to delete the private files and continue on to create a public EBS snapshot of the volume.&lt;/p&gt;

&lt;p&gt;The problem with this is that EBS is an elastic &lt;strong&gt;block&lt;/strong&gt; store device, not an interface at the file system level.  Any block which was once written to on the block device will be available on the shared EBS volume, even if it is not being used by a visible file on the file system.&lt;/p&gt;

&lt;p&gt;Since popular Linux file systems do not generally wipe data when a file is deleted, it is often possible to recover the contents of the deleted files.  Even attempting to overwrite a file may, depending on the application, leave the original content available on the disk.&lt;/p&gt;

&lt;p&gt;This means any content that touched your EBS volume at any point may still be available to users of your shared EBS snapshot.&lt;/p&gt;

&lt;p&gt;To be clear: I do not consider this to be a security flaw in EC2 or EBS.  It is merely a security risk for people who do not understand and take precautions against the combination of interactions with file systems, block devices, EBS volumes, and snapshots.&lt;/p&gt;

&lt;h2&gt;$100 Reward&lt;/h2&gt;

&lt;p&gt;To demonstrate the security risk, I have created a simple challenge with a tangible reward.  Here is a public EBS snapshot:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;snap-d53484bc&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This EBS snapshot contains two files.   The first file is README-1.txt which has nothing sensitive in it but will let you know that you&amp;#8217;ve got the right device mounted on your EC2 instance.&lt;/p&gt;

&lt;p&gt;The second file created on the source EBS volume contained an Amazon.com gift certificate for $100.  I deleted this second file, then took an EBS snapshot of the volume and released it to the public.&lt;/p&gt;

&lt;p&gt;The first person who successfully recovers the deleted file on this shared EBS snapshot and enters the gift certificate code into their Amazon.com account will win the $100 prize.  Subsequent solvers will get a notice from Amazon that the certificate has already been redeemed, but you still get credit for solving it and helping demonstrate the risks.&lt;/p&gt;

&lt;p&gt;Feel free to post a comment on this blog entry if you recovered the deleted file on the shared EBS snapshot.  Recipes for doing so are welcomed even if you were not the first.  I tested this, so know it&amp;#8217;s possible and that the deleted file is still accessible (but I did not redeem the gift certificate, of course).&lt;/p&gt;

&lt;p&gt;Good luck!&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/u_BiTU0J7iI" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/09/ec2-public-ebs-danger</feedburner:origLink></entry>

<entry>
    <title>Solving: "I can't connect to my server on Amazon EC2"</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/alestic/~3/-NA2T6J9EJQ/ec2-connectivity" />
    <id>tag:alestic.com,2009://1.58</id>

    <published>2009-08-24T19:05:39Z</published>
    <updated>2009-09-27T07:43:42Z</updated>

    <summary>Help! I can’t connect to my EC2 instance! Woah! My box just stopped talking to me! Hey! I can’t access the server! These and other variations on the connectivity theme are some of the most common problems raised on the...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="apache" label="Apache" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="connectivity" label="connectivity" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="mysql" label="MySQL" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="networking" label="networking" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="problems" label="problems" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="security" label="security" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="securitygroups" label="securitygroups" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="solutions" label="solutions" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ssh" label="ssh" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="support" label="support" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="tutorials" label="tutorials" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;&lt;em&gt;Help! I can&amp;#8217;t connect to my EC2 instance!&lt;/em&gt; &lt;br /&gt;
&lt;em&gt;Woah! My box just stopped talking to me!&lt;/em&gt; &lt;br /&gt;
&lt;em&gt;Hey! I can&amp;#8217;t access the server!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;These and other variations on the connectivity theme are some of the most common problems raised on the &lt;a href="http://ec2forum.notlong.com/"&gt;Amazon EC2 forum&lt;/a&gt;.  &lt;/p&gt;

&lt;p&gt;The EC2 community and Amazon employees do a valiant job helping users track down and solve these issues despite the facts that (1) there are hundreds of reasons why a server or service might not be accessible, (2) connectivity is one of the harder problems to diagnose, especially without being hands-on, and (3) users complaining about a problem generally don&amp;#8217;t provide the clues necessary to solve the issue (because the ones who knew what those clues were probably solved it themselves and didn&amp;#8217;t post).&lt;/p&gt;

&lt;p&gt;This article is an attempt to provide some general assistance to folks who are experiencing connectivity issues with Amazon EC2.  Please post additional help in the comments; this document will be updated over time.&lt;/p&gt;

&lt;h2&gt;Questions&lt;/h2&gt;

&lt;p&gt;First off, you should understand that it&amp;#8217;s ok to ask for help.  When you do, though, you should provide as many details as possible about what you are trying to do and what results you are seeing.  It also helps if you drop some clues about your level of expertise. A person using Linux for the first time is likely to make different mistakes on EC2 than a person who is having problems connecting to a custom AMI they built from scratch.&lt;/p&gt;

&lt;p&gt;The more specific you can be about your problem and the more information you can provide, the more likely somebody will be able to help.  Here are some common questions which are important to have answered for connectivity problems on EC2:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;When you say you &amp;#8220;can&amp;#8217;t connect&amp;#8221; what application are you trying to use and on what port?  For example: &amp;#8220;ssh to port 22&amp;#8221; or &amp;#8220;accessing port 80 with Firefox&amp;#8221;.  If you don&amp;#8217;t know what a port is, then provide as many details as possible about the application you&amp;#8217;re using and what command or steps you are taking to initiate the connection.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What, specifically, happens when you try to connect?  Does it hang for a long time and eventually time out?  Do you get an error message?  What is the exact text you see?   (Copy and paste, don&amp;#8217;t summarize.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What is the AMI id which the instance is running?  If it is not a public AMI, then what is the AMI id of the public AMI it is based on?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What Linux distro and release is the instance running? E.g., Ubuntu 9.04 Jaunty, Debian etch, Fedora 8, CentOS 5.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What is the instance id of the instance you are trying to contact?  Providing this can let Amazon employees take a look at the internals of what might be going on.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What are the internal and external IP addresses and/or host names for the instance you are trying to reach?  Providing this information is, in effect, giving permission to the community to try to contact your server over the network so that they can gather information about connectivity and help solve your problem.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Have you ever been able to contact this instance in the past?  How recently?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How long has the instance been running?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Have you ever been able to contact another instance of the same AMI?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Is there a difference in connectivity when you try from another EC2 instance instead of from the Internet?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What were you doing when the connectivity stopped?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What is the console output of the instance?  You can get this through an API client or a command like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-get-console-output INSTANCE_ID
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There are so many reasons that connectivity might be down to a remote server or service that it would be impossible to get a significant percentage of them listed in one article.  I&amp;#8217;ll start by listing some of the more common problems here; please add to the comments as you run into or remember others.&lt;/p&gt;

&lt;h2&gt;You&lt;/h2&gt;

&lt;p&gt;By far the most common cause of the problem is &lt;em&gt;you&lt;/em&gt; (the person experiencing the problem) and that&amp;#8217;s ok.  We all make mistakes. It&amp;#8217;s important, though, that you start with this attitude: open to the possibilities that you typed something wrong, forgot a step, or didn&amp;#8217;t quite understand the complex instructions. Ninety percent of the people reading this paragraph think I&amp;#8217;m talking to somebody else; oddly, they also think this sentence is not about them.&lt;/p&gt;

&lt;p&gt;Here are some of the most common reasons folks (including me) can&amp;#8217;t connect to their Amazon EC2 instance.  Really.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You&amp;#8217;re not connecting to the right instance or to the instance you think you&amp;#8217;re trying to connect to.  Servers on EC2 are identified by opaque instance ids like &lt;code&gt;i-ae1df2c6&lt;/code&gt; and opaque host names like &lt;code&gt;ec2-75-101-182-20.compute-1.amazonaws.com&lt;/code&gt;.  It&amp;#8217;s easy for anybody to get these confused or mistype them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The instance you&amp;#8217;re trying to connect to has not completed the boot process yet.  Though some AMIs are ready to connect in under a minute, others can take 10+ minutes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The instance you&amp;#8217;re trying to connect to has been terminated.  (Did you just shut down what you thought was a different instance?)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The service you are trying to reach on the instance is not running on that instance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The service you are trying to reach on the instance is not listening on that port or that network interface.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You did not open the port in the security group.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You did not start the instance with the correct security group.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You did not start the instance with the same ssh keypair as you are using to access it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your local firewall is preventing you from getting out to that port on any server outside your network.  Talk to your local network administrators.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your firewall on the instance is preventing access to the service.  Try shutting down iptables temporarily to see if that helps.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You &amp;#8220;experts&amp;#8221; laugh when you read these, but if you&amp;#8217;re having trouble reaching a server, I recommend you go through each one carefully and double check that your assumptions are correct and the world is really as you remember it.  Remember: We all make mistakes.  A lot of these come from personal experience.&lt;/p&gt;

&lt;p&gt;If you&amp;#8217;re not quite sure what terms like &amp;#8220;security group&amp;#8221; and &amp;#8220;keypair&amp;#8221; mean in the EC2 context, I recommend going back and reading some &lt;a href="http://ec2gsg.notlong.com/"&gt;introductory material&lt;/a&gt;. These are important concepts for beginners.&lt;/p&gt;

&lt;h2&gt;ssh&lt;/h2&gt;

&lt;p&gt;The ssh connectivity problems generally fall into a couple major buckets&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;ssh is not accessible, or&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ssh is rejecting the connection due to a failure to authenticate or authorize&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can find out which type of problem you have by using a command like&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;telnet HOSTNAME 22
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If this connects, then ssh is running and accepting connections on port 22.  (Hit &lt;code&gt;[Enter]&lt;/code&gt; a couple times to disconnect from the &lt;code&gt;telnet&lt;/code&gt; session).  If you don&amp;#8217;t connect, then it&amp;#8217;s important to note if the attempt basically hung forever or if you got a &amp;#8220;Connection refused&amp;#8221; type of message immediately.  (Hit &lt;code&gt;[Ctrl]-[C]&lt;/code&gt; to stop the &lt;code&gt;telnet&lt;/code&gt; command.)&lt;/p&gt;

&lt;p&gt;If the connection attempt hangs, then there might be a problem with the security group, iptables, or your instance might not be running at that IP address.&lt;/p&gt;

&lt;p&gt;If the &lt;code&gt;telnet&lt;/code&gt; connection attempt gets rejected, then there might be a problem with iptables, ssh configuration, ssh not running on the instance, or perhaps it&amp;#8217;s listening on different port if the admin likes to configure things a bit more securely.  The console output can be helpful in determining if sshd was started at boot.&lt;/p&gt;

&lt;p&gt;If you can get connected to the ssh port with telnet, then you need to start debugging why ssh is not letting you in.  The most important information can be gathered by running the ssh connection attempt in verbose (&lt;code&gt;-v&lt;/code&gt;) mode:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ssh -v -i KEYPAIR.pem USERNAME@HOSTNAME
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The complete output of this command can be very helpful to post when asking for help.&lt;/p&gt;

&lt;p&gt;The most common problems with ssh relate to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Forgetting to specify &lt;code&gt;-i KEYPAIR.pem&lt;/code&gt; in the ssh command&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Not starting the instance specifying a keypair&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using a different keypair than the one which was used to start the instance&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Not ssh&amp;#8217;ing with the correct username.  Most EC2 images require a first connection with &lt;code&gt;root@....&lt;/code&gt; but images published by Canonical require a first connection with &lt;code&gt;ubuntu@....&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Not having the correct ownership or mode on the .ssh directory or authorized_keys file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Not having the correct Allow* or *Authentication settings in /etc/ssh/sshd_config&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Apache&lt;/h2&gt;

&lt;p&gt;Web servers are much easier to connect to than other applications because there is generally no authentication and authorization involved to get a basic web page.  If you can&amp;#8217;t reach your web server on EC2, then it&amp;#8217;s generally one of the simple problems described above like using the wrong IP address, trying to reach a terminated instance, or not having the web port opened in the security group.&lt;/p&gt;

&lt;h2&gt;MySQL&lt;/h2&gt;

&lt;p&gt;The most common problem specific to MySQL connectivity on EC2 is the fact that MySQL is configured securely by default to not allow access by remote hosts.  If you need to allow a connection from your other instances running in EC2, then edit &lt;code&gt;/etc/mysql/my.cnf&lt;/code&gt; and replace this line:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;bind-address            = 127.0.0.1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;with &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;bind-address            = 0.0.0.0
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and restart the mysqld server.&lt;/p&gt;

&lt;p&gt;IMPORTANT! You should &lt;em&gt;not&lt;/em&gt; open the MySQL port in the EC2 security group.  You only want your own EC2 instances to connect to the database and the default security group allows your EC2 instances to connect to any port on your other EC2 instances.  If you open up the port to the public, then your database will be attacked by the Internet at large.&lt;/p&gt;

&lt;p&gt;If you need to talk to your MySQL database running on EC2 from a server running outside EC2, then do it over a secure channel like an ssh tunnel or openvpn.  You don&amp;#8217;t need the MySQL port open in the security group to do this.  The MySQL protocol is not by itself encrypted and your usernames and passwords would be sent in the clear for anybody else to intercept if you didn&amp;#8217;t talk over a secure channel.&lt;/p&gt;

&lt;h2&gt;Custom AMIs&lt;/h2&gt;

&lt;p&gt;If you are building your own custom AMIs from scratch, then there are a number of complicated barriers to getting network and ssh connectivity working.  Unfortunately it is nearly impossible to debug these problems since you don&amp;#8217;t have access to the machine to see what went wrong.  Console output is your only friend in these cases.&lt;/p&gt;

&lt;p&gt;Here are some examples of odd things which others in the EC2 community have run into and solved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Make sure you start networking on instance boot.  It should come up with DHCP on eth0.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make sure your Linux distro does not save the MAC address somewhere, preventing the network from functioning in the next instance.  Ubuntu stores this in the /etc/udev/rules.d/70-persistent-net.rules file and Debian stores this in the /etc/udev/rules.d/z25_persistent-net.rules file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make sure your image downloads the ssh keypair and installs it in authorized_keys.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make sure you have the right devices created and file systems mounted.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make sure you&amp;#8217;re using a udev lower than v144 as higher versions are incompatible with Amazon&amp;#8217;s 2.6.21 kernel.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make sure you&amp;#8217;re using the right libc6 and &lt;a href="http://groups.google.com/group/ec2ubuntu/browse_thread/thread/1a3fd33f04766361"&gt;related configurations&lt;/a&gt; including /lib/tls&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Amazon&lt;/h2&gt;

&lt;p&gt;I realize this was your first thought, but it&amp;#8217;s such a rare cause, I&amp;#8217;ve put it here at the end.  Sometimes there are problems with Amazon EC2.  The hardware running your instance may fail or the networks might have temporary glitches. There are a couple different classes of problems here:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Small scale problems local to the hardware running your instance.  Though these are rare for any single instance, they are happening all the time for some customer somewhere given that AWS has hundreds of thousands of customers.  Amazon often sends you an email when they notice that an instance is starting to have problems, and you should move to a new instance as soon as possible.  If the failure happens without the warning, the only solution is to move to a new instance anyway, so you should always be prepared to do this.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Large scale problems which affect a large number of customers simultaneously.  These are very rare, and generally don&amp;#8217;t affect more than a single availability zone given the way that Amazon has spread out the risk in their architecture.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can check the &lt;a href="http://status.aws.amazon.com/"&gt;AWS service health dashboard&lt;/a&gt; to see if Amazon is aware of any widespread problems with the EC2 service.  If there are problems with a specific availability zone, you may want to move your servers to a different availability zone until the issues get resolved.&lt;/p&gt;

&lt;h2&gt;First Responses&lt;/h2&gt;

&lt;p&gt;For general cases where you can&amp;#8217;t immediately figure out what went wrong with the connectivity, here are two things which are almost always recommended on EC2: reboot the instance and replace the instance.&lt;/p&gt;

&lt;p&gt;Reboot your EC2 instance using the &lt;a href="http://ec2console.notlong.com/"&gt;EC2 Console&lt;/a&gt;, another API client, or a command like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    ec2-reboot-instances INSTANCE_ID
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;After giving it sufficient time to come up, see if that fixed the connectivity problem.  Do not reboot your instance if you currently have a working ssh connection to it, but other ssh connections are failing!&lt;/p&gt;

&lt;p&gt;If you have a production service running on Amazon EC2 and you lose connectivity to an instance, then I recommend your first reaction be to kick off a replacement instance so that it boots and configures itself while you investigate the original issue.  If you don&amp;#8217;t solve the problem by the time the replacement is ready, simply switch over to the new server.  You may want to continue investigating what happened with the old server, though I generally don&amp;#8217;t care what the problem was unless it happens more than once or twice in a short time period.&lt;/p&gt;

&lt;p&gt;If your installation environment does not allow you to easily start replacement instances, then you should &lt;a href="http://alestic.com/2009/06/ec2-non-outage"&gt;reconsider how you are using EC2&lt;/a&gt; and work to improve this.&lt;/p&gt;

&lt;h2&gt;Seeking Help&lt;/h2&gt;

&lt;p&gt;If the above did not help you solve your problem reaching your EC2 instance, you may want to reach out to the community including some AWS employees on the &lt;a href="http://ec2forum.notlong.com/"&gt;EC2 forum&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Amazon also has &lt;a href="http://aws.amazon.com/premiumsupport/"&gt;premium AWS support&lt;/a&gt; available.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Requests for connectivity help by posting a comment on this particular thread will not be published or answered.  Please only post a comment if you have corrections or additional information to share for users experiencing problems.  I do occasionally receive and respond to questions posted on other articles, but for this topic, please use the EC2 forum.&lt;/em&gt;&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/-NA2T6J9EJQ" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/08/ec2-connectivity</feedburner:origLink></entry>

<entry>
    <title>runurl - A Tool and Approach for Simplifying user-data Scripts on EC2</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/alestic/~3/wuk-dDFaNSo/runurl" />
    <id>tag:alestic.com,2009://1.56</id>

    <published>2009-08-17T19:42:14Z</published>
    <updated>2009-10-12T13:55:44Z</updated>

    <summary>Many Ubuntu and Debian images for Amazon EC2 include a hook where scripts passed as user-data will be run as root on the first boot. At Campus Explorer, we’ve been experimenting with an approach where the actual user-data is a...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="boot" label="boot" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="ec2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="runurl" label="runurl" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="startup" label="startup" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="userdata" label="user-data" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;Many &lt;a href="http://alestic.com/"&gt;Ubuntu and Debian images for Amazon EC2&lt;/a&gt; include a hook where &lt;a href="http://alestic.com/2009/06/ec2-user-data-scripts"&gt;scripts passed as user-data will be run as root on the first boot&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;At &lt;a href="http://www.campusexplorer.com/"&gt;Campus Explorer&lt;/a&gt;, we&amp;#8217;ve been experimenting with an approach where the actual user-data is a very short script which downloads and runs other scripts.  This idea is not new, but I have simplified the process by creating a small tool named &lt;a href="http://run.alestic.com/runurl"&gt;&lt;code&gt;runurl&lt;/code&gt;&lt;/a&gt; which adds a lot of flexibility and convenience when configuring new servers.&lt;/p&gt;

&lt;h2&gt;Usage&lt;/h2&gt;

&lt;p&gt;The basic synopsis looks like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;runurl URL [ARGS]...
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The first argument to the &lt;code&gt;runurl&lt;/code&gt; command is the URL of a script or program which should be run.  All following options and arguments are passed verbatim to the program as its options and arguments.  The exit code of &lt;code&gt;runurl&lt;/code&gt; is the exit code of the program.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;runurl&lt;/code&gt; command is a very short and simple script, but it makes the user-data startup scripts even shorter and simpler themselves.&lt;/p&gt;

&lt;h2&gt;Example 1&lt;/h2&gt;

&lt;p&gt;If the following content is stored at &lt;a href="http://run.alestic.com/demo/echo"&gt;http://run.alestic.com/demo/echo&lt;/a&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/bash
echo "$@"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;then this command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;runurl run.alestic.com/demo/echo "hello, world"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;will itself output:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;hello, world
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You can specify the &amp;#8220;http://&amp;#8221; in the URLs, but since it&amp;#8217;s using &lt;code&gt;wget&lt;/code&gt; to download them, the specifier is not necessary and the code might be easier to read without it.&lt;/p&gt;

&lt;h2&gt;Example 2&lt;/h2&gt;

&lt;p&gt;Here&amp;#8217;s a more substantial sample user-data script which invokes a number of other remote scripts to upgrade the Ubuntu packages, install the &lt;code&gt;munin&lt;/code&gt; monitoring software, install and run the &lt;a href="http://folding.stanford.edu/"&gt;Folding@Home&lt;/a&gt; application using &lt;a href="https://help.ubuntu.com/community/FoldingAtHome/origami"&gt;&lt;code&gt;origami&lt;/code&gt;&lt;/a&gt; with credit going to &lt;a href="http://folding.extremeoverclocking.com/team_summary.php?s=&amp;amp;t=45104"&gt;Team Ubuntu&lt;/a&gt;.  It finally sends an email back home that it&amp;#8217;s active.  &lt;/p&gt;

&lt;p&gt;&lt;em&gt;This sample assumes that &lt;code&gt;runurl&lt;/code&gt; is installed on the AMI (e.g., Ubuntu AMIs published on http://alestic.com&gt;).  For other AMIs, see below for additional commands to add to the start of the script.&lt;/em&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/bash -ex
runurl run.alestic.com/apt/upgrade
runurl run.alestic.com/install/munin
cd /root
runurl run.alestic.com/install/folding@home -u ec2 -t 45104 -b small
runurl run.alestic.com/email/start youremail@example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note that the last command passes a parameter to the script, identifying where the email should be sent.  Please change this if you test the script.&lt;/p&gt;

&lt;p&gt;With the above content stored in a file named &lt;code&gt;folding.user-data&lt;/code&gt;, you could start 5 new c1.medium instances running the Folding@Home software using the command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-run-instances                    \
  --user-data-file folding.user-data \
  --key [KEYPAIR]                    \
  --instance-type c1.medium          \
  --instance-count 5                 \
  ami-ed46a784
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You can log on to an instance and monitor the installation with&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;tail -f /var/log/syslog
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Once the Folding@Home application is running, you can monitor its progress with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/root/origami/origami status
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and after 15 minutes, check out the Munin system stats at&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;http://ec2-HOSTNAME/munin/
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Expiring URLs&lt;/h2&gt;

&lt;p&gt;One of the problems with normal user-data scripts is that the contents exist as long as the instance is running and any user on the instance can read the contents of the user-data.  This puts any private or confidential information in the user-data at risk.&lt;/p&gt;

&lt;p&gt;If you put your actual startup code in private S3 buckets, you can pass &lt;code&gt;runurl&lt;/code&gt; a URL to the contents, where the URL expires shortly after it is run.  Or, the script could even delete the contents itself if you set it up correctly.  This reduces the exposure to the time it takes for the instance to start up and does not let anybody else access the URL during that time.&lt;/p&gt;

&lt;h2&gt;Updating&lt;/h2&gt;

&lt;p&gt;Another benefit of keeping the actual startup code separate from the user-data content itself is that you can modify the startup code stored at the URL without modifying the user-data content.&lt;/p&gt;

&lt;p&gt;This can be useful with services like EC2 Auto Scaling, where the specified user-data cannot be dynamically changed in a launch configuration without creating a whole new launch configuration.&lt;/p&gt;

&lt;p&gt;If you modify the runurl scripts, the next server to be launched will automatically pick up the new instructions.&lt;/p&gt;

&lt;h2&gt;Bootstrapping&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;runurl&lt;/code&gt; tool is pre-installed in the latest Ubuntu AMIs published on &lt;a href="http://alestic.com"&gt;http://alestic.com&lt;/a&gt;.  If you are using an Ubuntu image which does not include this software, you can install it from the &lt;a href="https://launchpad.net/~alestic/+archive/ppa"&gt;Alestic PPA&lt;/a&gt; using the following commands at the top of your user-data script:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;codename=$(lsb_release -cs)
echo "deb http://ppa.launchpad.net/alestic/ppa/ubuntu $codename main"|
  sudo tee /etc/apt/sources.list.d/alestic-ppa.list    
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BE09C571
sudo apt-get update
sudo apt-get install -y runurl
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you are using a Linux distro other than Ubuntu, you can install &lt;code&gt;runurl&lt;/code&gt; using the following commands at the top of your user-data script:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo wget -qO/usr/bin/runurl run.alestic.com/runurl
sudo chmod 755 /usr/bin/runurl
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The subsequent commands in the user-data script can then use the &lt;code&gt;runurl&lt;/code&gt; command as demonstrated in the above example.&lt;/p&gt;

&lt;h2&gt;SSL&lt;/h2&gt;

&lt;p&gt;To improve your certainty that you are talking to the right server and getting the right data, you could use SSL (&lt;code&gt;https&lt;/code&gt;) in your URLs.  If you are talking to S3 buckets, however, you&amp;#8217;ll need to use the old style S3 bucket access style like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;runurl https://s3.amazonaws.com/run.alestic.com/demo/echo "hello, mars"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This is probably not as critical when accessing it from an EC2 instance as you&amp;#8217;re operating over Amazon&amp;#8217;s trusted network.&lt;/p&gt;

&lt;h2&gt;Caveats&lt;/h2&gt;

&lt;p&gt;There are a number of things which can go wrong when using a tool like &lt;code&gt;runurl&lt;/code&gt;.  Here are some to think about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Only run content which you control or completely trust.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Just because you like the content of a URL when you look at it in your browser does not mean that it will still look like that when your instance goes to run it.  It could change at any point to something that is broken or even malicious unless it is under your control.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you depend on this approach for serious applications, you need to make sure that the content you are downloading is coming from a reliable server.  S3 is reasonable (with retries) but you also need to consider the DNS server if you are depending on a non-AWS hostname to access the S3 bucket.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The name &lt;code&gt;run.alestic.com&lt;/code&gt; points to an S3 bucket, but the DNS for this name is not redundant or worthy of use by applications with serious uptime requirements.  This particular service should be considered my playground for ideas and there is no commitment on my part to make sure that it is up or that the content remains stable.&lt;/p&gt;

&lt;p&gt;If you like what you see, please feel free to copy any of the open source content on run.alestic.com and store it on your own reliable and trusted servers.  It is all published under the Apache2 license.&lt;/p&gt;

&lt;h2&gt;Project&lt;/h2&gt;

&lt;p&gt;I&amp;#8217;m using this simple script as an opportunity to come up to speed with hosting projects on Launchpad.  You can access the source code and submit bugs at&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="https://launchpad.net/runurl"&gt;https://launchpad.net/runurl&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can also use launchpad and bazaar to branch the source into parallel projects and/or submit requests to merge patches into the main development branch.&lt;/p&gt;

&lt;p&gt;[Update 2009-10-11: Document use of &lt;a href="https://launchpad.net/~alestic/+archive/ppa"&gt;Alestic PPA&lt;/a&gt;]&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/wuk-dDFaNSo" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/08/runurl</feedburner:origLink></entry>

<entry>
    <title>Presentation: Building Custom Linux Images for Amazon EC2</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/alestic/~3/Zy1J5Vx55Sg/ec2-talk" />
    <id>tag:alestic.com,2009://1.53</id>

    <published>2009-08-10T22:06:25Z</published>
    <updated>2009-08-10T21:06:17Z</updated>

    <summary>At the end of July, I gave a presentation at O’Reilly’s Open Source Convention (OSCON 2009) in San Jose. The slides from the presentation have been made available on the OSCON web site in ODP and PDF formats (look for...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="2009" label="2009" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="amis" label="AMIs" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="california" label="California" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="linux" label="Linux" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="losangeles" label="LosAngeles" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="oscon" label="OSCON" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="presentations" label="presentations" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="talks" label="talks" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="uuasc" label="UUASC" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;At the end of July, I gave a presentation at O&amp;#8217;Reilly&amp;#8217;s Open Source Convention (&lt;a href="http://en.oreilly.com/oscon2009"&gt;OSCON 2009&lt;/a&gt;) in San Jose.  The slides from the presentation have been made available on the OSCON web site in ODP and PDF formats (look for links towards the top of the page):&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://oscon2009talk.notlong.com/"&gt;Building Custom Linux Images for Amazon EC2&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Bonus&lt;/strong&gt;: For folks who live around Los Angeles (or who want to fly in?), I will be giving an extended version of this talk at the UUASC-LA (&lt;a href="http://bolthole.com/uuala/"&gt;Unix Users Association of Southern California, Los Angeles Chapter&lt;/a&gt;) meeting on Thursday, September 3, 2009.  The presentation is free and open to all.  Please read the directions and instructions on the UUASC web site carefully.&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/Zy1J5Vx55Sg" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/08/ec2-talk</feedburner:origLink></entry>

<entry>
    <title>New Releases of Ubuntu and Debian Images for Amazon EC2 (Tools, Security)</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/alestic/~3/vaNHF5nfgHs/ec2-ubuntu-ami-release-security" />
    <id>tag:alestic.com,2009://1.55</id>

    <published>2009-08-04T20:49:33Z</published>
    <updated>2009-08-05T19:54:09Z</updated>

    <summary>New updates have been released for the Ubuntu and Debian AMIs (EC2 images) published on: http://alestic.com The following notes apply to this release: The EC2 AMI tools have been upgraded to version 1.3-34544. Note that an “apt-get upgrade” will downgrade...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="910" label="9.10" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ami" label="AMI" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="amis" label="AMIs" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="image" label="image" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="images" label="images" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="release" label="release" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="security" label="security" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ssh" label="ssh" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="tools" label="tools" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;New updates have been released for the Ubuntu and Debian AMIs (EC2
images) published on:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://alestic.com"&gt;http://alestic.com&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The following notes apply to this release:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The EC2 AMI tools have been upgraded to version 1.3-34544.  Note
that an &amp;#8220;apt-get upgrade&amp;#8221; will &lt;em&gt;downgrade&lt;/em&gt; the EC2 AMI tools because
the versions of the ec2-ami-tools package currently in the Ubuntu
Hardy, Intrepid, Jaunty archives are outdated.  If you have an easy
solution to this, please let us know.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The ssh host key regeneration has been moved to run after the RNG is
seeded.  This improves security, especially for folks who are
verifying the ssh host key on the first connect by comparing the
fingerprint to the value in the instance console output.  Thanks to
Andrew Becherer for suggesting this improvement.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Ubuntu Karmic Alpha images were not updated.  Due to a new
kernel requirement, Karmic will no longer run on Amazon&amp;#8217;s 2.6.21
kernel.  Once Canonical releases an Ubuntu kernel with the
appropriate features, the Karmic series may be resumed.  Running
&amp;#8220;apt-get upgrade&amp;#8221; on an existing Karmic AMI will cause it to be
inaccessible after rebooting.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Debian Etch desktop images were not updated because apparently
LaTeX refuses to build a format from a source file which is more
than five years old.  If there is anybody who wants Etch desktops
and is willing to investigate, please contact me, otherwise I plan
to discontinue support for this series.  If you&amp;#8217;re using Debian,
I&amp;#8217;d encourage you to upgrade to Lenny &amp;#8220;stable&amp;#8221; anyway.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Please give these new images a spin and let us know if you run into any problems.&lt;/p&gt;

&lt;p&gt;Enjoy&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/vaNHF5nfgHs" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/08/ec2-ubuntu-ami-release-security</feedburner:origLink></entry>

<entry>
    <title>Poll: Verifying ssh Fingerprint on EC2 Instances</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/alestic/~3/tXlBTHSmmBs/ec2-poll-fingerprint" />
    <id>tag:alestic.com,2009://1.54</id>

    <published>2009-08-04T13:18:56Z</published>
    <updated>2009-08-04T12:18:15Z</updated>

    <summary>When you ssh to a new EC2 instance, you are presented with the challenge: The authenticity of host 'XXX' can't be established. RSA key fingerprint is YYY. Are you sure you want to continue connecting (yes/no)? For optimal security, you...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="fingerprint" label="fingerprint" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="polls" label="polls" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="security" label="security" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ssh" label="ssh" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;When you ssh to a new EC2 instance, you are presented with the challenge:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;The authenticity of host 'XXX' can't be established.
RSA key fingerprint is YYY.
Are you sure you want to continue connecting (yes/no)?
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;For optimal security, you are supposed to request the instance console output and find the ssh host key fingerprint in the log to verify that it is the same as the fingerprint presented to you by the ssh command.&lt;/p&gt;

&lt;div class="TWIIGSPOLL"&gt; &lt;script type="text/javascript" src="http://www.twiigs.com/poll.js?pid=36713&amp;color=reddark"&gt;&lt;/script&gt; &lt;div class="TWIIGSPOLLpolllink" style="background-color: transparent; background-image: none; border-style: none; clear: none; display: block; float: none; position: static; visibility: visible; height: auto; line-height: normal; width: auto; margin-top: 10px; margin-right: 0; margin-bottom: 0; margin-left: 0; outline-style: none; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; clip: auto; overflow: hidden; vertical-align: baseline; z-index: auto; letter-spacing: normal; text-align: right; text-decoration: none; text-indent: 0; text-shadow: none; text-transform: none; white-space: normal; word-spacing: normal;"&gt; &lt;a class="TWIIGSPOLLmorelink" href="http://www.twiigs.com/" style="background-color: transparent; background-image: none; border-style: none; clear: none; display: inline; float: none; position: static; visibility: visible; height: auto; line-height: normal; width: auto; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; outline-style: none; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; clip: auto; overflow: hidden; vertical-align: baseline; z-index: auto; letter-spacing: normal; text-align: left; text-indent: 0; text-shadow: none; text-transform: none; white-space: normal; word-spacing: normal; font-weight: bold;"&gt;poll by twiigs.com&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; 

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/tXlBTHSmmBs" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/08/ec2-poll-fingerprint</feedburner:origLink></entry>

<entry>
    <title>EBS Snapshots of a MySQL Slave Database on EC2</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/alestic/~3/7giIX2tNhX0/ec2-mysql-slave-snapshot" />
    <id>tag:alestic.com,2009://1.51</id>

    <published>2009-08-03T19:56:17Z</published>
    <updated>2009-08-07T02:10:56Z</updated>

    <summary>At our company, CampusExplorer.com, we regularly snapshot the EBS volume which holds our MySQL database using the basic procedure I outlined in the article “Running MySQL on Amazon EC2 with Elastic Block Store”, though the snapshot code has been significantly...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="campusexplorer" label="CampusExplorer" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="databases" label="databases" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ebs" label="EBS" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="master" label="master" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="mysql" label="MySQL" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="replication" label="replication" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="slave" label="slave" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="snapshots" label="snapshots" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;At our company, &lt;a href="http://www.campusexplorer.com/"&gt;CampusExplorer.com&lt;/a&gt;, we regularly snapshot the EBS volume which holds our MySQL database using the basic procedure I outlined in the article  &amp;#8220;&lt;a href="http://ec2ebs-mysql.notlong.com/"&gt;Running MySQL on Amazon EC2 with Elastic Block Store&lt;/a&gt;&amp;#8221;, though the snapshot code has been significantly improved through our experience in the last year.&lt;/p&gt;

&lt;p&gt;As others have reported, we also found that the background EBS snapshot process on EC2 increased IO wait on the source EBS volume holding the production database, which had a negative impact on the performance of the production web site itself.  So, we moved the frequent snapshot process to a slave database which is always completely up to date with the production master database.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;em&gt;Aside: Having complete backups is not the only reason to do EBS snapshots.  They also increase the reliability and failsafe-ness of the EBS volume itself, so we still run occasional snapshots on the production database, just during off-peak hours.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Steve Caldwell (chief tech at CampusExplorer.com) has automated some great push button EC2 system launches and configurations including EBS database volumes created from snapshots, attached, mounted, etc.  This is convenient to do things like setting up a temporary development system for a contractor, starting a staging environment for QA, or running some database intensive reports on near-production data.&lt;/p&gt;

&lt;h2&gt;skip-slave-start&lt;/h2&gt;

&lt;p&gt;When EBS volumes were created from the snapshots of the slave database, Steve found that as soon as the MySQL server came up, it started replication from the master thinking it was a slave database.  In some cases this is fine, but in others we want to see the database in exactly the state it was in at the time of the snapshot.  We tried running &amp;#8220;STOP SLAVE&amp;#8221; just before creating the snapshot, but replication still resumed when the server started.  &lt;/p&gt;

&lt;p&gt;We finally found the solution in the option &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/replication-options-slave.html#option_mysqld_skip-slave-start"&gt;&amp;#8212;skip-slave-start&lt;/a&gt; which tells MySQL to not start the replication process when the server comes up.&lt;/p&gt;

&lt;p&gt;I haven&amp;#8217;t looked into how to pass options to mysqld when running /etc/init.d/mysql so we settled on adding this line to the &lt;code&gt;[mysqld]&lt;/code&gt; section of &lt;code&gt;/etc/mysql/my.cnf&lt;/code&gt; by default on our non-slave servers:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;skip-slave-start
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;On a system which we know should start as a slave, we omit this directive.  On a system we want to turn into a slave, we simply run &amp;#8220;START SLAVE&amp;#8221; and remove this line for future restarts.  If the binary logs available on the master go back to the point where the snapshot was created, then replication begins and it eventually catches up to the present.&lt;/p&gt;

&lt;p&gt;[Update 2009-08-06: Clarify skip-start-slave meaning]&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/7giIX2tNhX0" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/08/ec2-mysql-slave-snapshot</feedburner:origLink></entry>

<entry>
    <title>Matching EC2 Availability Zones Across AWS Accounts</title>
    <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/alestic/~3/JDtVYmEdh24/ec2-availability-zones" />
    <id>tag:alestic.com,2009://1.48</id>

    <published>2009-07-28T22:13:23Z</published>
    <updated>2009-07-29T19:25:55Z</updated>

    <summary>Summary: EC2 availability zone names in different accounts do not match to the same underlying physical infrastructure. This article explains a trick which can be used to figure out how to match availability zone names between different accounts. Background As...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="availabilityzones" label="availability zones" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="aws" label="AWS" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="reservedinstances" label="reserved instances" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;&lt;em&gt;Summary&lt;/em&gt;: EC2 availability zone names in different accounts do not match to the same underlying physical infrastructure.  This article explains a trick which can be used to figure out how to match availability zone names between different accounts.&lt;/p&gt;

&lt;h2&gt;Background&lt;/h2&gt;

&lt;p&gt;As of the writing of this article, Amazon EC2 (Elastic Compute Cloud) has six different availability zones in two regions.  A region can be thought of as a specific area of the world. An availability zone can be thought of roughly as a data center, defined such that no single failure scenario should affect two availability zones.&lt;/p&gt;

&lt;p&gt;The current regions are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;us-east-1&lt;/code&gt; - East coast of the United States (probably near Washington, DC)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;eu-west-1&lt;/code&gt; - Western Europe (probably near Dublin, Ireland)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The availability zones in those regions are given the region name plus simple letters appended:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;us-east-1a&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;us-east-1b&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;us-east-1c&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;us-east-1d&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;eu-west-1a&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;eu-west-1b&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you start EC2 instances, you can specify an availability zone or let Amazon pick one for you.  You always have a default region which can be overridden when starting instances.&lt;/p&gt;

&lt;h2&gt;Balancing&lt;/h2&gt;

&lt;p&gt;In order to prevent an overloading of a single availability zone when everybody tries to run their instances in &lt;code&gt;us-east-1a&lt;/code&gt;, Amazon has added a layer of indirection so that each account&amp;#8217;s availability zones can map to different physical data center equivalents.&lt;/p&gt;

&lt;p&gt;For example, zone &lt;code&gt;us-east-1a&lt;/code&gt; in your account might be the same as zone &lt;code&gt;us-east-1c&lt;/code&gt; in my account and &lt;code&gt;us-east-1d&lt;/code&gt; in a third person&amp;#8217;s account.&lt;/p&gt;

&lt;p&gt;In fact, given the way that Amazon has set this up, I would not be surprised if Amazon may not occasionally reassign availability zone names which you are not currently using.  For example, Amazon recently added the fourth availability zone in the &lt;code&gt;us-east-1&lt;/code&gt; region, but I suspect this might not be &lt;code&gt;us-east-1d&lt;/code&gt; in all accounts (especially new ones).&lt;/p&gt;

&lt;h2&gt;Identification&lt;/h2&gt;

&lt;p&gt;On occasion, users sometimes want to know if instances in different accounts are running in the same availability zone.  Or, users might want to know which availability zone is the one with which people are currently experiencing a particular problem.&lt;/p&gt;

&lt;p&gt;You&amp;#8217;ll often see users say that there is a problem in zone &lt;code&gt;us-east-1a&lt;/code&gt; but this isn&amp;#8217;t very helpful for other users because (as described above) that name only has significance within the original user&amp;#8217;s account.&lt;/p&gt;

&lt;p&gt;What would be helpful is a unique identifier which maps to the underlying physical infrastructure (e.g., data center) and can be mapped to the different availability zone names in each account.&lt;/p&gt;

&lt;p&gt;I believe that Amazon may have inadvertently let slip a way to obtain this in the current implementation of the reserved instance offering ids.  In my experiments so far, these seem to be tied to something outside of the account&amp;#8217;s availability zones and, though the ids are the same, they are mapped to different availability zone names for different accounts.&lt;/p&gt;

&lt;p&gt;To demonstrate this I&amp;#8217;ve arbitrarily chosen the reserved instance offerings for m1.small, one year, Linux.&lt;/p&gt;

&lt;p&gt;To list the mappings for a single account, you can use a command like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-describe-regions | cut -f2 | while read region; do 
  ec2-describe-reserved-instances-offerings --region $region | 
    perl -ne 'print "$2 $1\n" if 
      m%\S+\t(\S+)\t(\S+)\tm1.small\t1y.\t.*\tLinux%'; 
done | sort
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Examples&lt;/h2&gt;

&lt;p&gt;Here are the mappings for one of my accounts (let&amp;#8217;s call it &amp;#8220;Blue&amp;#8221;):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;eu-west-1a 649fd0c8-75d4-4e16-88c7-1ddb83f66062
eu-west-1b 438012d3-0440-480a-9f5c-eb7e55dd5a37
us-east-1a 4b2293b4-1e6c-4eb3-ab74-4493c0e57987
us-east-1b 60dcfab3-a56c-4092-8c90-3677e9da02b7
us-east-1c c48ab04c-c057-457e-a4d8-a0f172f4db2d
us-east-1d c48ab04c-7e96-4ea8-9579-d62194490546
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here are the mappings for a different account (let&amp;#8217;s call it &amp;#8220;Red&amp;#8221;):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;eu-west-1a 438012d3-0440-480a-9f5c-eb7e55dd5a37
eu-west-1b 649fd0c8-75d4-4e16-88c7-1ddb83f66062
us-east-1a c48ab04c-c057-457e-a4d8-a0f172f4db2d
us-east-1b 4b2293b4-1e6c-4eb3-ab74-4493c0e57987
us-east-1c 60dcfab3-a56c-4092-8c90-3677e9da02b7
us-east-1d c48ab04c-7e96-4ea8-9579-d62194490546
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;From this, I theorize that availability zone &lt;code&gt;us-east-1a&lt;/code&gt; in account Blue is the same as availability zone &lt;code&gt;us-east-1b&lt;/code&gt; in account Red, but availability zones &lt;code&gt;us-east-1d&lt;/code&gt; happen to be the same in both accounts.&lt;/p&gt;

&lt;h2&gt;Caveats&lt;/h2&gt;

&lt;p&gt;Please note that this approach is not a documented feature of Amazon EC2.  I may be misinterpreting what I am seeing and the mappings may be completely random for different accounts.&lt;/p&gt;

&lt;p&gt;Amazon could at any time restructure how these values work so that the described offering ids cannot be used between accounts or do not map to any common infrastructure.&lt;/p&gt;

&lt;p&gt;Use at your own risk and please post a comment if you find out any further data to support or disprove this theory.&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/JDtVYmEdh24" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/07/ec2-availability-zones</feedburner:origLink></entry>

</feed>
