[ aws . cloudformation ]
Deploys the specified AWS CloudFormation template by creating and then executing
a change set. The command terminates after AWS CloudFormation executes the
change set. If you want to view the change set before AWS CloudFormation
executes it, use the --no-execute-changeset
flag.
To update a stack, specify the name of an existing stack. To create a new stack, specify a new stack name.
See ‘aws help’ for descriptions of global parameters.
deploy
--template-file <value>
--stack-name <value>
[--s3-bucket <value>]
[--force-upload]
[--s3-prefix <value>]
[--kms-key-id <value>]
[--parameter-overrides <value> [<value>...]]
[--capabilities <value> [<value>...]]
[--no-execute-changeset]
[--role-arn <value>]
[--notification-arns <value> [<value>...]]
[--fail-on-empty-changeset | --no-fail-on-empty-changeset]
[--tags <value> [<value>...]]
--template-file
(string)
The path where your AWS CloudFormation template is located.
--stack-name
(string)
The name of the AWS CloudFormation stack you’re deploying to. If you specify an existing stack, the command updates the stack. If you specify a new stack, the command creates it.
--s3-bucket
(string)
The name of the S3 bucket where this command uploads your CloudFormation template. This is required the deployments of templates sized greater than 51,200 bytes
--force-upload
(boolean)
Indicates whether to override existing files in the S3 bucket. Specify this flag to upload artifacts even if they match existing artifacts in the S3 bucket.
--s3-prefix
(string)
A prefix name that the command adds to the artifacts’ name when it uploads them to the S3 bucket. The prefix name is a path name (folder name) for the S3 bucket.
--kms-key-id
(string)
The ID of an AWS KMS key that the command uses to encrypt artifacts that are at rest in the S3 bucket.
--parameter-overrides
(string)
A list of parameter structures that specify input parameters for your stack template. If you’re updating a stack and you don’t specify a parameter, the command uses the stack’s existing value. For new stacks, you must specify parameters that don’t have a default value. Syntax: ParameterKey1=ParameterValue1 ParameterKey2=ParameterValue2 … or JSON file (see Examples)
--capabilities
(list)
A list of capabilities that you must specify before AWS Cloudformation can create certain stacks. Some stack templates might include resources that can affect permissions in your AWS account, for example, by creating new AWS Identity and Access Management (IAM) users. For those stacks, you must explicitly acknowledge their capabilities by specifying this parameter. The only valid values are CAPABILITY_IAM and CAPABILITY_NAMED_IAM. If you have IAM resources, you can specify either capability. If you have IAM resources with custom names, you must specify CAPABILITY_NAMED_IAM. If you don’t specify this parameter, this action returns an InsufficientCapabilities error.(string)
Syntax:
"string" "string" ...
Where valid values are:
CAPABILITY_IAM
CAPABILITY_NAMED_IAM
--no-execute-changeset
(boolean)
Indicates whether to execute the change set. Specify this flag if you want to view your stack changes before executing the change set. The command creates an AWS CloudFormation change set and then exits without executing the change set. After you view the change set, execute it to implement your changes.
--role-arn
(string)
The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) role that AWS CloudFormation assumes when executing the change set.
--notification-arns
(list)
Amazon Simple Notification Service topic Amazon Resource Names (ARNs) that AWS CloudFormation associates with the stack.(string)
Syntax:
"string" "string" ...
--fail-on-empty-changeset
| --no-fail-on-empty-changeset
(boolean)
Specify if the CLI should return a non-zero exit code if there are no changes to be made to the stack. The default behavior is to return a zero exit code.
--tags
(list)
A list of tags to associate with the stack that is created or updated. AWS CloudFormation also propagates these tags to resources in the stack if the resource supports it. Syntax: TagKey1=TagValue1 TagKey2=TagValue2 …(string)
Syntax:
"string" "string" ...
See ‘aws help’ for descriptions of global parameters.
Following command deploys template named template.json
to a stack named
my-new-stack
:
aws cloudformation deploy --template-file /path_to_template/template.json --stack-name my-new-stack --parameter-overrides Key1=Value1 Key2=Value2 --tags Key1=Value1 Key2=Value2
or the same command using parameters from JSON file parameters.json
:
aws cloudformation deploy --template-file /path_to_template/template.json --stack-name my-new-stack --parameter-overrides file://path_to_parameters/parameters.json --tags Key1=Value1 Key2=Value2
Original format:
[
"Key1=Value1",
"Key2=Value2"
]
CloudFormation like format:
[
{
"ParameterKey": "Key1",
"ParameterValue": "Value1"
},
{
"ParameterKey": "Key2",
"ParameterValue": "Value2"
}
]
Note
Only ParameterKey and ParameterValue are expected keys, command will throw an exception if receives unexpected keys (e.g. UsePreviousValue or ResolvedValue).
CodePipeline like format:
[
"Parameters": {
"Key1": "Value1",
"Key2": "Value2"
}
]