AWS Ruby SDK - Adding a Friendly DNS name to Route 53- 1 min
If you are using Auto Scaling with AWS, you know it can be difficult to keep track of everything that’s going on. To make matter’s worse if you are using the default hostnames that come with your EC2 Instance all of a sudden your Monit or Nagios Alert’s can become even difficult to understand.
Most likely if you are using Auto Scaling, you already have some sort of bootstrap process and during that you might want to add a friendly DNS record to Route 53.
Below is a snippet of the code I use to do this using the AWS SDK for Ruby.
I assign an IAM Role to the EC2 Instance’s upon creation. This make’s it easy to create very restricted policies, essentially locking down your instance to a small set of API calls and as bonus you no longer have to hardcode API Key’s in your scripts.