2006/08/24
Playing with Amazon EC2
Another announce in the Amazon "WebServices" portfolio: Elastic Compute Cloud (EC2 for short) is a highly adaptable hosting environment.
I signed up for the beta, here is some notes from my (short) experience with EC2.
Don't let the first paragraph on their web page fool you: when amazon says that it's a "web service that provides resizable compute capacity in the cloud", what they actually mean is that you use or provide a disk image for your server, choose how many instances of this image you want to run, and there's no step three. Don't worry about the web service part, you can run everything through Java command-line tools, and the command-line tools are just for the administration of your instances, and not related to what's running on the instances themselves.
Pricing is interesting: $0.10 per instance-hour consumed (about $73 a month for an always-on server), and bandwidth cost is similar to the S3 services ($0.20 per GB). Customized images are stored on S3 ($0.15 per GB-Month).
After setup (certificate generation, instance creation), you get access to a Xen-based, virtualized machine. According to Amazon, "each instance predictably provides the equivalent of a system with a 1.7Ghz Xeon CPU, 1.75GB of RAM, 160GB of local disk, and 250Mb/s of network bandwidth. I did some quick micro-benchmarks. Upload and download bandwidth seems to be in line with what I observed with S3, and the machine itself feel fast, which seems corroborated with various small tests.
You then just have to open the ports you need (let's say ssh and http), and log in to your new server. Yes, you're root, and you can install whatever you want (refer to the agreement for details).
Caveats: EC2 "adaptable hosting environment" is highly dynamic, you get a lot of freedom and reactivity when deploying your instances, but it comes with constraints that are not usual in "classic" hosting environments. First, your instance is allocated dynamically when you request it, and your image will be assigned an IP. Also, you can't use your own kernel (Xen is probably the blocker here). Then, you should now think about your instance as a new machine: when you're starting a new machine, it's allocated and ready to run, but when you're terminating the instance, you're not just "shutting down" the machine, you're scrapping your machine: all your data store locally on the instance are lost. It is your responsibility to backup to S3 or to another instance.
Other interesting features: you can define security "groups", which are collections of access rules which control traffic to your instances (i.e. only accept connections from members on the group, only open port 80, only accept ssh access from a specific subnet). Groups can then be applied when launching a new instance. Building a custom image
This is a really interesting move from Amazon, and an interesting new piece in the puzzle, with web frameworks and resources going more and more the stateless/replicated road. Having a hosting infrastructure where allocating a new resource can be done in five minutes is big plus ... if the application has been designed in a way that it can take advantage easily of the new resource.
I'm toying with the idea of developing a small "EC2 Console" application. Too bad the REST API is not yet available.