The amazing adventures of Doug Hughes

Deploying into ‘The Cloud’, sounds fancy doesn’t it?Amazon’s EC2 service has some great tools out there to manage your bits and bytes, so let me take you through the basics of getting a server up and running on EC2.

First lets get some of the concepts out of the way. An EC2 instance is basically a virtual machine that is running somewhere on Amazon’s hardware (that hardware is basically ‘The Cloud’ here). An instance can run any of the amazon supported operating systems, and is based off an AMI (Amazon Machine Image). Think of an AMI as a clone of a configured system, including all its disk resources and installed software, and you will not be far off.

Amazon has a comprehensive list of template AMI’s that you can use, or you can roll your own AMI (more on that in another blog post). Each instance you start will have an OS partition and a data partition by default, but keep in mind that if you terminate an instance everything that came with it (including the data partition) will be gone. That leads to the next topic, S3 storage.

S3 is how Amazon allows you to persist data (keep it around longer than a single running server instance, or run backups to it directly, there are a whole host of S3 associated 3rd party tools that I will not get into here). In our use case here, we will be using S3 to store any persistent drive volumes we want. You can create a volume of any size up to 1TB, and you can have up to 5 attached to a given instance.

Volumes are stored in an S3 Bucket (think: folder) associated to your account. Each volume is a block level device, which means you can treat it as a hard drive (for example, you can attach 5 volumes and use software RAID 5 to get a very large protected drive). Volumes are very nice, as you can attach and detach them from any of your running instances as-needed, you can snapshot a volume (with all its associated data), and you can even create a new volume based on a snapshot (this allows you to create a larger volume with all your data already in place). This part was really impressive to me, as it really makes hardware concerns something that you don’t have to worry about.

So now you know the lingo, you are ready to sign up for an EC2 account. This step requires a credit card, but don’t fret, even after hours of testing and a few false starts I still had enough change in my pocket to pay for all the charges I had racked up. You can sign up at Amazon’s EC2 page You will need to take note of your username and password obviously, but for the management tools you will also need a few other pieces. Under ‘Your Account’, go to ‘Access Identifiers’. You will need to save your Access key ID,and your secret access key (click the show button to display it). Save those somewhere on your system that is pretty secure, those are the keys to your EC2 castle.

Now lets get some of those admin tools I spoke of. First off, the simplest ones to use are based on Firefox as plugins. If you are not using firefox yet, go get it, then grab these tools:

Elasticfox – This will be your primary management tool for your EC2 instances.

S3 Organizer – This tool allows you to manage all of your storage buckets. This is important if you want any of your data to stay around longer than a running EC2 instance.

When you first fire up Elasticfox, it will ask you for your account name (username you signed up with), access key, and your secret access key. Add those, and you are ready to go. First thing you should do is create a Key Pair. Go to the key pairs tab, click the green key icon, and take the default key pair name. This key pair will allow you to retrieve passwords that are automatically setup on your instances (a rather important part), so don’t skip this step. Save this key to your system in a place you can locate it easily. Now we are ready to get an instance running!

Go to the ‘Images’ tab, this is where the Amazon pre-built system images and the community contributed images live. Look for a windows platform instance owned by Amazon, the manifest should look something like: /Server2003r2-i386-Win-v1.{something}.manifest.xml (currently 1.05, ami ID ami-1929ce70). Right click on that ami, choose ‘Launch instance(s) of this AMI’, choose the key pair you just created, then choose an availability zone (you will need this in a minute here).There are obviously many other options here, but they are not currently needed for this deployment. Click ‘Launch’ then sit back a minute while Amazon allocates resources and fires up your first virtual machine instance (watch the instances tab to monitor progress).

After the instance is running, some automated Amazon scripts get run on there to set its host name and IP, and assign an administrator password. If you right click your instance, and choose show console output, you can see when the password gets assigned (the console will be blank until the initial scripts get run).

Once you see something about the password in the console, close the console, right click on the instance, and choose ‘Get Administrator Password’. You may be asked to locate your certificate file you saved earlier when creating a key pair, then you will see the password in a javascript popup. Write that down, then give your instance another right click, and choose ‘Copy public DNS name to clipboard’. Open your favorite RDP client, paste in the address, and click connect.

You may need to first open the Amazon firewall to allow RDP connections from your address, to do this go to the ‘Security Groups’ tab (you will only have a default group right now), and on the right side choose the green checkmark, choose ‘RDP; choose ‘host’, then click the button to get your host address. Click add, and you should be able to RDP in using the administrator password that you wrote down a minute ago.Congratulations, you now have a running EC2 instance that you can manage!

More to come in later posts on working with persistent volumes, backup strategy, creating your own AMI, and pitfalls and possibilities of running in the cloud.

Comments on: "Deploying in the Cloud – Setting up your first EC2 instance" (9)

  1. Thanks for the step-by-step. This might be enough to finally get me to start messing around. So what is the spec for a single AMI? Is there some description of what you’re getting in terms of processor/memory?


  2. Thanks.

    I think Stax ( ) is worth a mention when talking about ColdFusion on EC2.

    The service is _very_ promising and instances of CF8 are free during the beta.


  3. thanks for this – the reserve pricing is probably what’s going to help me jump on this (and the tutorial above lol)! 🙂


    Check out the cool mini-game


  5. Pierpaolo Pisapia said:

    Hi there.I’am a new ec2 customer.
    I have a simple question for you.this should be a silly question for you but i am beginner here.So please aplogize about that.

    Here the question:
    how to save on the ec2 machine?.Basically when i open a new instances, and for example i wont to keep stored the programs and the files upon the machine without loose the data each reboot.
    How i can do it?
    For example i would install a permanent running session of matlab.I would to know how to keep stored the program files and how to let the programm running constantly.
    Thanks for the answers and sorry about my english.
    Take care


  6. Pierpaolo,

    Whenever you ‘reboot’ an EC2 instance, all your data will stay there. You only need to be concerned with ‘terminating’ an instance, as any data not on S3 storage will be lost when you terminate the instance.

    I will usually start a setup with one of the AMI’s from Amazon, then install my software to the D drive, and instruct my software to store any ‘real’ data onto a connected S3 drive. Once my configuration is completed, then you need to bundle the running instance into your own AMI. Then you can terminate it when you need too, and create a new instance based on your created AMI, hook your persistent S3 drive to the instance, and you should be ready to go!

    Hope that helps?

    Chris Peterson


  7. Pierpaolo Pisapia said:

    Hi Chris.
    Thanks a million for your answer.
    Today i’have checked the opened instance and we (me and my boss) have experienced that the data are still there if you leave the instance open, (we are still unaware about S3)and for these reason we have formulate more new and exciting question for u.
    1)S3 should be a place where to create and store the real data?It’s a place where to store an image?
    2)How to reach (step by step) this “place” and how may I be capable to copy ,for example , the data from the virtual machine to the real machine (a pc)
    3)I have noticed that when you open an instance the customer start to pay since don’t terminate it.There is a way to “froze” the instance the saturday and the sunday for example, keeping the data stored somewhere in the S3 and restart the instance the monday morning?
    4)This should be the next to last stick out please.:)
    Immagine that I have a database stored on a virtual machine.
    I use for esample a small configuration and i have installed my data and programs on it.
    Question:can i change virtual machine (for example into a medium size one) keeping the same software configuration?Can i have an image which wrap only the software configuration that could give me the opportunity to use, on another machine ,the same data I used along one (4ex)one year ?
    Last one :may we find some documentation and some online help about that or a instant messaging help for this?

    Thanks very much for your patience and specially thanks to bear my english:
    Regards Pierpaolo


  8. Where does the Data Base sit?


Comments are closed.

Tag Cloud

%d bloggers like this: