AWS CloudFormation
User Guide (API Version 2010-05-15)

Adding Input Parameters to Your Template

You can configure your templates to require input parameters by adding them to the Parameters section. Each parameter you add must contain a value at runtime. You can specify a default value for each parameter to make the parameter optional. If you do not specify a default value, you must provide a value for that parameter when you create the stack.

A parameter can be declared as a String, Number, CommaDelimitedList, or AWS-specific type. The String, Number, and AWS-specific types can have constraints that AWS CloudFormation uses to validate the value of the parameter. For more information about parameter constraints, see Parameters.

The following sample configures a single parameter, Email:

"Parameters" : {
    "Email" : {
        "Type" : "String"

The parameter has no default, so you must provide a value to create the stack. After you create the CloudWatch Alarms stack with a value for Email, the aws cloudformation describe-stacks command returns the following:

STACK  myAlarms
arn:aws:aws cloudformation:us-east-1:165024647323:stack/f5b4cbb0-24d7-11e0-93a-508be05d086/myAlarms  2011-01-20T20:57:57Z  CREATE_COMPLETE
User Initiated  false  Instance=i-0723826b

You can configure the parameter to not display with the NoEcho parameter:

"Parameters" : {
    "Email" : {
        "Type" : "String",
        "NoEcho" : "TRUE"

Here's the output from a stack created with the same template, but with the NoEcho set to TRUE:

STACK  myAlarms2
arn:aws:aws cloudformation:us-east-1:165024647323:stack/ff6ff540-24db-11e0-94f8-5081b017c4b/myAlarms2
Email=******  2011-01-20T21:26:52Z  CREATE_COMPLETE  User Initiated
false  Instance=i-f734959b

The value for Email is masked with asterisks.

To supply the values for parameters, you include the --parameters option to the aws cloudformation create-stack command.

For example, the following command adds a value for the UserName and Password parameters:

PROMPT> aws cloudformation create-stack --stack-name MyStack --template-body file:///home/local/test/sampletemplate.json
--parameters ParameterKey=UserName,ParameterValue=Joe ParameterKey=Password,ParameterValue=JoesPw

Parameters are separated with a space. Note that parameter names are case sensitive. If you mistype the parameter name when you run aws cloudformation create-stack, AWS CloudFormation will not create the stack, and will report that the template doesn't contain the parameter.

Validate AWS-Specific Values

For some AWS values, such as Amazon EC2 key pair names and VPC IDs, you can use AWS-specific parameter types to validate input parameter values against existing values in users' AWS accounts. For example, you can use the AWS::EC2::KeyPair::KeyName parameter type to ensure that users specify a valid key pair name before AWS CloudFormation creates or updates any resources. AWS-specific parameter types are helpful in catching invalid values early. For more information, see Parameters.