Skip to content

Instantly share code, notes, and snippets.

@tkhk
Created February 27, 2019 10:11
Show Gist options
  • Save tkhk/e9ae10cf5c2082a084c4c35f91eacb4c to your computer and use it in GitHub Desktop.
Save tkhk/e9ae10cf5c2082a084c4c35f91eacb4c to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ $# -ne 1 ]; then
echo "ERROR: Need profile name"
exit 1
fi
profile_name=$1
stack_name=$(aws cloudformation list-stacks --profile ${profile_name} --region ap-northeast-1 \
| jq -r '.StackSummaries[] | .StackName + "\t" + .StackStatus' \
| fzf \
| awk '$0=$1')
[ -n "$stack_name" ] && aws cloudformation get-template \
--stack-name ${stack_name} \
--profile ${profile_name} \
--region ap-northeast-1 \
| jq -r ".TemplateBody"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment