Advertisement
Guest User

Untitled

a guest
May 27th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Note that this requires the really cool command-line tool 'jq'
  4. #
  5.  
  6. if [ -z "$1" ]; then
  7. echo "as_kill_instances [group]"
  8. exit -1
  9. fi
  10.  
  11. instances=$(aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names $1 | jq -r .AutoScalingGroups[0].Instances[].InstanceId )
  12.  
  13. for instance in $instances ; do
  14. aws autoscaling terminate-instance-in-auto-scaling-group \
  15. --instance-id $instance \
  16. --no-should-decrement-desired-capacity
  17. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement