Last active
July 11, 2018 08:32
-
-
Save shaiesto/d8644c2105a5c430e432ae45b6d48762 to your computer and use it in GitHub Desktop.
aws ec2:disable termination protection on all stopped instances
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for i in $(aws ec2 describe-instances --query 'Reservations[?Instances.State.Name=='stopped'].Instances[].[InstanceId]' --output text); do | |
aws ec2 modify-instance-attribute --no-disable-api-termination --instance-id $i --dry-run | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment