Using EC2 – Getting Started Guide example

Get setup to use EC2 (detailed in a prior post).

Find the AMI you want to run: List AMIs.  Find ec2-public-images/getting-started.manifest.xml and note it’s AMI number from column 2:

ec2-describe-images -o self -o amazon

...snip...
IMAGE	ami-2bb65342	ec2-public-images/getting-started.manifest.xml	amazon	available	public		i386	machine
...snip...

Create an ssh keypair that will be used to access it:

ec2-add-keypair gsg-keypair

Save key to id_rsa-gsg-keypair

Create an instance of that type that will be accessed using that keypair:

ec2-run-instances ami-2bb65342 -k gsg-keypair

RESERVATION	r-22f4254b	337706654870	default
INSTANCE	i-6b14b302	ami-2bb65342			pending	gsg-keypair	0		m1.small	2008-09-10T01:54:13+0000

Keep checking it until it’s status changes from pending to running:

ec2-describe-instances i-6b14b302

INSTANCE	i-6b14b302	ami-2bb65342	ec2-75-101-211-91.compute-1.amazonaws.com	ip-10-250-13-176.ec2.internal	running	gsg-keypair	0		m1.small	2008-09-10T01:54:13+0000	us-east-1b

Allow SSH and HTTP access to instances in your default group:

ec2-authorize default -p 22
ec2-authorize default -p 80

Login to your instance:

ssh -i Keys/aws/ec2/id_rsa-gsg-keypair root@root@ec2-75-101-211-91.compute-1.amazonaws.com

To tear it down:

ec2-terminate-instances i-6b14b302

The instances hang around in the output of ec2-describe-instances for quite some time, in state terminated. After I went to the store and came back, they were gone.

You must be logged in to post a comment.