Created
April 19, 2021 12:04
-
-
Save MichaelScovell/4c7d45e9afb774f15b2097484980b104 to your computer and use it in GitHub Desktop.
restore-metadata.sh
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 | |
# Script that will restore the metadata for the given instance. | |
#Create variable for instance ID | |
instanceID=$1 | |
#Check to ensure that the instance is not blank | |
if [[ -n $instanceID ]]; | |
then | |
#Restore Metadata | |
aws ec2 modify-instance-metadata-options \ | |
--instance-id ${instanceID} \ | |
--http-tokens optional \ | |
--http-endpoint enabled | |
else | |
#Return this message and exit the script | |
echo "The instanceID is blank. Please try passing in the ID when running the script" | |
exit | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment