Getting Started With Amazon Web Services

So, recently I’ve been looking at Amazon Web Services to see what this offers in terms of other kinds of hosting (such as shared hosting) that I also have. For the moment I am only going to be looking at their Elastic Computing Cloud (EC2) offering.

What is EC2?

From the EC2 Homepage:

Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity in the cloud. It is designed to make web-scale computing easier for developers.

Essentially it’s a simplified form of hosting that allows you to run virtualised instances of entire machines without having to have physical hardware at your disposal. Now on the face of it, this sounds a lot like traditional shared hosting (and to a large degree this is exactly what it is). Where EC2 offers more is that you can “choose” where your instances are geographically hosted, how many instances there are, etc.

This geographic location is perhaps one of the most important aspects since, like a CDN, you are able to run instances “closer” to where your users are physically located which means you get site speed improvements, etc.

Obviously there’s a lot more to this technology than the contents of the paragraphs, but for a quick introduction, that’s enough to get you started!

Getting Started

In order to get started, you need to sign up at the AWS homepage. This is a relatively simple process, you just need to provide the usual contact details, payment information and a contact number.

Once you done all that you’re ready to start running your own instances.

Your First Instance

For the sake of simplicity I’ll talk about how to set up a running instance just using your web browser, but be reassured that there are CLI based tools if you feel adventurous. I’ll cover these in a later blog post (if I get the time!)

To create a new instance, surf to the EC2 Console page and select the Launch Instance option. For this bit you can also use Amazons quite good walkthrough here. My only comments here are at step 5 (the security section) make sure that you turn off anything that you don’t want. For me this meant only allowing SSH, HTTP, and HTTPS.

EBS or Instance Store?

Amazon offers two types of storage for your server, EBS and Instance-Store. Depending on what you want to do with your instance will determine which type you need. EBS is faster, Instance-Store is slower (since it’s S3 based). EBS highlights:

  • EBS backed instances can be set so that they cannot be (accidentally) terminated through the API.
  • EBS backed instances can be stopped when you’re not using them and resumed when you need them again (like pausing a Virtual PC.)
  • EBS backed instances don’t lose their instance storage when they crash.
  • You can dynamically resize EBS instance storage.
  • You can transfer the EBS instance storage to a brand new instance (useful if the hardware at Amazon you were running on gets flaky or dies, which does happen from time to time.)

Since I’m only interested in Linux instances, I’ll only talk about how to connect to them.

For the most part the Amazon connect instructions are quite good. The one fly in this ointment was that I was actually setting up the instance from a Windows machine, which meant I was using Putty as my SSH client. This means that the SSH keys that Amazon provide you do not work - Putty can’t interpret them correctly. In order to get this to work you need to import the .pem file into PuttyGen and export the private key back out as .ppk (the native private key format for Putty).

You need to remember to use the user “ec2-user” to log in to your running instance rather than “root” - although once logged in, you can simply use:

# sudo su -

Updating Your Instance

Once you’ve got the instance running you need to make sure that you keep it up to date with any security patches, etc. To do this, simply use:

# sudo yum update

on a regular basis.

What Now?

That’s up to you. Once you’ve got a server up and running you are only limited by your imagination as to what you can do with it.


Tags: amazon, ec2, aws
blog comments powered by Disqus