I have a simple LAMP stack on an EBS Ubuntu instance on AWS EC2.
It's been running well for a while now, but I'm now starting to run low on hard disk space.
What are my options?
I've already attached an EBS volume and moved logs etc to it, but the MySQL database continues to grow.
Do I move the database to the attached volume? I have serious concerns about this though. Database speed is currently the performance bottleneck in the LAMP stack, and moving the database to an EBS could incur a considerable performance hit (if the speed of moving files to and from the volumes is anything to go by?)
You should definitely move the database to an EBS-block. Not only are these volumes faster than local storage, they’re also persistent. So if/when an EC2 instance stops, the root filesystem for that instance remains intact and will continue to be usable if the instance is re-started.
From the Amazon help page on EBS:
Whenever you still have an I/O bottleneck after that, you might want to consider using Amazon RDS.
Here are two options:
Option 1:
Move the MySQL database off your EC2 and onto RDS. It still runs MySQL and you can even choose the version. They provide help on migration.
Disadvantages: you will be paying for an additional instance, as the RDS instance is charged at the same rate as EC2. You will also have to tolerate some downtime.
Option 2:
Increase the size of the EBS volume.
Through the web interface you can do this by: - stopping the instance - create a snapshot of the volume - create a volume from the snapshot, specifying a larger size when prompted - create an AMI from the volume - start an instance of the new AMI
However, I have trouble with the new instance not starting. Through the API you can do this by following Eric Hammond's instructions here.
Disadvantages: once again, downtime.