Skip to content

Instantly share code, notes, and snippets.

@hatchcanon
Created April 15, 2021 15:44
Show Gist options
  • Save hatchcanon/2721561633549036c8afb4701612d666 to your computer and use it in GitHub Desktop.
Save hatchcanon/2721561633549036c8afb4701612d666 to your computer and use it in GitHub Desktop.
termination protection list generator
#!/bin/bash
for instance in $(aws ec2 describe-instances --region us-east-1 | grep InstanceId | cut -d '"' -f 4 | sort); do
echo -n $instance
aws ec2 describe-instance-attribute --instance-id $instance --attribute disableApiTermination | grep Value | cut -d : -f 2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment