How I Successfully Migrated My EC2 Instance to Another AWS Account💡
Migrating EC2 Instances? Here’s Everything You Need to Know!

Search for a command to run...
Migrating EC2 Instances? Here’s Everything You Need to Know!

No comments yet. Be the first to comment.
This blog series is all about hands-on AWS. No theory, no jargon - just practical tasks you can apply immediately. Whether you're deploying, automating, or troubleshooting, these step-by-step guides help you get things done in AWS, the right way. 🚀
Learn the Fastest and Easiest Way to Move Your S3 Data Between AWS Accounts
If you have been working with Kubernetes for a while, there's a good chance you've used NGINX Ingress to expose services outside your cluster. For years, it has been the default choice for many teams

Hey everyone! 👋 When I’m working with an S3 + CloudFront setup, I noticed something that made me curious there are two different ways to let CloudFront access S3: OAI (Origin Access Identity) and the newer OAC (Origin Access Control). That got me wo...

AWS cross account access with OIDC provider in EKS With ExternalDNS

Managing AWS EC2 instances without worrying about SSH keys is a big relief, and AWS Systems Manager (SSM) Session Manager makes it even easier. It provides a secure way to connect to your instances. In this guide, I will walk you through the steps to...

Migrating an Amazon RDS (Relational Database Service) instance from one AWS account to another is a bit different from migrating an EC2 instance. Unlike EC2, RDS is a managed service, and you can't directly "Create AMI and give permission to destinat...

Migrating an EC2 instance from one AWS account to another might sound like a technical nightmare, but trust me, it’s easier than you think! I recently went through this process, and I’m here to break it down for you in simple steps. Whether you’re a beginner or an experienced AWS user, this guide will help you migrate your EC2 instance smoothly. Let’s dive in!
The first step is to stop the EC2 instance in the source account. Why?
Stopping the instance ensures that all data is written to the disk, and no ongoing processes are modifying the filesystem. This guarantees a consistent snapshot.
It reduces the risk of corruption or missing data in the AMI (Amazon Machine Image).
How I Did It:
Logged into the source AWS account.
Navigated to the EC2 Dashboard.
Selected the instance I wanted to migrate.
Clicked Instance State > Stop Instance.

Once the instance is stopped, the next step is to create an AMI (Amazon Machine Image). An AMI is a template that contains the information required to launch an instance, including the root volume, permissions, and configurations.
How I Did It:
Selected the stopped instance in the EC2 Dashboard.
Clicked Actions > Image and Templates > Create Image.

Filled in the details:
Name: Gave the AMI a meaningful name.
Description: Added a brief description for future reference.
Unticked the "Reboot" option to ensure the instance stayed stopped.

Clicked Create Image.
Creating an AMI can take a few minutes, depending on the size of the instance. Wait for the AMI to reach the "Available" state in the AMIs section of the EC2 Dashboard.

Once the AMI is available, the next step is to share it with the destination AWS account. This allows the destination account to access and use the AMI.
How I Did It:
Went to the AMIs section in the EC2 Dashboard.
Selected the AMI I just created.
Clicked Actions > Modify AMI Permissions.

Added the AWS Account ID of the destination account.

Clicked Save Changes.

After sharing the AMI, I switched to the destination AWS account to verify that the AMI was successfully shared.
How I Did It:
Logged into the destination AWS account.
Navigated to the AMIs section in the EC2 Dashboard.
Looked for the shared AMI in the Private image section.

Success! The AMI was visible in the destination account, ready to be used.
To ensure the AMI is fully available in the destination account, I copied it. This step is especially important if the source and destination accounts are in different AWS regions.
How I Did It:
Selected the shared AMI in the destination account.
Clicked Actions > Copy AMI.

Chose the destination region and provided a name for the copied AMI.

Clicked Copy AMI.
Finally, it was time to launch the EC2 instance in the destination account using the copied AMI.
How I Did It:
Selected the copied AMI in the AMIs section.
Clicked Actions > Launch Instance.

Configured the instance settings:
Instance Type: Chose the appropriate instance type.
Network Settings: Selected the VPC, subnet, and security group.
Key Pair: Associated a key pair for SSH access.

Clicked Launch Instance.
Once the instance was launched, I logged in to verify that everything was working as expected. I checked:
Applications: Were they running correctly?
Data: Was all the data intact?
Configurations: Were the settings preserved?

Boom! The migration was successful, and the instance was up and running in the destination account.
Test the Process: Before migrating a critical instance, test the process with a non-essential instance to ensure everything works.
Monitor Costs: Keep an eye on data transfer and storage costs during the migration.
Clean Up: After the migration, delete the AMI and snapshots from the source account to avoid unnecessary charges.
Migrating an EC2 instance to another AWS account doesn’t have to be complicated. By following these steps stopping the instance, creating an AMI, sharing it, and launching it in the destination account you can ensure a smooth and hassle-free migration.
📌So, what are you waiting for? Start migrating your EC2 instances today and take control of your AWS infrastructure!
📬Found this guide helpful? Share it with your team or leave a comment below if you have any questions. Don’t forget to follow for more AWS tips and tricks!
#ec2 #aws #ec2migration # devops #cloud #getintokube #getintokubeblogs