Configure parameters for a CloudFormation template

Parameters let you create templates that can be customized for each stack deployment. When creating a stack from a template that contains parameters, you can specify values for the parameters.

Before you begin

Role required: cloud_admin or admin

About this task

If you specified a JSON template that contains parameters, the template parameters appear on the CloudFormation Template Parameters tab and the variable set appears in the CloudFormation Variable Set for Template Parameter tab.

The following example shows the KeyPairName and InstanceType parameters:

"Parameters" : {
    "KeyPairName": {
      "Description" : "Name of an existing Amazon EC2 key pair for RDP access",
      "Type": "String",
    },
    "InstanceType": {
      "Description" : "Amazon EC2 instance type",
      "Type": "String",
    }
}

Procedure

Each parameter name must be alphanumeric and unique among the parameters in the template. You can declare a parameter as any of the following data types:
Note: An error message appears if you attempt to submit a template with an invalid parameter type.
OptionDescription
Data Type Description
String String of numbers or letters.
Number An integer. If you use the parameter elsewhere in the template, then the parameter value becomes a string.
List<Number> An array of integers that are separated by commas. If you use the parameter elsewhere in the template, the parameter values becomes a list of strings.
CommaDelimitedList An array of strings that are separated by commas.
AWS::EC2::KeyPair::KeyName (AWS-specific data type) An Amazon EC2 key pair name.
AWS::EC2::SecurityGroup::Id (AWS-specific data type) A security group ID number.
AWS::EC2::Subnet::Id (AWS-specific data type) A subnet ID number.
AWS::EC2::VPC::Id(AWS-specific data type) A VPC ID number.
List<AWS::EC2::VPC::Id> (AWS-specific data type) An array of VPC ID numbers.
List<AWS::EC2::SecurityGroup::Id> (AWS-specific data type) An array of security group ID numbers.
List<AWS::EC2::Subnet::Id> (AWS-specific data type) An array of subnet ID numbers.