Skip to content

Instantly share code, notes, and snippets.

@nmrmsys
Last active April 26, 2016 13:43
Show Gist options
  • Save nmrmsys/cf3d4dc7c0dcccd03c2e1fbc5912bc90 to your computer and use it in GitHub Desktop.
Save nmrmsys/cf3d4dc7c0dcccd03c2e1fbc5912bc90 to your computer and use it in GitHub Desktop.
aws ec2 describe-instances \
| jq -r '.Reservations[].Instances[] | select(.State.Name == "stopped") | [ .InstanceId, (.Tags[]? | select(.Key == "Name")).Value ] | @sh' \
| awk '{ print "echo Instance Starting... " $1 " " $2 "; aws ec2 start-instances --instance-ids " $1 }' | sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment