Google

How to jump into the Cloud

Written on:December 12, 2008
Comments
Add One

Cloud computing is a general term for a public accessible virtualization system.

Virtualization + DataCenter + PublicAccess = CloudComputing

Although there are more than one provider and others to follow, Amazon (AWS) has pioneered the field and I will refer to AWS only when describing hands-on procedures.

Sign Up

The first thing to do is to create an AWS account and register a credit card – yes it’s not free, although not expensive either. The pricing starts at USD 0.10 per hour for the smallest machine type, plus some extra for storage and bandwidth. For a single lightly loaded server it adds up to USD 2.5-3 per day.

You should also sign up for EC2 and S3, which is just a single click on a button.

Get the Keys

The second thing to do, is saving the ACCESS and SECRECT keys of your account to a text file, because you will need these character sequences from time to time.

The following task is to generate a cryptographic key pair. Most convenient is letting AWS do it for you, but you can also upload you own public certificate. AWS only stores the certificate part. That means, after AWS has generated your key pair, there is a download button on the result page. Use that button to download your private key, because it is your only chance to get a working key pair. Ensure you download and store both the key and the certificate.

Get the Tools

Now when you have signed up you need the tools to start interacting with AWS and EC2. The fourth task to do is to download and install the AWS EC2 API Tools plus a very handy plugin to Firefox.

AWS/EC2 API Tools

This set of command line tools are implemented in Java, so in case you don’t have a decent JDK/JRE already installed, now is the time to fix that.

You need to set four environment variables in order for the tools to work. These are

  • EC2_HOME
  • EC2_CERT
  • EC2_PRIVATE_KEY
  • PATH

The last (PATH) should point to the bin directory of EC2_HOME. The cert and key variables should point to the PEM files you downloaded during the key pair task above. Now test the command line tools

ec2-describe-images --help
ec2-describe-images --verbose
ec2-describe-images --owner amazon

The first line shows the built-in help and the second how to see what SOAP data are interchanged. Every command responds to these options. The third line shows how to filter out the machine images provided by Amazon. In addition to Amazon, there are plenty of third-party images available. My personal preference is to use Ubuntu images created by Eric Hammond.

ElasticFox

Besides of using the AWS EC2 API command line tools, there are many others available implemented in Perl, Ruby, C# and more. However, my clear favorite is not a command line tool, rather a GUI. Elastic Fox is a plug-in to FireFox and provides you with a very convenient access to EC2. This plug-in is so valuable that I am using it all the time, instead of the command line tools

ElasticFox

Prepare before launch

Before you can launch your first AMI (Amazon Machine Image), you need fixing three additional things.

  1. Generate an EC2 logon key pair
  2. A SSH client for Linux/Unix AMIs. For a Windows AMI, will use the built-in Remote Desktop client to logon via RDP.
  3. Create a security group (AWS-EC2 firewall rule) enabling access to SSH (port 22) or RDP (port 3389).

The EC2 logon key pair is different from the key pair you created in step three. The logon keys are used for SSH access and to encrypt/decrypt the Windows Administrator password. In contrast to the first key pair, you can create as many logon key pairs you like and use them for different purposes. Every key pair (or cert) is referred to by its name. Ensure you save the private key part to a PEM file on your own computer, because you will need that key for the SSH logon.

You need a remote access client, which for a Linux (Unix) machine will be SSH. If you are running Linux at your desktop, you probably already have ssh installed. If you are running Windows at your desktop, you need a SSH client like PuTTY or install an environment like CygWin. If you are going for PuTTY, install the full distribution or more exact PuTTY and PuTTYgen. You need the latter to convert your EC2 logon private key from PEM to PuTTY’s own format PPK (PuTTY Private Key).

By default, there are no ports opened into your running machine instances, which means you cannot logon unless you open an appropriate port. You do that by creating a security group (firewall rule). Use ElasticFox to create a new firewall rule (web), which permits access to port 22 (SSH) and 80 (HTTP) for all IP numbers (0.0.0.0/0). The funny zeroes denotes an IP number group (CIDR). You can study that topic at WikiPedia.

Launch a virtual server

Now is the time to lauch the first virtual server. Choose, for example, the Ubuntu 8.10 server 32bit, provided by Eric Hammond.

Right click and choose “Launch…”

Check that you are using your logon key, your firewall rule that at least open port 22 and the type is the smallest in only one instance. You will now see that the machine instance is booting (pending).

Click the refresh button, until you see the instance is running. When that happens, you will see that the instance now has a public IP and DNS name.

Logon to the instance

Use SSH to logon to the instance. If you are using PuTTY, you need to convert the PEM formatted private key into PuTTYs own key format PPK. Use PuTTYgen for that task. Load the PEM key and save as a private key. Ensure you give it the same base file name (differing only in the file extension), so ElasticFox can create file path to the key. Review the tools settings .

You can use ElasticFox to launch your SSH client directly. Just right click on the instance and choose “Connect …”. If PuTTY complains of not finding your key, double-check key template settings in the Tools setting of ElasticFox. If everything goes well you should be logged on to your own server in the cloud.

When your are done. Don’t forget to shutdown your instance again. Remember, AWS is affordable but not gratis.

Leave a Comment

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Why ask?