Migrate EC2 machine from one AWS account to another

EC2 replication from one AWS account to another - Shellscribe

Migrating a running EC2 machine from one AWS account to another seems a complicated task. But by utilizing the available resources and with careful planning, you can easily achieve this. There are several ways to migrate an EC2 machine across AWS accounts but we are going to explore the easiest one.

We'll use Amazon Machine Image (AMI) to create an Image from EC2 instance and use that image in the target AWS account to create a new EC2 Instance.

Requirements

To test or perform this migration, you need two separate AWS accounts. One AWS account will act as source and another AWS account will act as target.

  • Source AWS account where EC2 is running.
  • Target AWS account where EC2 needs to migrated.

As keeping this migration process simple and easy, there are not many requirements. In the next section, we'll start with creating the AMI of our running EC2 instance.

Creating AMI of EC2 instance (Source account)

An EC2 instance, with Nginx web server, is running on my source AWS account. A single-page website is hosted on this EC2 instance just so we can confirm that everything is migrated as expected.

ec2 on source account running nginx

The Above webpage is being served by Nginx web server that is running on EC2 instance in the source AWS account. Title of webpage is Test-Server and It's being accessed from 54.254.167.11 IP-Address.

To create AMI of this EC2 instance, follow the steps below:
  • Select EC2 instance > Actions > Image and templates > Create image creating ec2 image
  • Set the AMI name in Image name field. Also mark No reboot as Enable. Now keep everything unchanged and click on Create image.

Author: Harpreet Singh
Cloud Solution Architect

Created: Wed 06 Dec 2023

⏳ 8 min read

👁️ 145 Views

POST CATEGORY
  1. Cloud
  2. Networking
  3. System Admin
SCROLL TO
Requirements Creating AMI of EC2 instance (Source account) Sharing AMI with target account Using AMI to create EC2 instance (Target account) Replicating security group rules Launch Instance from AMI Complete steps Conclusion
Suggested Posts:
LINUX post image
Install LAMP on Ubuntu or CentOS with firewall configuration

This tutorial will be focused on installing the LAMP stack (Linux Apache MySQL PHP) …

NETWORKING post image
CTF Challenges and Solutions from picoGYM by picoCTF

picoCTF is an open-source project. It's an enhanced platform for education and organizing competitions …

WINDOWS post image
Reset windows 10 password using bootable usb drive

Windows 10 by Microsoft is the most used operating system nowadays. Despite being heavily …

LINUX post image
Configure Django with Apache, MySQL and WSGi on Ubuntu

In this article, I'll be demonstrating how we can deploy Django website on an …

PROGRAMMING post image
Python Coding Challenge (Level Intermediate)

Python is one of the most powerfull programming language. Python is used in web-development, …

Sign up or Login to post a comment.

Sign up Login

Comments (0)