Setting up an Amazon EC2 instance: A beginner's guide
I recently decided to move a project onto Amazon’s EC2 from a dedicated box I’ve been running for a couple of months. Although it was initially intimidating, there are a wealth of blog posts, tutorials, and guides that really hold your hand as you get used to Amazon’s setup.
I heavily consulted the following three guides (keep in mind that I decided to go with an Ubuntu install)–strangely the second post is quite similar to the first.
These tutorials walk you through the process of setting up an EC2 account, installing EC2 command-line tools, authentication, and loading an AMI (Amazon Machine Image) onto your instance. Since the tutorials do a great job of taking you through the above tasks, I’ll leave the majority of the explanation to them. However, I will give you a high level overview of each task so that you can get a feel for the roadmap.
Create an EC2 account
Simple and straight-forward—sign up for an AWS (Amazon Web Services) account, and then create an EC2 account. The process is very easy–note however that you will be asked to complete phone verification before your account is setup.
Setup Authentication
You’ll need to create an X.509 certificate and download both the resulting private key file and the X.509 certificate file to a safe place on your local machine. No passwords are exchanged—to learn more about how authentication works with EC2, be sure to read-up on Public-key cryptography.
The only gotcha’s I had in the entire process had to do with how I named my private key files. For the sake of simplicity, follow the Ubuntu guide as far as naming and locating your private keys.
Install the EC2 command-line tools
A simple install will allow you to interact with your EC2 instances from the command-line. There is a web-based GUI you can use, but the command-line can help you control your instances much more quickly.
Choose and load an AMI
Loading an Amazon Machine Image is surprisingly simple, especially if you decide to go with Ubuntu. Ubuntu maintains a list of official AMI’s–I went with 10.04 LTS, and the AMIs can be viewed at http://uec-images.ubuntu.com/releases/10.04/release/. Loading your selection is as simple as locating the AMI ID and installing it from the command-line.
SSH into your instance
After opening a port for SSH on your instance, you should be able to successfully access your instance from the command-line, and interact with it like any other remote machine.
That’s it! At this point, you can either press forward by either assigning a static IP and further configuring your instance, or by terminate your instance—both are explained clearly in all three guides. The whole process is surprisingly simple, and most of the legwork is a one-time deal. Once the basic setup is out of the way, creating new instances can be done in a matter of minutes.