Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # start or stop
- CMD=$1
- INSTANCES_LIST=instances.txt
- # list all instance-ids
- aws ec2 describe-instances | jq '.Reservations[].Instances[].InstanceId' > $INSTANCES_LIST
- # stop all instances
- INSTANCE_IDS=`tr '¥n' ' ' < $INSTANCES_LIST | sed s/\"//g`
- aws ec2 $CMD-instances --instance-ids $INSTANCE_IDS
- rm -f $INSTANCES_LIST
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement