Amazon already provides a set of command-line tools to manage EC2 resources. They allow stopping/starting instances, allocating ip addresses and volumes, attaching/detaching volumes etc.
However, when one starts using these tools to manage day-to-day operations it becomes clear that they have some limitations:
- They are too fine grained, each tool dealing with a single EC2 object at a time. While this is great from a software design point of view, combining these tools to automate complex operations can be challenging.
- The tools operate in an asynchronous way, reflecting the underlying EC2 platform workings. This makes scripting more complex as there is the need to poll in order to wait for an operation to complete.
- They do not support friendly naming of EC2 resources, relying instead in EC2 object identifiers (like i-c4c026ac or vol-a5d83ecc) which are not intended to be human-readable.
RainToolkit solves all that by providing a set of command line tools based on the concept of virtual machine, a concept familiar to anyone who has used any traditional virtualization platform (VirtualBox, VMWare etc.).
RainToolkit commands allow you to manipulate virtual machines and its attachable components (volumes and elastic IP addresses) in a more sysadmin-friendly way by creating an inventory of Virtual Machine metadata that gets stored in Amazon Simple DB.
Creating a virtual machine in RainToolkit is as easy as:
create-virtual-machine -n myMachineName -i
You can specify all the usual EC2 attributes in your virtual machines: availability zone, kernel, instance type (small, large, extra large etc.). You can also associate a virtual machine with an already running EC2 instance (labeling).
Starting a an EC2 virtual machine is as easy as:
start-virtual-machine -n myMachineName
Rain Toolkit will take care of launching the EC2 instance, waiting for it to start running ,attaching volumes to the right devices, attaching an elastic ip address etc.
You can also create EBS volumes or label existing EBS volumes:
create-volume -name myVolume -size 500 -z u-east-1c
Data for virtual machine and volume configuration is stored in Amazon Simple DB.
Viewing virtual machines, volumes and other objects is also equally easy:
describe-virtual-machines Name Uptime DnsName InternalIpAddress InstanceId test-server none none none none website 200d00:21 ec2-174-129-201-163.compute-1.amazonaws.com 10.248.241.236 i-c4c026ac
All command line tools are designed to provide meaningful exit values (0 on success) so they can easily be used inside shell scripts.
Please check the tools documentation page for detailed installation and usage instructions.