aws

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…

SSH to an EC2 instance by name

Now my company has around 35 different EC2 instances (and growing), I needed a way to easily SSH to them by their 'Name' tag instead of randomly assigned DNS name as we still have pets not cattle (tut tut!). This simple script does the job quite nicely: #!/usr/bin/env…