Is there a way to get the region an EC2 is running in using Node?
var region = ??? if(region == 'us-west-1') console.log("I'm in us-west-1");
The closest you're going to get is picking up the availability zone from the ec2 instance metadata:
Full guide here:
You can get the region from the zone by removing the last char from the az. you can also future proof it by doing it as described here: