I floated a site into the cloud, and it didn't rain down in chunks...

My baby steps migration

Free... as in free beer?

Using the installed features in Eclipse I created a "New AWS Java Web Project" from the pull-down menu next to the new AWS icon, with the aim of making a very simple custom app.


However, when invited to "Run as ... Run on Server" I could not find that menu option, so decided that I probably had to upgrade from my 'normal' Eclipse to the heavyweight JEE version (and another 200MB download) as AWS recommends! (I'd seen errors in Eclipse indicating that I should get the JEE version too.)

I afterwards discovered that the "Run on Server" option doesn't apply to the bare project (somewhat annoying), only to their sample "TravelLog" site. Still, upgrading to the full-fat (but still free) Eclipse did no harm...

Having worked that out and followed the video's instructions, I had the TravelLog site up and running in the cloud in a few more minutes. At the risk of being written off as an AWS fanboi, that was pretty smooth!

I was pretty excited that I had something running in the cloud in a few hours from scratch and I hadn't spent any money yet.

I still wanted to make my own non-static (Java/JSP based) trivial site, and as I couldn't get the sample AWS minimal site working, I instead stripped down the TravelLog, basically to show "Hello World" and the Java time in milliseconds.


The simple site has the following code for its top-level index.jsp ("welcome") file which is sort of minimally correct though in practice all but the line containing "Hello world again" could probably safely be omitted:

<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> <% if (request.getMethod().equals("HEAD")) return; %> <!DOCTYPE html>

Hello world again @ <%= java.lang.System.currentTimeMillis() %>!

for which output on one page load was:

Hello world again @ 1299270813546!

with the number rising on each page refresh in Eclipse or from the browser.

There are still about a dozen configuration files, and the "magic" that bundles my index.jsp into a WAR file for deployment to AWS is hidden from me which I don't like: I want to see the cogs turning, and I don't yet have a fixed friendly URL for the server that I could point an incoming user at (eg via an CNAME alias in DNS). But even this basic service has up to four instances behind a load balancer auto-started as necessary which is very grown-up.

Also, as of March 2011 the Elastic Beanstalk service is only available in the US (where I already have a dedicated machine) but I'm happy to deploy in the US for now for testing. Singapore is likely to be available soon, and AWS service there might replace (say) my Mumbai/Bombay server.

Note that a quiet site running on one server instance can stay entirely within the "free tier" while the AWS offer lasts, and subsequently, according to an AWS-supplied calculation, might cost of the order of US$40 per month, which would be much cheaper than my current dedicated AsiaPac hosts. (Though I did seem inexplicably to have run up a bill of a whole 3 cents while mucking around.)

In general, this is the sort of area where virtualisation and the cloud can reduce total cost of ownership, and where hardware resources are not heavily utilised. Thus transparent sharing with other services will save you money (and energy).

Functionality, storage and delivery

The next step would be to build a WAR file of my own similar in functionality to the trivial one in this "magic" Eclipse project, and learn how to deploy it manually to a stable externally visible aliased URL (or IP address) so that it would be seen as being "my" site transparently to an end user, and so that I don't have to turn my current build process upside-down or tie myself too closely to AWS ...

I should also deal with storage; the mirrors of my site are mainly caches for the large dataset that they front – and a naive implementation would probably lose that cache each time a server was redeployed – so I should consider using the S3 Storage Service or the CloudFront content delivery network (CDN) to do some of the heavy lifting.

I must also find out what I was charged the princely sum of USD0.03, when I had thought I would be entirely in the free tier, and how to permanently remove my trial server from AWS when done (after repeated attempts to kill it, it just kept coming back).

And I really need to find an auto-cutoff so that if I'm running up a huge bill unawares then I get sent a warning or two and eventually the service just gets taken down: my site isn't important enough for me to bankrupt myself if something goes wrong. ®

Sponsored: Today’s most dangerous security threats