Documenting Problems That Were Difficult To Find The Answer To

Launching EC2 Instance From Command-Line But Can’t Find AMI

I was using the command ec2-run-instances to create an EC2 instance. However I kept getting the following error message:

Client.InvalidAMIID.NotFound: The image id '[ami-xxxxxxxx]' does not exist
Error starting (256):

I couldn’t understand it. I was trying to launch the standard Ubuntu Server 64-bit 12.04.1 instance in eu-west-1 (ami-f2191786) but kept getting the above error. I tried other AMI instances and kept getting the above error.

It wasn’t until I explicitly added the region option to the command line that the launch worked. Given that I was specifying a subnet (VPC) that was specific to the eu-west-1 region it puzzles me that this error was being thrown in the first place. Oh well.

To summarise, make sure you add the following flag to your launch:

--region eu-west-1

.. or whatever your region happens to be for that AMI (AMIs are region-specific but ec2-run-instances cannot deduce your region from other region-specific flags such as --subnet).

Note that the --region flag also needs to be specified to many other commands such as ec2-create-tags and ec2-terminate-instances.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: