Hacker News new | ask | show | jobs
by SteveGoob 1505 days ago
Programmatically determining the region of an AWS EC2 instance using the metadata API was very annoying in the past; there was no endpoint for it. Instead, devs used many methods to determine the region[1], primarily by dropping the last letter off of the availability zone, (e.g. `us-east-1a` -> `us-east-1`) which was queriable.

At this point, AWS has updated the API to allow querying for the region as one would expect. See my answer on the afore-footnoted question[2].

[1] The number and variety of answers on the topic is both hilarious and terrifying: https://stackoverflow.com/q/4249488

[2] https://stackoverflow.com/a/62664161