0 votes
1 view
in AWS by (19.2k points)

Is there a way to look up the region of an instance from within the instance?

1 Answer

0 votes
by (44.6k points)

Use this:

EC2_AVAIL_ZONE=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone`

EC2_REGION="`echo \"$EC2_AVAIL_ZONE\" | sed 's/[a-z]$//'`"

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...