Monday, 1 July 2013

Eucalyptus 3.3 Tutorials- Launching Instances

Eucalyptus 3.3 Tutorials
Launching Instances


In this tutorial, we are going to launch an instance from a  CentOS Eucalyptus Machine Image (EMI) using Eucalyptus User Console and with Euca2ools, the Eucalyptus Command Line tools.

Def

A Eucalyptus Machine Image (EMI) is a combination of a virtual disk image(s), kernel and ramdisk images as well as an xml file containing meta data about the image.

Using User Console:
Firstly, log on to your User Console with the appropriate Credentials recorded in the earlier steps. 

Once logged in, select "Launch New Instance" as shown below.


This will take you to a "Create New Instance" wizard as shown below. Select the default "Image" listed. This image is created by Eucalyptus Faststart. Select "Select Type" to continue.


In the next dialog, you can provide details for your selected Instance such as "number of instances" you wish to launch, the "name" of your instance and the desired "size" of it as well.


The new Eucalyptus 3.3 edition supports a whole list of Instance sizes ranging from the smallest "t1.micro" to the largest in terms of CPU, RAM and Disk (hs1.8xlarge). For this tutorial, I selected the smallest m1.micro.


The next thing to do is to provide a suitable "name" for the instance and select the "Availability Zone" in which you wish to launch your instance. You can optionally provide "Instance Tags" for identifying your Instance etc. Once done, select "Security" to continue


Next, select the correct "Key Pair" and "Security Group" that we created in our earlier steps. You can optionally even create them here itself if you wanted to. Once all your setting are done, hit "Launch Instance".


Your instance takes a couple of seconds to start up. You can check the "status" of your Instance in the status column.  


Once your Instance is in the "Launched / Available" state, you can note down its "Public IP" and its "Instance ID". You'll need them to SSH into the instance.


Next, launch a Terminal and traverse to the path where you saved the Key Pair. We need to provide permissions to the Key Pair before we use it to access our Instance.

# chmod 600 <Key_Pair_Name>


To login to your Instance, type in the following command:

# ssh -i <Key_Pair_Name> ec2-user@<Instance_IP>


NOTE: For Eucalyptus made Machine Images, the username is ec2-user. For certain (Eucalyptus Machine Images) EMIs however, the username can be root as well. If you provide the wrong username, you may end up with a "Warning" stating "Please login as the user ec2-user rather than the user root"


Once logged in, you can use this Instance for whatever purpose you want.



Using Euca2ools:
You can alternatively provision an Instance using Eucalyptus Command Line utilities called as Euca2ools as well.
 
The first thing to do, is to list our EMIs. We will be launching our Instances from our EMIs.
 
To list Images, we use "euca-describe-images"
 
Syntax:
euca-describe-images [image_id]
 
Code: 
euca-describe-images i-014C4296
 
To launch an Instance, we use "euca-run-instance"
 
Syntax:
euca-run-instance <image_id> -g <security_group_name> -k <key_pair_name>>
 
Code: 
euca-run-instance emi-0E8B3965 -g TestSecurityGroup -k TestKeyPair
 
First, we list the Images. Note down the Image ID of the default Image created by Eucalyptus. Note that there will be two images listed, select the one which does not have Load Balancer written in it. 
 

Next, we launch the instance using the euca-run-instnaces command as shown below. The instance will take a couple of seconds to come up. Note down the Instance ID to check its status.


Run euca-describe-instances <Instance_id> to see the status of your running instance. Note down the Public IP. We will need it to SSH into the instance.


The rest of the steps remain the same. Use the following command to SSH into your Instance:
 
# ssh -i <Key_Pair_Name> ec2-user@<Instance_IP>

  Thats it to it !! you have now successfully launched your first Eucalyptus Instance!!

In our next tutorial, we will see how to create Volumes (external HDDs) and attach them to our Instances.. so stay tuned for more !!

>> Eucalyptus 3.3 tutorials: Working with Volumes














No comments :

Post a Comment