BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Hosting a Web Site on Amazon's EC2

Hosting a Web Site on Amazon's EC2

This item in japanese

Based on Cambridge University's Xen Virtualization, Amazon's Elastic Computer Cloud ("EC2"), is a computing service which allows users to create, launch and terminate Linux based server instances on demand. Each virtual machine instance is a virtual private server assigned an IP address via DHCP on start-up. Virtual Machine images, which Amazon calls Amazon Machine Images (AMIs), can be archived and transported much like VMware's virtual appliances, so a developer can set-up an initial instance of the required software and rapidly deploy it to a number of virtual servers.

A previous InfoQ article looked at the appeal of the service for development teams, such as Oracle's Coherance team, who need large amounts of computing power for short periods of time. The flexibility of the service also makes it attractive to web based start-ups: You have no up-front costs since you don't need to buy expensive hardware, the running costs are generally quite low, and you can install any software you want on your Linux instances. The service can also be readily adapted to changing traffic patterns by starting and stopping additional instances as required. Finally the service is backed by a well known name in Amazon who have a track record of delivering a highly scalable, robust web infrastructure. That said, the lack of any SLA (Service Level Agreement) constitutes a significant barrier to adoption, with some businesses reluctant to entrust data or critical services to it.

There are also practical problems to overcome. For example the DHCP nature of the virtual servers means that the IP address changes each time the server is started. A consequence of this is that, following an outage, a web site would need to update its DNS entries - a process which can take up to ninety-six hours to complete. To work around this Amazon recommends using a dynamic DNS solution such as DynDNS, and in a recent blog article Codesta's Oliver Chan provides details on how to set up DynDNS for EC2.

The same blog provides some other useful hints for developers considering the EC2 service:

  1. "Before spending too much time configuring and customizing an AMI, find one that suits your needs from the start so you won't have to redo any work later on down the road. Check out the list of public AMIs in Amazon’s resource center for something that is more suitable for your needs"
  2. "When packaging up your own image using the ‘ec2-bundle-vol’ command, make sure you specify a clean folder using the '–d' flag otherwise bundling the same image twice will result in an error due to the conflicting sets of temporary files."
  3. "When working with your image, note that the main drive/partition (where the system files are) has a very limited capacity (10 GB in our case). So when dealing with large files/directories use ‘/mnt’ as it has over 100 GB."
  4. "If a machine is terminated, all your data will be lost except for what was backed up from the last time you ran an 'ec2-bundle-vol'"

As EC2 continues to gain momentum open source toools and libraries are emerging to make the life of developers using the service even easier. One such project, building on Chris Richardson's EC2Deploy, is Cloud Tools which comprises:

  • The EC2Deploy framework - a Groovy-based framework for deploying Java EE applications to Amazon EC2.
  • AMI's that are configured to run Tomcat and work with EC2Deploy.
  • A Maven plugin that uses EC2Deploy to deploy a web application to EC2.

Cloud Tools is still very much under development but it provides a means for developers to get up and running on EC2 in a matter of minutes.

Rate this Article

Adoption
Style

BT