How to Move Amazon EC2 instance to a Different Availability Zone

Amazon EC2 instances are hosted in multiple locations worldwide. These locations are known as Regions, Availability Zones, and Local Zones. Each Region is a separate geographic area that has multiple, isolated locations known as Availability Zones. In this article, we will show you how to move your Amazon EC2 instance to another availability zone within the same AWS region. This article consists of two parts. The first part is about moving an Amazon EC2 instance from availability zone us-east-2b to availability zone us-east-21. Both instances are running in the US East (Ohio) region. The second part is about associating Elastic IP address to the moved IAM image.

Part I: Move Amazon EC2 instance from us-east-2b to us-east-2a

In the first part, we will move Amazon EC2 instance from one to another availability zone.

  1. Login into AWS Management Console
  2. Click on Services and then click on EC2
  3. Click on Running instances
  4. Right click on the instance and then click on Instance state > Stop
  5. Right click on the instance and then click on Image > Create Image
  6. Under Create Image fill in the following settings and then click on Create image.
  • Image name – type the name of the image
  • Image description – type the description of the contents and purpose of the image.
  • No reboot – When enabled, Amazon EC2 does not shut down the instance before creating the image. When this option is used, file system integrity on the created image cannot be guaranteed. In our case it is disabled.
  • Instances Volumes – define the volume size and volume type. In case you want to create an additional volume click on Add New Volume. We will keep the default settings.

  1. Click on View pending image ami-xxxxxxxxxx under Create Image request received.
  2. The AMI image is successfully created as can be seen under Status: available.
  3. Right click on AMI image and then click on Launch
  4. Choose an Instance Type and then click on Next: Configure Instance Details. In our case, we will choose t2.micro (Variable ECUs, 1 vCPUs, 2.5 GHz, Intel Xeon Family, 1 GiB memory, EBS only)
  1. We will move an Amazon EC2 instance from us-east-2b to an us-east-2a availability zone. Please change it under Subnet. Also, we do recommend enabling termination protection which will protect instances from being accidentally terminated. Once you do that click on Review and Launch.
  2. Review instance settings and then click Launch.
  3. Select an existing key pair or create a new key pair. A key pair consists of a public key that AWS stores, and a private key file that you store. Together, they allow you to connect to your instance securely. If you click on Create a new key pair, you will need to define pair name and Download key Pair that will be used to decrypt Windows password. You have to download the private key file (*.pem file) before you can continue.
  4. Click Launch Instances.
  5. Your instances are now launching. Click on View launches.
  6. Please wait a few minutes until your instance is successfully initialized 

Part II: Reassign Elastic IP to moved Amazon EC2 instance

In the second part, we will disassociate the Elastic IP from the image and associate it to a moved image.

  1. On the left side click on Elastic IPs under Network & Security
  2. Select the Elastic IP and then click on Actions > Disassociate Elastic IP address
  3. Under Dissociate Elastic IP address click on Disassociate. If you disassociate this Elastic IP address, you can reassociate it with a different resource. The Elastic IP address remains allocated to your account. Elastic IP addresses incur charges if they are not associated with a running instance or a network interface that is attached to a running instance.
  4. Select the Elastic IP and then click on Actions > Associate Elastic IP address
  5. Type Instance and Private IP address
  6. Select Allow this Elastic IP address to be reassociated and then click on Associate
  7. You have successfully assigned an Elastic IP address to Amazon EC2 instance. Click on Instances on the left side of the window and then verify if your instance that is moved to another availability zone is working fine.
ABOUT THE AUTHOR

Jasmin Kahriman


Jasmin is a tech-savvy Systems Engineer with over 15 years of experience in IT infrastructure, holding multiple IT certifications including CNIP, MTA, MCP, MCSA, MCT, Server+, and Network+.