ebs-changer: How to change between EBS volume types (or number of PIOPs) in a fast and reliable way

NOTE: ebs-changer is no longer maintained, as is now included into EBS-Tools suite

Did you ever want to change standard EBS to io1 volumes on Amazon Web Services? Maybe io1 to standard? Did you want to increase the number of PIOPs your volumes are using? Did you performed this tedious job by hand?

In my current project (SmartSteps) at Telefonica R&D we needed to to this a lot of times on several environments using MongoDB replicasets and RAID0 on each mongo server.

So each time we needed to stop mongo services (or the instances), snapshot all the volumes, detach, delete old volumes, create new volumes from the snapshots and then reattach them using the same devices. That was more than 15 times the same set of operations.

And of course, it was likely possible to make mistakes in the process.

So, why should we do this by hand when it’s possible to automate and run the changes in parallel?

As the project was moving too fast to create and test anything like this, I decided to wrote an extension for the Fabric tasks we’re using at the project in only one day.

This was done in my free time, so it was licensed under the GNU GPL 3.0 but heavily tied to Telefónica R&D Fabric code as it uses a lot of functions to connect to AWS API through boto.

So this is the reason I modified the original fabric tasks and functions to be used outside my job and… ebs-change is born!

It’s a small Python2 script (only 375) lines and it will help you if you ever had the same problems I had.

To use it, you’ll need to install boto and colorama python modules (you can use pip, apt-get or whatever you prefer and have this modules available).

Just call the script with ebs-change –help to know how to use it.

But in short: tell the script the instance, devices, new type (or new number of IOPS) and the AWS region… and relax.

Feel free to comment, fork or send improvements.

This is my first public python script and the first one from scratch outside Fabric so, for sure, there are a lot of things to improve. But I can assure you we’re successfully using it… and it’s saving us a lot of time and money!



Be the first to comment

Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.