Created
May 14, 2018 02:21
-
-
Save fedekau/958b7cdd0bef276ea4a9f1487c7cdc0f to your computer and use it in GitHub Desktop.
Self destructing AWS EC2 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
function self_destruct_command() { | |
cat <<-EOF | |
ec2-terminate-instances \ | |
--aws-access-key $AWS_ACCESS_KEY \ | |
--aws-secret-key $AWS_SECRET_KEY \ | |
$(curl -s http://169.254.169.254/latest/meta-data/instance-id) | |
EOF | |
} | |
self_destruct_command | at now + 30 minutes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment