CloudFormation + CodePipeline Template Configuration For CLI Tools
CloudFormation + CodePipeline Template Configuration For CLI Tools
Making development closer to production use of CodePipeline
See Limitations section towards the bottom
Supported CLI Tools
aws cloudformation
https://aws.amazon.com/clideploy | create-stack | create-change-set | create-stack-instances | create-stack-set | update-stack | update-stack-instances | update-stack-set
aws serverlessrepo create-cloud-formation-change-set
https://aws.amazon.com/clisam deploy
https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.htmlrain deploy
https://github.com/aws-cloudformation/rainFed up of the following commands all differing in their parameter overrides and tags parameter formats? and them all differing from how CloudFormation Actions in CodePipeline are configured?
Then do one of these:
$ tc aws cloudformation deploy ...
$ tc aws cloudformation create-change-set ...
$ tc sam deploy ...
$ tc rain deploy ...
With a template configuration file template-configuration/default.json
(see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/continuous-delivery-codepipeline-cfn-artifacts.html#w2ab1c21c17c15)
{
"Parameters": {
"Key": "Value"
},
"Tags": {
"TagKey": "TagValue"
},
"StackPolicy": {
"Statement": [
{
"Effect": "Allow",
"NotAction": "Update:Delete",
"Principal": "*",
"Resource": "*"
}
]
}
}
And do away with your flakey non-production-like deploy scripts, and stop
doing these:
$ aws cloudformation deploy \
--parameter-overrides \
Key=Value \
Key2=Value2 \
...
$ aws cloudformation create-change-set \
--parameters \
ParameterKey=Key,ParameterValue=Value \
ParameterKey=Key2,ParameterValue=Value2 \
...
$ sam deploy \
--parameter-overrides \
ParameterKey=Key,ParameterValue=Value \
ParameterKey=Key2,ParameterValue=Value2 \
...
$ rain \
--params \
Key=Value,Key2=Value2
Add the following to your shell rc/profile file to replace aws
, sam
,
and/or rain
with implicit tc
proxying (e.g. ~/.bashrc
, ~/.zshrc
, etc)
aws () { template-configuration "$0" "$@" }
sam () { template-configuration "$0" "$@" }
rain () { template-configuration "$0" "$@" }
Then tc
is implicit and no longer needed
$ aws cloudformation deploy ...
$ aws cloudformation create-change-set ...
$ sam deploy ...
$ rain deploy ...
aws cloudformation deploy ... --profile <profile> --region <region>
aws --profile <profile> --region <region> cloudformation deploy ...
aws cloudformation deploy help
tc --parameters ... [cmd ...]
for 1 single wayUsePreviousValue
tc help --help -h
StackPolicy
for those commands that support it, and maybe doSome arguments can come before the proxied command e.g. tc <here> aws ...
tc init
create a template-configuration/default.json
file, with optional--config
argument--debug
echos out the command that is also ran--dryrun
only echo out the command that would otherwise be ran – implies --debug
--config <configuration-file>
override template-configuration/default.json
with another local file pathtc --config template-configuration/test.json sam deploy ...