RightScale-to-Native Amazon Web Services (AWS) Name Synchronizer

At my company, we use RightScale for a lot of our Amazon Web Services management. It’s a pretty neat service – sort of “training wheels” for the cloud. Still provides us a lot of value.

But sometimes I like to log directly into the AWS console. Especially to find out when Amazon has scheduled reboots of our servers. Before I wrote this script, I would log in to find a whole bunch of instances running with no names. Then I’d have to go look them up in RightScale. Why can’t RightScale just name your Amazon instances with the right names?!

Well, I finally took matters into my own hands and built the following script. It walks through all of your RightScale servers, and finds the associated Amazon instances and sets their name attributes to the RightScale “nicknames.”

And I got permission from my job to make it available to the public – so here it is:

https://github.com/uberbrady/RightScaleNameSynchronizer

Yes, it is not the prettiest code I have ever written, but it does the trick. If someone wants to make it prettier I am definitely open to pull requests.

One thing I have noticed is that when you ‘relaunch’ a RightScale instance, the new instance will come up without an AWS name. If you re-run the script that will fix that. Also, if you use any RightScale arrays, the same thing can happen during scale-up/scale-down events.

4 thoughts on “RightScale-to-Native Amazon Web Services (AWS) Name Synchronizer”

  1. Good stuff Brady. Looks like this is ample for the utility you're after, but you might consider taking a look at the rest_connection gem for accessing the RightScale API, and the right_aws gem for accessing the AWS API. It should make things a bit more robust and get away from using curl.

    Here's rest_connection;
    https://github.com/twrodriguez/rest_connection

    Here's right_aws;
    https://github.com/rightscale/right_aws

    I'll probably end up implementing this in a few accounts I manage, thanks for the contribution! 🙂

  2. Thank you, Ryan!

    If you end up making any tweaks, please do fork and pass them back – I'd love to make this better and less-annoying to run.

    So far, I have definitely found that it doesn't do anything to EBS volumes, and that can be a nuisance as well. Next time I mess around with this script, I will have to take a pass at getting those names synched too.

  3. Brady,

    I am making changes to your script so that you do not have to use the default rightscale scripts.

    It uses gem RightScaleAPIHelper. I will send you a link when I am done.

    Thanks for the great idea.

Leave a Reply

Your email address will not be published. Required fields are marked *