Skip to content

Instantly share code, notes, and snippets.

@rvedotrc
Created December 23, 2015 10:29
Show Gist options
  • Save rvedotrc/7374716ccb4e06033d9d to your computer and use it in GitHub Desktop.
Save rvedotrc/7374716ccb4e06033d9d to your computer and use it in GitHub Desktop.
#!/bin/bash
stack_name=$1
if [ "${2:-}" == "--update" ] ; then
aws cloudformation update-stack \
--stack-name $stack_name \
--template-body "$( cat tmp.template.json )" \
--parameters "$( jq '.Stacks[0].Parameters // []' < tmp.describe.json )" \
--capabilities "$( jq '.Stacks[0].Capabilities // []' < tmp.describe.json )" \
--notification-arns "$( jq '.Stacks[0].NotificationARNs // []' < tmp.describe.json )" \
;
rm -i tmp.*.json
exit
fi
aws cloudformation get-template --stack-name $stack_name > tmp.template.json
aws cloudformation describe-stacks --stack-name $stack_name > tmp.describe.json
jq -M --sort-keys .TemplateBody < tmp.template.json > tmp.template.json.2
mv tmp.template.json.2 tmp.template.json
vim tmp.*.json
echo Now run vim-stack "$@" --update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment