0
votes

I like to create an AWS Cloud Formation stack by choosing available AMI's in the region(I know AMI's are region specific). I was able to specify a default AMI in the template's "parameters" field, but i have to list down available AMI's in that region, then i need to choose one AMI and create the stack from the cloud formation console. I hard coded them like this in parameter field

"AMI" : {
        "Description" : "Your AMI ID.",
        "Type" : "String",
        "Default" : "ami-146e2a7c",
        "AllowedValues" : [ "ami-146e2a7c", "ami-a8d369c0", "ami-aeb532c6" ],
        "ConstraintDescription" : "must be a Free AMI."
},    

this works, But I need all the available ami's from a specific region.

1

1 Answers

0
votes

This is not possible unless you're generating the cfn template with troposphere or a templating engine. I highly recommend that (though you may find filtering this call challenging: http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeImages.html).

The dropdown types (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html) are the limited to the following:

  • AWS::EC2::KeyPair::KeyName (An Amazon EC2 key pair name)
  • AWS::EC2::SecurityGroup::Id (A security group ID)
  • AWS::EC2::Subnet::Id (A subnet ID)
  • AWS::EC2::VPC::Id (A VPC ID)
  • List (An array of VPC IDs)
  • List (An array of security group IDs)
  • List (An array of subnet IDs)