Amazon-specific parameter types
Amazon-specific parameter types are helpful in catching invalid values at the start of
creating or updating a stack. When you use Amazon-specific parameter types, a user who uses
your template to create or update a stack must specify existing Amazon values that are in the
user's account and in the region for the current stack. CloudFormation validates these input
values against existing values in the account. For example, with the
AWS::EC2::VPC::Id
parameter type, a user must enter an existing VPC ID that's
in the account and Amazon Web Services Region in which they are creating the stack.
If a user uses the Amazon Web Services Management Console, CloudFormation prepopulates Amazon-specific parameter types with valid values. That way the user doesn't have to remember and correctly enter a specific name or ID. They would just select one or more values from a drop-down list. Also, depending on the parameter type, users can search for values by ID, name, or Name tag value. For more information, see Specifying stack name and parameters.
To allow template users to enter input values from different Amazon Web Services accounts, don't define
parameters with Amazon-specific types. Define parameters of type String
or
CommaDelimitedList
instead. For more information, see Parameters.
Supported Amazon-specific parameter types
CloudFormation supports the following Amazon-specific types:
AWS::EC2::AvailabilityZone::Name
-
An Availability Zone, such as
us-west-2a
. AWS::EC2::Image::Id
-
An Amazon EC2 image ID, such as
ami-0ff8a91507f77f867
. Note that the CloudFormation console doesn't show a drop-down list of values for this parameter type. AWS::EC2::Instance::Id
-
An Amazon EC2 instance ID, such as
i-1e731a32
. AWS::EC2::KeyPair::KeyName
-
An Amazon EC2 key pair name.
AWS::EC2::SecurityGroup::GroupName
-
A default VPC security group name, such as
my-sg-abc
. AWS::EC2::SecurityGroup::Id
-
A security group ID, such as
sg-a123fd85
. AWS::EC2::Subnet::Id
-
A subnet ID, such as
subnet-123a351e
. AWS::EC2::Volume::Id
-
An Amazon EBS volume ID, such as
vol-3cdd3f56
. AWS::EC2::VPC::Id
-
A VPC ID, such as
vpc-a123baa3
. AWS::Route53::HostedZone::Id
-
An Amazon Route 53 hosted zone ID, such as
Z23YXV4OVPL04A
. List<AWS::EC2::AvailabilityZone::Name>
-
An array of Availability Zones for a region, such as
us-west-2a, us-west-2b
. List<AWS::EC2::Image::Id>
-
An array of Amazon EC2 image IDs, such as
ami-0ff8a91507f77f867, ami-0a584ac55a7631c0c
. Note that the CloudFormation console doesn't show a drop-down list of values for this parameter type. List<AWS::EC2::Instance::Id>
-
An array of Amazon EC2 instance IDs, such as
i-1e731a32, i-1e731a34
. List<AWS::EC2::SecurityGroup::GroupName>
-
An array of default VPC security group names, such as
my-sg-abc, my-sg-def
. List<AWS::EC2::SecurityGroup::Id>
-
An array of security group IDs, such as
sg-a123fd85, sg-b456fd85
. List<AWS::EC2::Subnet::Id>
-
An array of subnet IDs, such as
subnet-123a351e, subnet-456b351e
. List<AWS::EC2::Volume::Id>
-
An array of Amazon EBS volume IDs, such as
vol-3cdd3f56, vol-4cdd3f56
. List<AWS::EC2::VPC::Id>
-
An array of VPC IDs, such as
vpc-a123baa3, vpc-b456baa3
. List<AWS::Route53::HostedZone::Id>
-
An array of Amazon Route 53 hosted zone IDs, such as
Z23YXV4OVPL04A, Z23YXV4OVPL04B
.
Examples
Topics
Parameter declaration
The following example declares two parameters with the types
AWS::EC2::KeyPair::KeyName
and AWS::EC2::Subnet::Id
. These
types limit valid values to existing key pair names and subnet IDs. Because the
mySubnetIDs
parameter is specified as a list, a user can specify one or
more subnet IDs.
JSON
"Parameters" : { "myKeyPair" : { "Description" : "Amazon EC2 Key Pair", "Type" : "AWS::EC2::KeyPair::KeyName" }, "mySubnetIDs" : { "Description" : "Subnet IDs", "Type" : "List<AWS::EC2::Subnet::Id>" } }
YAML
Parameters: myKeyPair: Description: Amazon EC2 Key Pair Type: "AWS::EC2::KeyPair::KeyName" mySubnetIDs: Description: Subnet IDs Type: "List<AWS::EC2::Subnet::Id>"