How To: Setting Up A Free Tier Micro Instance On AWS
If you need a “cloud server” or “virtual private server,” (VPS,) you can create a free AWS account at AWS Free Usage Tier and launch an EC2 Micro instance for free for 1 year. Note though that you have to supply a credit card, which will be charged $1 for verification purposes, and will be automatically charged after your year is up, so keep an eye on that account!
This description assumes you are comfortable with using a “shell” – like Putty, Windows Command Prompt, Terminal or iTerm2 – on your laptop.
Step 1: Picking a Virtual Private Cloud (VPC) instance
Once you’ve created your AWS account, log in to the AWS Management Console and click on “EC2”.
Then click the blue Launch Instance button. On the next screen, select the “Free tier only” option:
The next screen (Step 2: Choose an Instance Type) has an important disclaimer, so be sure to read it – it basically says that if you keep your instance for more than a cumulative 750 hours (about 31 days’ worth), then your instance isn’t free any more. It also says that after the first year, you’ll be charged normal rates.
Choose the Launch Configuration labeled Ubuntu Server 12.04.3 LTS (your version number might be different if you are reading this later than when the tutorial was written.)
You can leave the 64/32-bit choice at the default, which is 64-bit. The availability of software for 64-bit architectures is rapidly growing, and for most beginner-level usage of web proxy and Rails libraries, you shouldn’t experience any trouble using 64-bit servers. However, if you are using old software, that hasn’t been updated in a while, or will need to compile any applications from scratch (we’ll be using pre-compiled binaries in this tutorial), then you might want to make sure you won’t run into compatibility issues by riding the cutting-edge of 64-bit machines.
Step 2: Creating a Key Pair
Select the Review and Launch, and then the Launch button. You will then be asked to create a new key pair – if you’ve used AWS before, and have a key pair, your default option is to use an existing key pair. For better security, use a different key pair for each of your AWS instances.
Name the pair, and save the generated PEM file in the
~/.ssh directory on your local machine (that is, the .ssh directory in your home folder.)
Then click “Continue” and click “Launch”. You should get a message that your instance is launching.
Step 3: Dealing with Possible Errors
If you get an error message “Each network interface requires either a subnet or a network interface ID.”, close and open the Quick Launch Wizard, and repeat the above steps but don’t click the “Launch” button. Instead, click “Edit Details” and then click “Save Details”.
Now when you click the “Launch” button it should work.
After your new instance comes up (usually takes a couple minutes), find it in the instance list and look for its hostname – go back to EC2 on the AWS Management Console, and click on Running Instances. Select the instance (you’ll see only one if you haven’t used AWS before) and you’ll see your hostname in the panel below. It will look something like
$ ssh email@example.com -i ~/.ssh/aws-personal-key.pem
Replace the key file name with whatever you named your key file.
Voila! You are now logged into your own server in the cloud.
Epilogue: Keeping Usage Under Control
Note that you don’t have unlimited usage in the Free Tier, and that includes the hours that your VPC is active. So if you aren’t using the machine – you don’t have an active website running, you are not logged in – then you should stop the VPC.
In the EC2 Management Console, select the instance, click on Actions dropdown, and select Stop. You’ll have to confirm the action in the popup that is displayed.
When you start up your instance again – through the same Actions dropdown – it’s hostname will change. You will have to use the new hostname when logging into the machine.