This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Instance Tasks

Instance Tasks

This section describes the tasks you can perform with instances in Eucalyptus.

1 - Authorize Security Groups

Before you can log in to an instance, you must authorize access to that instance. This done by configuring a security group for that instance.

A security group is a set of networking rules applied to instances associated with a group. When you first create an instance, it is assigned to a default security group that denies incoming network traffic from all sources. To allow login and usage of a new instance, you must authorize network access to the default security group with the euca-authorize command.

To authorize a security group, use euca-authorize with the name of the security group, and the options of the network rules you want to apply.

euca-authorize <security_group>

Use the following command to grant unlimited network access using SSH (TCP, port 22) and VNC (TCP, ports 5900 to 5910) to the security group default :

euca-authorize -P tcp -p 22 -s 0.0.0.0/0 default
euca-authorize -P tcp -p 5900-5910 -s 0.0.0.0/0 default

2 - Create Key Pairs

Eucalyptus uses cryptographic key pairs to verify access to instances. Key pairs are used if you want to connect to your instance using SSH. Creating a key pair generates two keys: a public key (saved within Eucalyptus) and a corresponding private key (output to the user as a character string). To enable this private key you must save it to a file and set appropriate access permissions (using the chmod command), as shown in the example below.

Create Key Pairs with the Console

From the main dashboard screen, click the Key Pairs icon. The Key Pairs page opens. Click the Create Key Pair button. The Create new key pair window opens. Type a name for the new key pair into the Name text box. The name may contain up to 255 alphanumeric and special characters. Click the Create and Download button. The private half of the key pair (.pem file) is saved to the default download location for your browser.

Change file permissions to enable access to the private key file in the local directory. For example, on a Linux or Mac OS X system:

chmod 0600 <keypair_name>.private

Create Key Pairs with the Command Line

Enter the following command:

euca-create-keypair <keypair_name> -f <keypair_name>.private

where <keypair_name> is a unique name for your keypair. For example:

euca-create-keypair alice-keypair -f alice-keypair.private 

The private key is saved to a file in your local directory. Query the system to view the public key:

euca-describe-keypairs

The command returns output similar to the following:

KEYPAIR alice-keypair ad:0d:fc:6a:00:a7:e7:b2:bc:67:8e:31:12:22:c1:8a:77:8c:f9:c4

3 - Find an Image

To find an image:

Enter the following command:

euca-describe-images

The output displays all available images.

IMAGE	emi-EC1410C1	centos-32/centos.5-3.x86.img.manifest.xml ↵
admin	available	public 	x86_64	machine
IMAGE	eki-822C1344	kernel-i386/vmlinuz-2.6.28-11-server.manifest.xml ↵
admin	available	public 	x86_64	kernel
IMAGE	eri-A98C13E4  initrd-64/initrd.img-2.6.28-11-generic.manifest.xml ↵
admin	available	public 	x86_64	ramdisk

Look for the image ID in the second column and write it down. The image ID starts with emi- . Once you find a suitable image to use, make sure you have a keypair to use.

4 - Launch an Instance

To launch an instance:

Use the euca-run-instances command and provide an image ID and the user data file, in the format euca-run-instances <image_id> . For example:

euca-run-instances emi-EC1410C1 

For additional details and options that can be used with the euca-run-instances command. Enter the following command to get the launch status of the instance:

euca-describe-instances <instance_id>

Need response from Eucalyptus then uncomment the para below.

5 - Log in to an Instance

For a Linux Instance

When you create an instance, Eucalyptus assigns the instance two IP addresses: a public IP address and a private IP address. The public IP address provides access to the instance from external network sources; the private IP address provides access to the instance from within the Eucalyptus cloud environment. Note that the two IP addresses may be the same depending on the current networking mode set by the administrator. For more information on Eucalyptus networking modes, see the Eucalyptus Administrator’s Guide.

To use an instance you must log into it via ssh using one of the IP addresses assigned to it. You can obtain the instance’s IP addresses using the euca-describe-instances query as shown in the following example.

To log into a VM instance:

Enter the following command to view the IP addresses of your instance:

euca-describe-instances

Eucalyptus returns output similar to the following:

RESERVATION	r-338206B5	alice	default
INSTANCE	i-4DCF092C  emi-EC1410C1  192.168.7.24	  10.17.0.130 ↵ running 	alice-keypair 	0 	m1.small  2010-03-15T21:57:45.134Z

Note that the public IP address appears after the image name, with the private address immediately following.

Look for the instance ID in the second field and write it down. Use this ID to manipulate and terminate this instance.

Use SSH to log into the instance, using your private key and the external IP address. For example:

ssh -i alice-keypair.private root@192.168.7.24 

You are now logged in to your Linux instance.

Using SSH to Connect via PuTTY

If you are a Windows user and want to securely connect to instances via PuTTY, you must first have a key pair.If you don’t have a key pair, you can create one through the Management Console or the command line. For the key pair to be used with PuTTY, convert your .pem file to a .ppk file by performing the last step in the Creating SSH Credentials for the Master Node: Modify Your PEM File procedure.

6 - Reboot an Instance

Rebooting preserves the root filesystem of an instance across restarts. To reboot an instance:

Enter the following command:

euca-reboot-instances <instance_id>

To reboot the instance i-34523332 , enter:

euca-reboot-instances i-34523332

7 - Terminate an Instance

The euca-terminate-instances command lets you cancel running VM instances. When you terminate instances, you must specify the ID string of the instance(s) you wish to terminate. You can obtain the ID strings of your instances using the euca-describe-instances command.

To terminate VM instances:

Enter euca-describe instances to obtain the ID of the instances you wish to terminate. Note that an instance ID strings begin with the prefix i- followed by an 8-character string:

euca-describe-instances
RESERVATION	r-338206B5	alice	default
INSTANCE	i-4DCF092C  emi-EC1410C1	192.168.7.24	10.17.0.130 ↵
running 	mykey 	0 	m1.small 	2010-03-15T21:57:45.134Z ↵
wind 	eki-822C1344 	eri-BFA91429

Enter euca-terminate-instances and the ID string(s) of the instance(s) you wish to terminate:

euca-terminate-instances i-4DCF092C
 INSTANCE	i-3ED007C8