A common issue I get to deal with is of clients outgrowing their AWS micro instance.

In most cases the server that holds the database and also serves the application. As time goes by, the hard drive starts to fill up with data and log files, at which point, the application might stop responding and the company requires a quick fix with minimal downtime.

With an initial volume of 8GB, its almost always impossible to just free data, so you are left with three solutions:

Figure out what is causing the ec2 volume to fill up and hope that we can fix it in time. Add another EBS volume with a larger size, but having to migrate the application / database. Create an AMI and setup a new instance.

While the combination of the first and second solutions are what we should eventually do, part of Amazon’s philosophy is to first solve the problem by adding resources and then attend to the long term solution. Keeping in mind that you only pay for what you are using, another instance should only cost us a few dollars.

The fastest way to extinguish the fire is taking on the third option. It should take only a few minutes and allow you to breath again with minimum downtime:

As you can see, my instance is running with low disk space on the root partition.

1. Creating the AMI:

Select the instance in the AWS console and then select Create Image.

This will bring up the following menu.

Set the volume size to 30GB, like in the screenshot or any other volume size you think is needed and press save. You can also specify to create the image without rebooting the server in the process.

Now press “Yes, Create” and wait for the image to be created. This should take a few minutes depending on the queue in your zone. To verify that the image is ready, go to Images->AMIs.

2. Launch a new instance

Start the launch instance wizard in Classic mode and then go to “My AMIs”. Select the newly created AMI and continu as usual.

Wait for the instance to load and then login and run df again to view the volume size:

As you can see, Amazon automatically resized your root volume.

At this point you will need to direct traffic to your new server by changing the Elastic IP or if you are using a load balancer, adding the new server and retiring the old.

Now you have time to figure out what ate your disk space.