Any technology which is distinguishable from magic is insufficiently advanced.

I wandered lonely as a cloud

Posted: February 19th, 2011 | Author: | Filed under: Tutorials | No Comments »

I wandered lonely as a cloud
That floats on high o’er vales and hills,
When all at once I saw a crowd,
A host, of golden daffodils;
Beside the lake, beneath the trees,
Fluttering and dancing in the breeze.

Continuous as the stars that shine
And twinkle on the milky way,
They stretched in never-ending line
Along the margin of a bay:
Ten thousand saw I at a glance,
Tossing their heads in sprightly dance.

The waves beside them danced, but they
Out-did the sparkling leaves in glee;
A poet could not be but gay,
In such a jocund company!
I gazed—and gazed—but little thought
What wealth the show to me had brought:

For oft, when on my couch I lie
In vacant or in pensive mood,
They flash upon that inward eye
Which is the bliss of solitude;
And then my heart with pleasure fills,
And dances with the daffodils.

– Willam Wordsworth

Put it on the cloud!  The not-so-latest trend of web-hosting has finally caught up to me.  Today, however, we’re going to take a quick overview of Amazon’s Web Services (AWS) so that we can dream of the possibilities it may bring to our own development projects.  AWS is, in fact, quite well used by some of the larger casual game developers like Zynga to manage their large user base.

Amazon provides its services not as one, but rather several packages. This can be is daunting to a first-time user.  However, upon closer inspection, we don’t really need to know about all the nitty gritty details. Once you activate one service, all the other dependencies are automatically bundled in, saving you from the headache.

Computing Power

This is the primary service we are concerned about, Amazon Elastic Compute Cloud (EC2). Amazon has a large number of servers that can provide a tremendous amount of computing power. What EC2 does is create a virtual machine instance on this server farm, on which you can basically run whatever it is you want. You get billed on the amount of CPU time you consume. So the more intensive your tasks, the more you pay.

EC2 instances can easily be set up via a web-based control panel called the AWS Mangement Console.  There are a variety of different types of instances that you can create, depending on your expected computing load, ranging from micro to large. You can create as many instances as you want to, as long as you have the $$$ to back it up. Amazon provides a set of images that you can have pre-installed on the newly created instance. It boils down to a choice between Amazon’s version of Linux, Suse, and various flavors of Windows. I went with Amazon Linux, since that was free and I’m cheap.

When I created the instance, it was up within about 30 seconds, with a bare bones OS install.  It handily creates an ssh key-pair for you, so you can readily ssh into your new instance via Amazon’s public DNS server.  Adding packages was easy as you simply use yum. Unlike setting up your own Linux environment, installing packages is pretty fast since they are all hosted on the same server farm. I just installed gcc and did the obligatory “Hello World”. Yup, it works!

You can assign up to 5 elastic IPs to your instances. By elastic IPs, we mean public IPv4 addresses. These come free of charge, and will stay constant as long as your instance is up and running. However, if you have an elastic IP attached to a stopped instance for more than an hour, they start charging you for it. Kind of like how those buffet steamboat places used to charge you for whatever leftover food you have. It discourages waste. Amazon does not provide domain name services, so you will need an external provider if you want a fancy non-numeric URL.

Once you have server configured, you can in theory, save the configuration as an image or AMI. This allows you to then spawn multiple instances with the same configuration if load gets a bit high.

Data Storage

Your EC2 instances come with some space for you they call ephemeral storage. What that rather long word means is that once that instance is shut down, all the data on that instance is gone. The purpose of that storage is more for run-time operation rather than long term operation.

What you can do is use something called Elastic Block Store (yes, they really like the word “Elastic”) or EBS. This is simply storage space. Each EBS can be attached to your instance and mounted as a volume, providing you with persistent storage. What’s more, you can image your data and create multiple snapshots for use as backup, or for other instances to serve up data. Via Amazon’s Simple Storage Service (S3), this data can be transmitted between Amazon’s four data centers (2 in the US, 1 in Europe, 1 in Singapore).

Load Balancing

Amazon provides load balancing via… you guessed it – Elastic Load Balancing. Unfortunately for us game developers, it does not automagically load-balance your homebrew MMO. It is instead, more catered for web servers. So if you are writing a PHP-based MMO, more power to you! If not, you will have to architect your load-balancing mechanism by yourself. What this means is that your server code will need to be written atomically enough so that multiple instances of your code can be run concurrently on different virtual machines. In addition, you will need to write load balancing gateways that dole out incoming traffic to the free servers.

To aid you a bit, Amazon Cloudwatch provides you with data such as CPU and Memory consumption so that you can gauge when you need to spawn additional instances. 3rd party vendors like Rightscale provide additional paid services to enhance scalability by allowing you to rapidly spawn a large number of instances from pre-written scripts, even allowing dynamic resizing based on server load.


Amazon Web Services are indeed fairly easy to use. The scalability means that you can transit from a development environment to a deployed one with relative ease. Signing up was fairly hassle free. Just provide your credit card and telephone number and they will verify you. Given that the first 750 hours of compute time on a micro instance are given to you free of charge, there’s no reason not to sign up and play around with it yourself. However, once again as we oft do learn, it is no silver bullet. Making your game truly scalable still heavily rests on the shoulders of the developer. All Amazon does is provide the infrastructure.

Leave a Reply