Pregunta

The ec2-run-instances command needs an AMI ID and the ID is different across all regions. Is there any way to specify that I need an AMI that will be suitable for region x / zone y and instance_type z?

In other words I need a way to use some "default" AMI so that I can write a script that will work across all EC2 regions.

¿Fue útil?

Solución

There is nothing like a default AMI for Amazon EC2, and no concept of selecting a default (or rather the region specific) AMI amongst the otherwise identical AMIs with different IDs per region either (a region independent AMI ID would be a nifty improvement though).

This is usually solved by adding a respective mapping to your script, thus depends on the scripting environment in use (a simple map should always be available somehow) - e.g. AWS CloudFormation uses the very same approach itself, see the sample EC2ChooseAMI.template, which is an example of using Mappings to select an AMI based on region and instance type.

The AWSRegionArch2AMI map achieves what you desire, plus offering a choice of architecture as well (which implies a hint why a default AMI ID could not be as easy to implement then it might look at fist sight).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top