Amazon EC2 – Production Deployment with Minimal Downtime

amazon ec2deployment

I have a simple web application deployed on a large instance with EC2. I now want to deploy the latest code to this server but I want to do this in a way which minimizes downtime and is a smooth as possible for the end user. Here is my plan:

  1. Fire up another large instance
  2. Install all the software layers on that instance
  3. Restore and attach an EBS drive to the instance
  4. Deploy our latest production ready code on the new instance
  5. Run all tests (including manual testing of the application)
  6. (If tests pass) Put a "Site Under Maintenance" notice on the live site.
  7. Backup the EBS instance on the live site
  8. Detach the EBS instance from the new server and replace with the latest backup
  9. Use ec2-associate-address to move the IP address to the new instance
  10. Sit back and wait for traffic to start flowing though the new instance
  11. Terminate the old instance

Does this seem like a good strategy? Are there any tutorials or books that might cover this topic? I have already read Cloud Application Architectures by George Reese, which is an excellent book, but does not cover deployment. Additionally, I know that there are tools that can help with this like RightScale or enStratus which I will use when I start using more than one instance.

Best Answer

This looks like a good overall approach. You could cut out step 2, and thus bring down the launch time, by creating a custom AMI that includes all the software layers you need; having said that, I would still update all of the packages at startup to make sure that you get all the latest security updates.

You might also want to think about using an EBS-backed instance - that way you could have the boot volume, the software stack and your application all on EBS, which would cut out a few of the steps above.