Managing persistent data on an Amazon EC2 web server
- by Derek
I've just started trying out Amazon's EC2 service for running an asp.net web app which uses a SQL Server 2005 Express database. I have some questions about how to configure and operate it best for reliability, and I'm hoping to tap into some collective wisdom here as this is my first foray into EC2.
Here's how I have it configured currently:
OS: Windows 2003
SQL Server Express 2005
Web content stored on an EBS Volume (E Drive)
Database Data stored on an EBS Volume (E Drive)
Database backups to "C Drive" and then copied off to S3.
Elastic IP Address attached to the production instance.
Now when I make a change to the OS configuration, I make a new AMI using the bundle feature. Unfortunately, I found that this results in significant downtime. While the bundle is created and the new instance is started. It seems that when I'm ready to make a new AMI, I should:
Start up a new temporary instance.
Detach the EBS volume from the production instance.
Detach the IP Address from the production instance.
Attach the IP Address to the temporary instance.
Attach the EBS volume to the temporary instance.
Create an AMI from the production instance.
After the production instance restarts, reverse the attach/detach steps to put it back in production.
Is this the right order of events to prevent any chance to corrupt the EBS volume?
Will the EBS volume become corrupt if I detach it while a database Write is taking place?
Should I snapshot the EBS volume of the production instance and attach it to the temporary instance instead? Or could taking a snapshot of the EBS volume while it's in use cause corruption?
Any suggestions to improve the reliability and operations?