Given these parameters:
- An Ubuntu instance running anywhere (any region and any availability zone in that region)
- Only the AWS PHP SDK2 installed on the instance (no other EC2 Command line tools, etc.)
- CURL and WGET available
What is the most elegant way for an instance script to explicitly determine what Region it is running in?
* **Instance ID:** wget -q -O - http://169.254.169.254/latest/meta-data/instance-id
* **Availability Zone:** wget -q -O - http://169.254.169.254/latest/meta-data/placement/availability-zone
The meta-data does not currently provide this information.
We are aware that currently, the trailing character can be stripped off the availability zone in order to naively determine the Region, however, there is no guarantee that Amazon will not change that in the future.
The ultimate goal is that our cron jobs and other custom services can figure out who and where they are, so that they can interact with other services and instances appropriately.