logo
Go to the homepage of the Vrije Universiteit. Goto the homepage of the faculty of sciences. Goto the homepage of the department of computer science.

Cluster and Grid Computing (Practical Work)



The Amazon Elastic Compute Cloud (EC2) :


The Amazon Cloud is a commercial web service that allows you to rent computers on which you can run you applications. Instead of getting access to a real machine, the Amazon Cloud is based on virtualisation. You get access to a virtual machine on which you can load any software you like, including the operating system.

When reserving a machine, you need to specify which Amazon Machine Image (AMI) you want to start on the machine. Each AMI contains a system image (like the ISO images you use to create a bootable CD), containing an OS and a selection of other software. Every AMI has a unique identifier. For example, the AMI we will use in this assignment has the identifier ami-66f5dd12.

Signing up at Amazon:


Before you can rent any machines, you will need an Amazon Web Service (AWS) account, an Amazon EC2 account, and an Amazon S3 account (the 'cloud storage' infrastructure of Amazon). The easiest way of setting up these accounts is to have a look at Amazon's Getting Started Guide:

  http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/

and look at the Setting up an account section, which contains links to all web pages where you need to sign up. Note that you need a creditcard for this! If you do not own a creditcard and cannot easily get one, please contact Thilo.

After signing up to AWS, S3 and EC2, you should end up with the following items:
  • An AWS login and password
  • An AWS Account number
  • An X.509 certificate/key pair used to encrypt your communication with the Amazon web service.
Make sure you correctly create the .ec2 directory containing the X.509 certificate/key files (as described in the guide), otherwise you will not be able to use the Amazon Web services.

Testing your account using the AWS Console:


Once you have create an account, you can test it by following the Getting Started Guide (which will use command line tools), or by using the Amazon AWS Console:

  https://console.aws.amazon.com/ec2/home

which provides a convenient graphical interface to the Amazon Cloud. We will use the console to test our account. After logging in, click on the "Amazon EC2" tab to select the Console.

We will start by selecting the region from which we want to reserve a machine. We will use the "EU-West" region is this assignment, so select it at the top of the navigation bar on the left.

Next, we need to generate a key that we can use to access the machines we have reserved. Click in "Key Pairs" in the navigation bar, and then click on the "create key pair" button. You will get a popup asking you for a name for the keypair. Enter "cgc-keypair" and click OK. A download of the "cgc-keypair.pem" file will start automatically. For convenience, save this file in your ".ec2" directory.

Next, we need to select the AMI that will be booted on the machine. Click on AMIs (again in the navigation bar). This will give you a list of available boot images. As a test, you can search for the "getting started" image (ami-e40f2790), or the image we will use for this assignment (ami-66f5dd12).

Select the AMI, and click on launch to allocate a machine and boot the image. You will get a popup where you need to enter the number of machine you wish to use (enter 1 here), the key pair you wish to use to access the machine (select "cgc-keypair"), and the "security group" this machine will belong to (use "default").

Wait for the machine to start. This may take up to a minute or so. You can follow its progress by clicking on the "Instance" link on the left. This will show you a list of intances (i.e., reserved machines) and their status. Each instance has a unique ID (like: "i-2a271c5e"). (tip: there's also a refresh button).

Once the image is running, the public DNS name of the machine will be shown in the web interface. This will look something like this:

  ec2-79-125-49-59.eu-west-1.compute.amazonaws.com

You can select an instance to see additional information about it.

Although your instance is now running, you may not yet be able to access this machine, because it is behind a firewall by default. The settings of the firewall are controlled by the security group mentioned above. To change the firewall settings of a security group, click on "security groups" in the navigation toolbar (on the left), and select the "default" group. The settings will be shown at the bottom of the screen. Make sure they include something like this:

   SSH tcp 22 22 130.37.197.2/0

You can add this line if it isn't already included. This will open the firewall for SSH traffic (on port 22) for traffic comming from the fs0.das3.cs.vu.nl (130.37.197.2). You can also open it for any originating address like this:

   SSH tcp 22 22 0.0.0.0/0

You should now the able to access the machine using ssh. Note that you'll need to use the key you generated earlier and log in as root, for example:

   ssh -i ~/.ec2/cgc-keypair.pem root@ec2-79-125-49-59.eu-west-1.compute.amazonaws.com

This should log you in on the machine you allocated.

Once you are done using the machine, make sure you terminate the instance . You can do this by clicking on the "Instance" link on the left, selecting the instance you want to terminate, and clicking on the "terminate" button. The machines status should go to "terminated" after a couple of seconds.

   !!WARNING: Not terminating properly may cost you a lot of money!

Finally, you can get your bill at the Amazon AWS Portal by clicking on "Your Account" -> "Account Activity". Click on the "+" next to "Amazon Elastic Compute Cloud" to see the cost specified in detail.

What's next:


Congratulations, you have now entered the wonderful world of Cloud Computing. Unfortunately, this manual approach to starting AMIs is not particularly suited for our purpose. Therefore we will use the Typica and GAT to directly reserve and access Amazon machines from our JOINC library


If you spot a mistake, please e-mail the maintainer of this page.
Your browser does not fully support CSS. This may result in visual artifacts.