For a similar discussion of Google App Engine, consult Getting Started with The Cloud: The Ecosystem
Amazon Web Services, or AWS for short, is a suite of cloud-based, pay-as-you-go, on-demand services that facilitate building web applications by providing the primary infrastructure components. With AWS, you can rapidly provision (and scale as needed) computing resources, storage, and even messaging. In fact, AWS supports the development and consequent deployment of entire web architectures ranging from the actual hardware infrastructure for entire web applications to reside to content delivery networks. In this series of articles, I will explain how to set up your AWS instance (this article), move your apps to it and run them there, and how to scale up resources as you need. As expected, the programming aspects of this will be a core focus.
AWS is a game changer. Anyone hobbyists to large IT departments, can bring full-fledged web applications into production at a pace and price not seen before. The capital-intensive process of building an infrastructure in anticipation of load is dead. Entire working products (that is, not the prototypes or small pieces, as in decades past) can be rapidly deployed for less money than it costs to acquire a few computers.
Climbing on board AWS is comparatively easy; however, as you'll find out quickly, AWS is not free. While there are free usage tiers (i.e., you can use lightweight EC2 instances at no cost per hour), all AWS products are provided on a pay-as-you-go basis. You pay for what you use, whether that be computing resources, bandwidth, or storage. Thus, in order to begin using Amazon's suite of tools, you must create an account with Amazon and provide a credit card.
If you are like me, you've come to expect just about everything related to building software for free. But for the moment, don't let the thought of spending money stop you from exploring AWS as its pricing is low, especially if you plan to do some prototyping in the beginning. For less than the cost of a cup of coffee, you can deploy a working application that leverages multiple AWS products. To create an AWS account, simply go to http://aws.amazon.com of key importance throughout this entire process is the creation of your account's various credentials. While you'll have sign-in credentials (that is, a username and password), which you'll use to sign into Amazon's management console, you'll also need access credentials. You will use them to accomplish various things on AWS.
Once you have an account, there several ways for interacting with AWS: the AWS Management Console, the command line, or programmatically through an API. There are standard libraries offered by AWS for Java, Ruby, Python, and .NET, just to name a few. What's more, because the AWS API is a series of web service calls, there are alternative open source libraries (in a wide variety of languages including C++) for working with AWS.
I think you'll find that in some cases working with the AWS management console is much easier, while in other cases we'll discuss later, using a programmatic API or command-line tools provides better flexibility when it comes to automation.
AWS is made up of several products. The touchstone of the entire suite is the Elastic Compute Cloud (or EC2). EC2 is essentially a virtual computer running the operating system of your choice along with various options for memory, CPU speed, and storage. With EC2, for example, you can quickly provision a 32-bit Linux image running any one of a menu of Ubuntu versions with 1.7 GB of memory and, say, 160 GB of storage.
Thus, EC2 is the basis of an application's infrastructure, on which other software assets are deployed. This is different from other cloud applications deployment options, such as Google's App Engine, Heroku, or event AWS's own Elastic Beanstalk. While all of those products allow you to deploy web applications, they do so by providing a platform, which handles the minutia of memory requirements, file systems, and the like. In fact, the difference between the rawness of EC2 and the bundled nature of something like Google's App Engine has lead to two terms: Infrastructure as a Service (IaaS) for the EC2 model and Platform as a Service (PaaS) for Google App Engine, Heroku, and others.
EC2 is pure infrastructure: It's bare bones computing power. Everything else in your instance is handled by you. In fact, provisioning an EC2 instance is not all that different from going out and buying a server with Linux on it; the biggest difference between the two is the lack of an upfront cost for EC2. Before beginning the process of provisioning an EC2 instance, you need to work out two aspects:
- Your choice of operating system and a corresponding Amazon Machine Image (or AMI).
- Your memory, space, and CPU requirements.
With EC2, you can choose from Windows, OpenSolaris, and a variety of Linux distributions ranging from Fedora to Ubuntu, just to name a few. I tend to prefer Ubuntu and there are several freely available images from the Ubuntu team to choose from. These OS images are known as AMIs. Some are freely available and others require payment; what's more, there are AMIs that come loaded with software packages (for example, an Enterprise Oracle Linux AMI running an Oracle DB).
There are various classes of EC2 instance types on which you run AMIs ranging from the low end all the way up to the high end. There are also instance types within classes for example, High-Memory instances with 17.1 GB of memory all the way up to 68.4 GB.
Remember, with EC2, you pay for what you use, and the price per resource varies depending on the resource type. For instance, at the entry level, a small instance (within the standard instance class) is a single core having 1.7 GB of memory on a 32-bit platform with 160 GB of local storage. It will cost you $0.085/hr if you go the Linux route or about $2.00 a day. But, if you fire up a High-Memory Quadruple Extra Large instance possessing 68.4 GB of memory, 8 cores, 1690 GB of storage running Linux, it will run you $2.00 an hour. Windows costs slightly more in each case. Keep in mind, however, that the price I just quoted is pure computing cost there could be additional charges depending on how much bandwidth you utilize, etc.
Once you've settled on an instance type and OS, you need to do two more things:
- Set up a private key pair.
- Determine a security policy.