jq

Find EC2 region an instance resides in

Quite often you'll find yourself needing to know the region your instance resides in. I've seen this done a couple of ways: $ curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone | sed -e 's/\([1-9]\).$/\1/g' This is pretty ugly, so I prefer to use this method…