Advertisement
Guest User

Untitled

a guest
May 29th, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # start or stop
  4. CMD=$1
  5.  
  6. INSTANCES_LIST=instances.txt
  7.  
  8. # list all instance-ids
  9. aws ec2 describe-instances | jq '.Reservations[].Instances[].InstanceId' > $INSTANCES_LIST
  10.  
  11. # stop all instances
  12. INSTANCE_IDS=`tr '¥n' ' ' < $INSTANCES_LIST | sed s/\"//g`
  13. aws ec2 $CMD-instances --instance-ids $INSTANCE_IDS
  14.  
  15. rm -f $INSTANCES_LIST
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement