Created
November 13, 2019 13:14
-
-
Save pcolazurdo/a17bf6a065c1384a06fc14d2499eb48f to your computer and use it in GitHub Desktop.
Set AWS REGION from Metadata Service
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
#!/bin/bash | |
export AWS_AVAILABILITY_ZONE=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone) | |
export AWS_REGION=${AWS_AVAILABILITY_ZONE%?} | |
# From http://tldp.org/LDP/abs/html/string-manipulation.html : | |
# ${string%substring} | |
# Deletes shortest match of $substring from back of $string. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment