Archive for the ‘EC2’ Category

Fedora 9 on EC2

Thursday, June 5th, 2008

Until Amazon release a Fedora 9 AMI for EC2, you have three choices as far as getting a Fedora 9 instance goes:

  1. Build yourself one from scratch
  2. Fine one that somebody else has built and made available to the public
  3. Upgrade one of the existing Amazon Fedora 8 images

Maybe building an AMI from scratch is a bit more effort than you were hoping to expend today? And perhaps using an untrusted 3rd party AMI will leave you feeling a little uneasy about your security?

Assuming you trust Amazon to some extent (and if you don’t, perhaps EC2 isn’t your best bet), how do you go about upgrading a Fedora 8 image?

Thankfully, the answer is fairly simple. First, boot a suitable Fedora 8 image, then follow the instructions kindly provided by Carson McDonald on ioncannon.net - which, incidentally, is an invaluable resource for Fedora upgrades of all kinds. Before you know it, you’ll be up-and-running with Fedora 9 on EC2!

Update: the above works fine with a 32-bit AMI. If working with a 64-bit AMI, you’ll need to run the following before using rpm to install the new release:

rpm -e --nodeps curl.x86_64 curl.i386

Babble On EC2

Sunday, June 1st, 2008

Babble On is now running on a single Amazon EC2 ’small’ instance, along with all my other websites. It’s taken a couple of weeks to get it right, but it’s been very interesting working out how to get the best from EC2.

Since EC2 was originally launched, there have been several obstacles in the way of using it for traditional web hosting and as a replacement for a shared server or virtual private server (VPS). For my purposes, there were always three main issues putting me off getting up and moving from my comfy VPS:

  • Lack of static IP address
  • Lack of persistent file system storage
  • Uncertainty as to whether emails sent from the server will be flagged as spam

Elastic IPs, which have now been around for a few months, completely solve the problem of not having a static IP address. Having been an avid follower of the latest AWS developments, it was the announcement of Elastic IPs in particular that started me thinking about moving my hosting to EC2.

For my purposes, I don’t really see persistence as an issue. As long as you can live with a minor amount of data loss (which I can as none of my sites are critical) then regular backups to S3 are painless and cheap and go a long way to mitigating any problems. If it really bothers you then hang on a few months for Amazon’s new persistent storage volumes, which are probably exactly what you are looking for.

Emails I have discussed previously. For now, I will observe with keen interest.

On the whole the move has been a very positive and interesting experience. I now get 1.7 GB RAM as opposed to 512 MB for only 2/3 the price. And the persistence ‘issue’ really forced me to get my backup/restore solution working as well as it could. Backups are kicked-off automatically by cron and dumped on S3 - and my restore script provides a fully automated means of transforming any instance of my AMI into a running clone of the original machine - right down to the point where the services get switched on and started up.

The best thing about EC2 is that upgrading my web server becomes trivial, risk-free and inexpensive. I just fire up another AMI instance, run my restore script and within ten minutes I have an identical server to work on - without any danger of bringing down my live sites or interfering with my live environment at all. Should I then want to replace the original server, it’s just a case of re-assigning the Elastic IP and within two minutes the new system is live. Who said that EC2 wasn’t suitable for traditional web hosting? Perhaps it’s time to stop thinking about things the traditional way.

Email with EC2

Sunday, May 25th, 2008

A quick search of the web reveals that Amazon’s EC2 is perhaps not a great choice for a host when it comes to sending emails. Workarounds exist - using a 3rd party forwarding service, for example (see Paul Dowman’s blog for a good discussion) - but what do you do if you have to send emails from your EC2 instances? What can you do to give your email the best chance of getting delivered?

Here are some ideas that should help things a little:

  • Make use of Elastic IPs: assign a static IP address to your instance.
  • Check that your IP address is not blacklisted (a quick Google search reveals several tools).
  • Assign a hostname to the server that matches an actual DNS record that’s pointing at it. The default EC2 hostnames have embedded IP addresses that spam-prevention systems may be wary of. Actually, it’s probably worth adding the hostname to /etc/hosts too (use the private IP for this), and on Fedora at least, you probably want to set the hostname in /etc/sysconfig/network so that it persists across reboots.
  • Make sure you are sending emails with a From: address matching the domain in question, or any domain that actually has records pointing at the machine if you are hosting multiple.
  • Create an SPF record for your domain that authorizes your EC2 instance to send email.
  • If necessary, be sure to tell your MTA to trust the applications you are using to send email - e.g. mongrel and apache. With sendmail you can do this by adding the users that these applications run as to the file /etc/mail/trusted-users and restarting the service. Not doing this can result in the MTA leaving warnings in your mail headers.
  • Finally, use some decent content in the email - the less your email looks like spam, the more chance there is of it getting past (say) a Bayesian filter.

Please respond if you have any feedback or further tips when it comes to emailing from EC2.

Elasticfox

Saturday, May 17th, 2008

Anyone interested in working with Amazon EC2 should definitely consider the Elasticfox extension for Firefox. It makes the whole thing a breeze and infinitely more accessible than working with the command-line tools.

The only immediate problem with it is the lack of documentation. Thankfully, some helpful users have gone a long way to addressing this by contributing their own instructions.

It’s also worth noting that the EC2 Getting Started Guide still makes reasonable sense when using Elasticfox rather than the command-line tools.