Skip to main content

How to: Migrate an EC2 instances to a new availability zone

Recently an EC2 instance we were using in a production environment was scheduled to go down for maintenance. Normally this would be fine and we would let AWS just handle this. However, their scheduled maintenance window was set for 21:00 UTC, which equates to 17:00 EST. In other words, right at the end of the work day. Not cool!

In order to use a maintenance schedule of our choosing, we had to migrate our production instance into a different availability zone prior to Amazon's schedule. So, we setup a test instances and tested migrating. Our successful steps are below:

Migrate an EC2 instance to a new availability zone

  1. Stop the instance you wish to migrate to a new zone.
  2. Create a snapshot of the EBS volume (this step is likely not necessary, but safety first).
  3. Create Image of the instance.
    • Optionally, increase the storage size of the EBS volume.
  4. Launch a new instance from the AMI in step 3.
  5. Remap Elastic IP address to new instance.
  6. If your using consistent snapshots, be sure to update the volume id in your backup script to reflect the new ebs volume!

Comments