AWS-specific parameter types reference
AWS-specific parameter types are helpful in catching invalid values at the start of
creating or updating a stack. When you use AWS-specific parameter types, a user who
uses your template to create or update a stack must specify existing AWS 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 AWS Region in which they are creating the stack.
If a user uses the AWS Management Console, CloudFormation prepopulates AWS-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.
To allow template users to enter input values from different AWS accounts, don't
define parameters with AWS-specific types. Define parameters of type
String
or CommaDelimitedList
instead. For more
information, see Parameters.
Supported AWS-specific parameter types
CloudFormation supports the following AWS-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
.
Example
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 Subnets
parameter is specified as a list, a user can specify one or more subnet
IDs.
JSON
{ "Parameters": { "KeyName": { "Description": "Amazon EC2 Key Pair", "Type": "AWS::EC2::KeyPair::KeyName" }, "Subnets": { "Description": "Subnet IDs", "Type": "List<AWS::EC2::Subnet::Id>" } }, "Resources": { "LaunchTemplate": { "Type": "AWS::EC2::LaunchTemplate", "Properties": { "LaunchTemplateName": { "Fn::Sub": "${AWS::StackName}-launch-template" }, "LaunchTemplateData": { "ImageId": "ami-1234567890abcdef0", "InstanceType": "t2.micro", "KeyName": { "Ref": "KeyName" } } } }, "WebServerGroup": { "Type": "AWS::AutoScaling::AutoScalingGroup", "Properties": { "LaunchTemplate": { "LaunchTemplateId": { "Ref": "LaunchTemplate" }, "Version": { "Fn::GetAtt": [ "LaunchTemplate", "LatestVersionNumber" ] } }, "MaxSize": "3", "MinSize": "1", "VPCZoneIdentifier": { "Ref": "Subnets" } } } } }
YAML
Parameters: KeyName: Description: Amazon EC2 Key Pair Type: 'AWS::EC2::KeyPair::KeyName' Subnets: Description: Subnet IDs Type: 'List<AWS::EC2::Subnet::Id>' Resources: LaunchTemplate: Type: AWS::EC2::LaunchTemplate Properties: LaunchTemplateName: !Sub ${AWS::StackName}-launch-template LaunchTemplateData: ImageId: ami-1234567890abcdef0 InstanceType: t2.micro KeyName: !Ref KeyName WebServerGroup: Type: AWS::AutoScaling::AutoScalingGroup Properties: LaunchTemplate: LaunchTemplateId: !Ref LaunchTemplate Version: !GetAtt LaunchTemplate.LatestVersionNumber MaxSize: '3' MinSize: '1' VPCZoneIdentifier: !Ref Subnets