Created
March 12, 2024 13:56
Revisions
-
faermanj created this gist
Mar 12, 2024 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ #!/usr/bin/env bash set -ex # This script is used by the bastion host to stop itself # TOKEN=$(curl -s \ -X PUT "http://169.254.169.254/latest/api/token" \ -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") ID=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" \ -s http://169.254.169.254/latest/meta-data/instance-id) aws ec2 stop-instances --instance-id $ID init 0 echo "instance [$ID] stopping"