CS5413 Fall 2014

MWF 1:25pm - 2:15pm

205 Thurston Hall

CS5413: High Performance Systems and Networking


[Lab 0 Part A] Getting Started on Red Cloud

The cs5413 projects will use the Red Cloud to give us practical experience in using high performance systems and networking and especially the cloud. (Red Cloud information here)

We have a paid Red Cloud account to support the course. This is a single account, to be shared among all the cs5413 students.

1. Conventions for Sharing a Single Red Cloud Account

Because we will all be sharing a single Red Cloud account, it will be possible (with some effort) for students to decrypt and read one another's Red Cloud machine image files, or to steal one another's static content files. This is not fundamentally different from the bad old days when CS programming projects were done on a batch computing system and printouts were delivered in sorted piles in public terminal rooms. The University Academic Integrity Policy applies to everything we put into Red Cloud, and you are expected to follow this policy scrupulously.

Also as a consequence of sharing a single account, we will need to modify some of the procedures from the Red Cloud documentation so different students' projects will not interfere with one another. We have the following issues:

  • The course Red Cloud account is registered to me (hweather@cs.cornell.edu) and only I know the password. Some of the account setup operations described in the Red Cloud Getting Started documentation require this password, but these operations should be done exactly once per account, and I have already done them.

  • Authentication for Red Cloud operations requires either

    • a KeyID and a Secret Key, or
    • an Account ID together with Private Key and X.509 Certificate files in .pem format.

    This nominally "secret" information must be known by every cs5413 student. We have not included it in this (public) document; instead, it is available for download from CMS as part of Lab 0. Effectively, we are relying on CMS authentication to restrict the Red Cloud account information to registered cs5413 students.

  • Some Red Cloud resources are in either global or Red-Cloud-account-wide name spaces. We have defined naming conventions for these resources. Here are the conventions regarding the Red Cloud compute service:

    • Virtual Machine Image: A machine image is a static file on disk that contains (at least) a bootable root partition. In this class, we will use the same machine image to create virtual machine instances. The image we will use is emi-C4A24195. The EMI name is ubuntu-14_04 and the root device is of type EBS.

    • Instance Name Prefixes: These should be chosen to be unique by including your netid and then appending whatever descriptive name you want according to the pattern

      for example
      As discussed below, each virtual machine name prefix occurs as a prefix of each of the (many) instances. Thus, the naming convention will make it possible for students to keep more than one VM.
    • Keypairs (discussed below): Choose keypair names using the pattern

      for example
      Keypair names are used in the Eucalyptus API and have to be unique across the shared account.
    • Security groups (discussed below): Choose group names using the pattern

      for example
      Like keypair names, group names do not correspond directly to virtual machine instance names, but they are used in the Eucalyptus API and have to be unique across the shared account.

    To help things work smoothly with so many persons sharing the same Red Cloud account, we ask you to adhere scrupulously to the above conventions.

    One important thing you should observe is to mark whether you are using Red Cloud in a shared document. The link for the document can be found in CMS. Because we have a limited shared budget to use Red Cloud, we don't want idle instances to be running and using the shared budget. It is your responsibility to stop the instance after use. However, as a backup plan we ask you to mark the document, so that the TA can regularly check whether instances not being used are running. Such instances running without the usage indication in the shared document can be stopped without prior notice.

2. Downloading and Installing Eucalyptus Account Information

To get the shared Eucalyptus account information, log on to CMS go to lab0 and download the file account-info.txt. Open the file in a text editor and follow the instructions you see there. When you are done, you will have accomplished the following. You will have created a directory

or (for Windows users)
containing two files:
Values for xxxxxxxx will come from the download. These files contain the private key and X.509 certificate used to authenticate to Eucalyptus.

You will also have modified your environment to contain

or (for Windows users)
The actual values for xxxxxxxx will come from the download. In Linux, you can 'source' the downloaded 'eucarc' file to set your environment variables.

All done! In following sections we will discuss getting started with Eucalyptus in some detail.

3. General Instructions

Eucalyptus's top-level documentation page (here) has links to "Getting Started" guides for each of the many services included in Eucalyptus. The Eucalyptus guides are simple and informative, but they are not designed for a shared Eucalyptus account. As you work through them, you will sometimes be instructed to use the Eucalyptus web site to sign up for a service or to create a new X.509 certificate. In other places you will be instructed to create a new keypair, to modify the rules of the default network security group, or to do some other thing that affects the global state of the Eucalyptus account. Clearly, if several students were to try this concurrently it would be a Bad Thing. So,

You should ignore such instructions!
The Eucalyptus account has already been set up, the AccountID, KeyID, Secret Key, X.509 certificate have already been created, and you have installed them on your machine. Your bucket names, keypair names, image names and security group names should always be constructed according to the conventions described in Section 1, and you should avoid the default network security group altogether.

4. Getting Started with Eucalyptus

Download the prefered set of tools to use in this class, Euca2ools runs on most platforms, including Linux, or Mac OS X with minimal external dependencies.

The Eucalyptus "Getting Started" document for Eucalyptus is here. You can ignore this if you have already installed the euca tools as described above.

The Eucalyptus online Eucalyptus DeveloperGuide includes documentation for the command line tools. It is a Good Idea to read the manual page for each ami/api command as you are about to use it, to make sure you understand what it is about to do.

Running an Instance

This section includes a step for "Generating a Keypair", which must be changed to conform to our shared account naming conventions. The Eucalyptus instructions tell you to name your keypair "gsg-keypair" (The "gsg" part presumably stands for "Getting Started Guide.") Instead, you should use a netid-specific name following our naming conventions; for example,

where the netid part should be replaced by your own netid, and xxx is a postfix that helps you identify the key. The Eucalyptus document instructs you to store the private key of the keypair in a local file. The logon step where you connect to your instance using an ssh client requires the name of this file, so put it someplace where you can find it, for example
euca-create-keypair     kp-hw342-test   >   ~/.euca/id-rsa-kp-hw342-test
Again, the name you use for this file is arbitrary, but you need some convention that will enable you to remember the name of the RSA private key file associated with each of your Eucalyptus keypair names. ssh has been noticed to refuse using public keys unless the file permissions are set apropriately (e.g. on UNIX the command chmod 600 ~/.euca/id-rsa-kp-hw342-test should do the trick). To debug your ssh connections, use the -v or -vv flag.

The Network Security Group is another important issue that is not well covered in the Eucalyptus document. Every Eucalyptus instance runs in a named security group that you specify when you start the instance. The security group has a set of firewall rules that control network connectivity between instances in the group and instances outside it.

If you start an instance without explicitly specifying a security group, the instance runs in a predefined group named "default". Clearly, it would be a Bad Idea for concurrent users of a shared account to have instances running in the (same) default security group; so we use the naming convention described above for security groups. You should create a new security group for the remainder of this exercise using a command like

euca-create-group   gp-netid-xxx   -d   "yyyyyyyy"
Where as above you should replace netid by your own netid, xxx by a string to make the security group name unique among all the security group names you define, and yyyyyyy by a short description of this security group. For example,
euca-create-group   gp-hw342-test   -d   "test group for getting started"

You can check to make sure this worked by typing

euca-describe-groups   gp-netid-xxx
or just
which will list all groups that have been defined by anyone using the shared account.

For some of the later steps in this exercise you will need to specify the group name explicitly rather than allowing it to default to "default". The command that actually starts your instance is the first of these. For example

euca-run-instances   emi-C4A24195   -g   gp-hw342-test   -k   kp-hw342-test
starts an instance in the specified group gp-hw342-test. The Eucalyptus Machine Image used in the example is called emi-C4A24195. For a complete list of available images, you can run the euca-describe-images. In general we will provide you with an image that contains all the libraries required for the lab assignments -- emi-C4A24195 is one such image and you can use this image for the current lab. Before you actually start the instance please mark in the shared document that you are starting to use Eucalyptus.

In the next step, "Authorizing Network Access," you need to specify your group name in place of "default". For example,

euca-authorize   gp-hw342-test   -P   tcp   -p   22   -s
euca-authorize   gp-hw342-test   -P   tcp   -p   80   -s
Opens the standard TCP ports from any address ( for ssh (22) and HTTP (80) in the group gp-hw342-test.

At this point, you should be able to connect to your instance with the ssh command from the Eucalyptus documentation, using the name of the RSA private key file you saved when you created your Eucalyptus keypair, and the external network address assigned to your running instance (to find it out use euca describe-instances instance_id where instance_id is returned by the euca run-instances command), for example

ssh   -i   ~/.euca/id-rsa-kp-hw342-test   root@
Well, "Congratulations!" You have started an instance. If you want to switch to root user type
sudo su -

DO NOT go away without remembering to shut down your instance -- the CS5413 course account is charged for the instance for as long as it continues to run.

Cleaning Up

Don't leave any Eucalyptus instances running!
The command
prompt>   euca-describe-instances
will show you a list all running instances with enough information that you can determine the instance ids of all instances that are yours (contain your netid). You can then stop them by running
prompt>   euca-stop-instances   i-nnnnn ...
Also return to the shared document and unmark your Eucalyptus usage status. Please don't forget to do these steps.

5. End of Lab 0 Part A

At this point you are done with Lab 0 Part A!

This page was originally created by Han Wang.