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