Skip to content
rzzzwilson edited this page Jun 27, 2011 · 2 revisions

Running an image

After setting up authentication, etc., you are ready to run an image.

You specify which image to run by supplying an ami-XXXXXXXX ID. You find IDs of existing images by doing:

$ euca-describe-images

which lists images publicly available. You can make your own image (see here) later, but first you must run an existing image.

$ euca-run-instances ami-0000001a -k testkey -t c1.large

To see if the image is running, do:

$ euca-describe-instances
RESERVATION	r-0ijrbqbr	tsudat	default
INSTANCE	i-00000060	ami-0000001a	192.168.1.9	192.168.1.9	running	testkey	0		m1.large	2011-06-09T06:45:47Z	nova	

the output shows the image as running. It could take one or more minutes to get to running status.

Allow access to instance

Now authorise network access to the instance and allocate its IP:

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

This probably only needs to be done once for a group.

Move to the running instance

Before you can access the running instance you must associate a public IP to the instance.

This shows how you can list the public IPs allocated to your account:

$ euca-describe-addresses
ADDRESS	192.43.239.143	
ADDRESS	192.43.239.146	
ADDRESS	192.43.239.149

Check the listed IPs for one that is free (ie, not used by any running instance).

If you don't have any free IPs, you can get another by:

$ euca-allocate-address
ADDRESS	192.43.239.144

Once you have an IP, associate it with the running instance:

$ euca-associate-address -i i-00000060 192.43.239.146

You will see the public IP now being used by the instance:

$ euca-describe-instances
RESERVATION	r-0ijrbqbr	tsudat	default
INSTANCE	i-00000060	ami-0000001a	192.43.239.146	192.168.1.9	running	testkey	0		m1.large	2011-06-09T06:45:47Z	nova	

Now ssh to the running instance:

$ ssh -i /home/tsudat/.nova/testkey.private [email protected]

Terminating a running instance

To terminate a running instance, do:

$ euca-terminate-instances  i-00000060
INSTANCE	i-00000060
$ euca-describe-instances
$

The final euca-describe-instances command will either show nothing for that instance (ie, above) or will show the instance shutting down.

Releasing allocated IPs

After you have allocated a few public IPs, you may decide to return some IPs to the system. You do this by:

$ euca-release-address 192.43.239.146