Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. # This stupid simple function exists to make it more obvious when a Cloudformation stack is finished doing its thing.
  2. # I'm barely proficient with bash so if there's a better way to do stuff let me know. This is my life's work so I'll definitely be responsive and update this immediately.
  3. # Usage: cfnw [command] <stack_name>
  4. # Default command is c = create, d = delete and u = update are also available
  5.  
  6. cfnw() {
  7. declare -A commands
  8. commands=(["c"]="create" ["d"]="delete" ["u"]="update")
  9. [[ $# = 2 ]] && command="${commands[$1]}" || command="create"
  10. [[ $# = 2 ]] && stack=$2 || stack=$1
  11. echo "Checking to see if $command is done for stack $stack"
  12. output=$((aws cloudformation wait stack-$command-complete --stack-name $stack) 2>&1)
  13. if [[ $output == *"failed"* ]]; then
  14. cowsay $stack $command 'failed!'
  15. else
  16. cowsay $stack $command 'done!'
  17. fi
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement