Skip to content

Instantly share code, notes, and snippets.

@xhiroga
Created November 3, 2018 22:46
Show Gist options
  • Save xhiroga/b414e2fc68a2382c54618d6467e7d118 to your computer and use it in GitHub Desktop.
Save xhiroga/b414e2fc68a2382c54618d6467e7d118 to your computer and use it in GitHub Desktop.
CloudFomationの勉強を円滑にするための便利スクリプト
cmd=$1
stack_name=$2
if [ $cmd = "create" ]; then
case $3 in
"") echo "Error: Please give a template file path!"; exit 0;;
/*) absolute=$3 ;;
*) absolute=$PWD/$3 ;;
# S3にはこれから対応する、かも
esac
aws cloudformation create-stack --stack-name $stack_name --template-body file://$absolute
elif [ $cmd = "delete" ]; then
aws cloudformation delete-stack --stack-name $stack_name
elif [ $cmd = "status" ]; then
aws cloudformation describe-stacks --stack-name $stack_name | jq .Stacks[] | jq '.StackId, .StackStatus'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment