Install the Amazon EC2 API Tools
Now that you're familiar with the core offerings and vocabulary, let's try out some of the services. You'll need to create an AWS account before we can go any further. Note that a free usage tier is available for new users.
First, we'll want to install the API tools. These Java-based tools allow you to issue Amazon commands from any terminal window, whether it be your local laptop, another server, or even an instance hosted in Amazon itself. Bootstrapping indeed!
The first step is to download the tools from Amazon. Next you'll set up a couple of environment variables:
export JAVA_HOME=/usr
export EC2_HOME=/home/sean/api-tools
These are examples of the commands for Linux and Unix. For more detail on these and for the corresponding commands on Windows, follow this link to Amazon's documentation.
Create your access keys
The Amazon dashboard provides an easy way to set up your keys.
- Go to aws.amazon.com and log in.
- Under your account name in the upper right, click the menu and select Security Credentials.
- Click the first link, Access Credentials.
- Click "Create new access key" and follow the instructions.
- The last step will involve downloading two .pem files. Save these locally.
- So that your Amazon tools can locate these .pem files, set these two environment variables:
export EC2_PRIVATE_KEY=/home/sean/keys/pk-A5X4ZTZRLDEMYVHGXCQHU2HW3HALFS3T.pem
export EC2_CERT=/home/sean/keys/cert-A5X4ZTZRLDEMYVHGXCQHU2HW3HALFS3T.pem
Choose an Availability Zone and Region
Availability Zones are distinct data centers. It is incredible that we can distill a data center down to a short identifier such as us-east-1a or us-west-1c, but that is the beauty of cloud computing and Amazon Web Services. As you build more complex applications with more resilient architecture, you'll pay more attention to which Availability Zone you deploy components in. For now, pick the one that's physically closest to your location.
You'll find the menu for selecting your Availability Zone right next to your account name in the upper-right corner of the EC2 dashboard.
Choose an Amazon Machine Image
Next stop on your Amazon tour is to decide which AMI to use. There are nearly 1,000 AMIs to choose from, and you can easily browse or search for what you need.
At this stage I wouldn't spend an inordinate amount of time deciding. Go with an Ubuntu image as a default. Also be sure to pick an EBS root AMI. There are very few use cases for Instance Store now that EBS is mature. I'm personally partial to Eric Hammond's images, which are well maintained, well supported, and well respected in the community.
A note on 32-bit versus 64-bit images: Only micro, small, and medium instances are available in 32-bit. As a general rule, it's best to go with 64-bit for everything unless you have a particular and compelling reason to require 32-bit. With 64-bit, your images will work on all instance types, and you can vertically scale easily.