Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. 0 0 * * * sudo /sbin/shutdown -h now
  2.  
  3. #!/bin/bash
  4.  
  5. instance_id=$(aws ec2 describe-instances --filters
  6. "Name=tag:Name,Values=${1}"
  7. | jq --raw-output .Reservations[].Instances[].InstanceId)
  8. echo "Found instance_id = ${instance_id}"
  9. aws ec2 stop-instances --instance-ids "$instance_id"
  10. aws ec2 wait instance-stopped --instance-ids "$instance_id"
  11. echo "Instance stopped."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement