Created
May 14, 2019 15:48
-
-
Save sklarsa/33a769b611cc2020cc90bcc2d794128e to your computer and use it in GitHub Desktop.
Terminate current AWS instance
This file contains hidden or 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
terminate_current_instance() { | |
instance_id=`curl http://169.254.169.254/latest/meta-data/instance-id` | |
az=`curl http://169.254.169.254/latest/meta-data/placement/availability-zone` | |
region=`echo ${az::-1}` | |
aws ec2 terminate-instances --instance-ids $instance_id --region $region | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment