• Home
  • About
  • Log In
  • Register
Follow Us
KTEXPERTS
  • Oracle DBA
    • Oracle 12C New Features
      • Oracle Multitenant Features
      • Non Container Features
    • Oracle Architecture
      • Oracle Server Architecture
      • Oracle Background Processes
      • Oracle Pyhisical Database
      • Select and Update Statement
      • Startup and Shutdown Modes
      • Redolog File Management
      • User Management
        • RMAN (Recovery Manager)
        • Oracle Production Support Scripts
    • Oracle Tablespace Management
    • Oracle Datapump (Exports & Imports)
    • Performance Tuning
    • Oracle Dataguard
    • Oracle ASM
    • Oracle Auditing
    • Oracle Partitioning
    • SecureCRT
    • Partitions/Shell Script
  • Oracle RAC
    • Introduction to Oracle RAC
    • 11gR2 RAC Installation
    • 12cR2 RAC Installation
    • 19c RAC Installation
    • Flashback Restore on Two Node RAC Servers
  • GoldenGate
    • Oracle to Oracle GoldenGate Unidirectional Replication
    • MySQL to Oracle Heterogeneous Replication
    • Oracle to MySQL Heterogeneous Replication
    • CredentialStore in Goldengate
    • GoldenGate Monitoring Commands
    • Usage of HandleCollisions and No HandleCollisions
    • Goldengate subdirs
    • Enable/Disable DDL replication
    • Data Selection & Filtering
    • Automation scripts in Goldengate
    • Logdump utility
    • Initial loads with GoldenGate
    • IgnoreDelete and IgnoreUpdate parameters in GG
    • COLS & COLSEXCEPT FILTER in GG
    • Add new table to existing GoldenGate Replication
      • Cassandra
  • AWS
    • EC2 (Elastic Compute Cloud)
    • S3 (Simple Storage Service)
    • IAM (Identity and Access Management)
    • CloudWatch
    • VPC (Virtual Private Cloud)
    • Route 53
    • RDS
    • Dynamo DB
    • EFS (Elastic File System)
    • Cloud Trail
    • Cloud Front
    • SNS (Simple Notification Service)
    • SQS (Simple Queue Service)
    • SES (Simple Email Service)
    • Redshift
    • Elastic Cache
    • Snowball
  • SQL Server
  • DevOps
    • LINUX
    • GIT
    • Chef
    • Ansible
    • Docker
    • Maven
  • MySQL
    • MySQL Installation & Upgrade
    • MySQL DBA
    • Difference Between Oracle and MySQL
  • PostgreSQL
    • Installation of PostgreSQL
    • WAL Internals in PostgreSQL
    • Replication to GCP PostgreSQL
    • Level of Work in Postgres Database
    • Data Fragmentation in PostgreSQL
    • PostgreSQL Interview Q&A
    • PostgreSQL Commands
  • Authors
    • Authors
    • Speakers
    • Volunteers
  • INDEX
    • Oracle DBA
      • Performance Tuning
      • Oracle RAC
      • Oracle 12c New Features
      • Oracle Production Support Scripts
      • Oracle DataGuard
      • Data Pump (Export & Import)
      • Oracle 18c
      • RMAN (Recovery Manager)
      • Oracle Tablespaces
      • Oracle ASM
      • Oracle Partitioning
      • Oracle Architecture
    • PostgreSQL
    • AWS
    • DevOps
    • GoldenGate
    • Cassandra
    • SQL Server
    • Oracle RAC
    • MySQL
    • SecureCRT
  • Webinar Recordings
  • Daily Tips
    • Oracle DBA Tips
    • GoldenGate Tips
    • MySQL Tips
    • SQL Server Tips
    • PostgreSQL Tips
    • MongoDB Tips
    • DevOps Tips
    • Python Tips
    • Data Science Tips
      • Exadata Tips
    • AWS Tips
    • .NET Tips
    • Linux Tips
  • Azure
  • Python
  • MongoDB
mm

Ramesh Reddy

I am Ramesh Atchala currently working as Software Engineer. I like to upgrade my skills and enthusiastic to learn new things. Have a huge interest on AWS,DevOps and this platform is a good opportunity to share some information and to learn as well.

Follow

Share this post

Tags

  • Amazon EC2
  • Amazon EC2 Instance
  • AMI
  • AWS
  • aws account
  • Linux EC2 Server
  • Putty Tool

How to Transfer EC2 Instance to another AWS account in AWS

Posted on December 3, 2019 in AWS, EC2
Share via:
Post Views: 0

Dear Readers,

In this article,we will see Transfer EC2 Instance to another AWS Account.

Implementation Steps

  1. Launch Linux EC2 Instance.
  2. Connect to Linux EC2 Instance through putty and Install updates,package “tree” and create files,directories.
  3. Create AMI (Amazon Machine Image).
  4. Copy AMI to another AWS Account.
  5. Launch Linux EC2 instance from AMI.
  6. Connect to Linux EC2 Instance through putty and verify files.

First, we need to AWS Console page by using below link.

https://aws.amazon.com/console/

Click on sign in to Console button.

Logging to aws account

Login using username & password and click on sign in.

Enter to AWS Management Console

We can see the AWS Management Console Dashboard.

Go to Services, under the compute module click EC2 service to open.

1. Launch Linux EC2 Instance

Please check below link to Launch Linux Server.

Launch Linux Launch Linux Server

We can see Linux Server “My Linux” which was created earlier.

2. Connect to Linux Server through putty and Install updates,package “tree” and create files,directories.

Open Linux Server terminal,.

Open Linux Terminal

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
Using username "ec2-user".
 
Authenticating with public key "imported-openssh-key"
 
Last login: Sat Nov 23 19:50:40 2019 from 124.123.103.5
 
 
 
       __|  __|_  )
 
       _|  (     /   Amazon Linux 2 AMI
 
      ___|\___|___|
 
 
 
https://aws.amazon.com/amazon-linux-2/
 
5 package(s) needed for security, out of 13 available
 
Run "sudo yum update" to apply all updates.
 
[ec2-user@ip-172-31-0-157 ~]$

Switch to root user

1
2
3
4
 
[ec2-user@ip-172-31-0-157 ~]$ sudo su
 
[root@ip-172-31-0-157 ec2-user]#

Install Updates

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
[root@ip-172-31-0-157 ec2-user]# yum update -y
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core | 2.4 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package file.x86_64 0:5.11-33.amzn2.0.2 will be updated
---> Package file.x86_64 0:5.11-35.amzn2.0.1 will be an update
---> Package file-libs.x86_64 0:5.11-33.amzn2.0.2 will be updated
---> Package file-libs.x86_64 0:5.11-35.amzn2.0.1 will be an update
---> Package kernel.x86_64 0:4.14.154-128.181.amzn2 will be installed
---> Package python.x86_64 0:2.7.16-3.amzn2.0.1 will be updated
---> Package yum.noarch 0:3.4.3-158.amzn2.0.3 will be an update
--> Finished Dependency Resolution
 
Dependencies Resolved
 
================================================================================================
Package Arch Version Repository Size
================================================================================================
Installing:
kernel x86_64 4.14.154-128.181.amzn2 amzn2-core 20 M
python2-rpm x86_64 4.11.3-40.amzn2.0.3 amzn2-core 84 k
replacing rpm-python.x86_64 4.11.3-25.amzn2.0.3
Updating:
file x86_64 5.11-35.amzn2.0.1 amzn2-core 57 k
file-libs x86_64 5.11-35.amzn2.0.1 amzn2-core 339 k
python x86_64 2.7.16-4.amzn2 amzn2-core 92 k
yum noarch 3.4.3-158.amzn2.0.3 amzn2-core 1.2 M
 
Cleanup : yum-3.4.3-158.amzn2.0.2.noarch 15/25
Erasing : rpm-python-4.11.3-25.amzn2.0.3.x86_64 16/25
Cleanup : python-libs-2.7.16-3.amzn2.0.1.x86_64 24/25
Verifying : python-2.7.16-4.amzn2.x86_64 3/25
Verifying : yum-3.4.3-158.amzn2.0.3.noarch 4/25
Verifying : rpm-libs-4.11.3-40.amzn2.0.3.x86_64 5/25
Verifying : rpm-build-libs-4.11.3-40.amzn2.0.3.x86_64 6/25
Verifying : kernel-4.14.154-128.181.amzn2.x86_64 7/25
Verifying : rpm-4.11.3-40.amzn2.0.3.x86_64 8/25
Verifying : file-libs-5.11-35.amzn2.0.1.x86_64 9/25
Verifying : rsyslog-8.24.0-41.amzn2.2.1.x86_64 10/25
Verifying : rpm-plugin-systemd-inhibit-4.11.3-40.amzn2.0.3.x86_64 11/25
Verifying : python-devel-2.7.16-4.amzn2.x86_64 12/25
Verifying : python2-rpm-4.11.3-40.amzn2.0.3.x86_64 13/25
Verifying : python-devel-2.7.16-3.amzn2.0.1.x86_64 14/25
Verifying : rpm-build-libs-4.11.3-25.amzn2.0.3.x86_64 20/25
Installed:
kernel.x86_64 0:4.14.154-128.181.amzn2 python2-rpm.x86_64 0:4.11.3-40.amzn2.0.3
 
Updated:
file.x86_64 0:5.11-35.amzn2.0.1 file-libs.x86_64 0:5.11-35.amzn2.0.1
python.x86_64 0:2.7.16-4.amzn2 python-devel.x86_64 0:2.7.16-4.amzn2
python-libs.x86_64 0:2.7.16-4.amzn2 rpm.x86_64 0:4.11.3-40.amzn2.0.3
rpm-build-libs.x86_64 0:4.11.3-40.amzn2.0.3 rpm-libs.x86_64 0:4.11.3-40.amzn2.0.3
rpm-plugin-systemd-inhibit.x86_64 0:4.11.3-40.amzn2.0.3 rsyslog.x86_64 0:8.24.0-41.amzn2.2.1
yum.noarch 0:3.4.3-158.amzn2.0.3
 
Replaced:
rpm-python.x86_64 0:4.11.3-25.amzn2.0.3
 
Complete!
[root@ip-172-31-0-157 ec2-user]#

Verify files in the current directory

1
2
 
 [root@ip-172-31-0-157 ec2-user]# ls

Check the tree package installed or not

1
2
3
4
 
[root@ip-172-31-0-157 ec2-user]# rpm -q tree
 
package tree is not installed

Make Directory “ktexperts”

1
2
3
4
5
6
 
[root@ip-172-31-0-157 ec2-user]# mkdir ktexperts
 
[root@ip-172-31-0-157 ec2-user]# ls
 
Ktexperts

Go inside Directory “ktexperts” and make a file “aws” then put some content

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 
[root@ip-172-31-0-157 ec2-user]# cd ktexperts/
 
[root@ip-172-31-0-157 ktexperts]# vi aws
 
[root@ip-172-31-0-157 ktexperts]# cat aws
 
ktexperts is a knowledge sharing platform
 
It will help you to get knowledge on updated technologies.
 
[root@ip-172-31-0-157 ktexperts]#
 
[root@ip-172-31-0-157 ktexperts]# tree
 
bash: tree: command not found
 
[root@ip-172-31-0-157 ktexperts]#

Install the package “tree”

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
[root@ip-172-31-0-157 ktexperts]# cd /home/ec2-user/
 
[root@ip-172-31-0-157 ec2-user]# yum install tree -y
 
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
 
amzn2-core                                                               | 2.4 kB  00:00:00
 
Resolving Dependencies
 
Dependencies Resolved
 
================================================================================
 
 Package         Arch              Version                          Repository             Size
 
================================================================================
 
Installing:
 
 tree            x86_64            1.6.0-10.amzn2.0.1               amzn2-core             47 k
 
Transaction Summary
 
================================================================================
 
Install  1 Package
 
Total download size: 47 k
 
Installed size: 83 k
 
Downloading packages:
 
tree-1.6.0-10.amzn2.0.1.x86_64.rpm                                       |  47 kB  00:00:00
 
Running transaction check
 
  Installing : tree-1.6.0-10.amzn2.0.1.x86_64                                               1/1
 
  Verifying  : tree-1.6.0-10.amzn2.0.1.x86_64                                               1/1
 
Installed:
 
  tree.x86_64 0:1.6.0-10.amzn2.0.1
 
Complete!
 
[root@ip-172-31-0-157 ec2-user]#

Check the tree package installed or not

1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
[root@ip-172-31-0-157 ec2-user]# rpm -q tree
 
package tree is installed.
 
[root@ip-172-31-0-157 ec2-user]# tree
 
.└── ktexperts
 
└── aws
 
1 directory, 1 file
 
[root@ip-172-31-0-157 ec2-user]#

In this Server, we can see one directory “ktexperts” ,one file “aws”.

One package has been installed i.e,tree.

3. Create AMI (Amazon Machine Image)

Select your instance “My Linux”

Go to actions, click on Create Image under the Image.

Specify Name of the Image “Ktexperts – AMI (Mumbai) and click on Create Image.

One success message will be displayed. Click ‘Close’.

and click on Close.

View your AMI

Navigate to AMIs under IMAGES.

we can see the AMI “Ktexperts – AMI (Mumbai) has been created.

Note

When you create Image , Snapshot will also be created automatically.

Go Snapshots, we can see one snapshot created  by Created by Create Image.

View your Snapshot

Navigate to Snapshots under Elastic Block Storage.

We can see the created snapshot as shown below.

Note

If you want to copy image to another account, you need to know another AWS Account ID then only we can copy to that account.

4. Copy Account ID of Another AWS Account

Logging to aws account

Provide username and password then click on sign in.

Click on My Account .

Copy Account Id in the Account Settings.

Copy AMI to Another AWS Account

Select you AMI,click on Modify Image Permissions in the Actions.

Select Private and paste Account id which was copied from Another AWS Account then click on Add Permission.

The account id has been added successfully.

Select Create Volume Permissions and click on Save.

Verify AMI in another AWS Account

Go to AMIs and select private Images then only it will show the private images.

We can see the AMI has been copied to another AWS Account successfully.

Note

When you create Image , Snapshot will also be created automatically.

Go Snapshots, we can see one snapshot created  by Created by Create Image.

View your Snapshot

Navigate to Snapshots under Elastic Block Storage.

We can see the created snapshot as shown below.

5. Launch Linux Instance From AMI

Select AMI and click on Launch.

Choose an Instance type

Choose the Type of instance depending on your requirements.

Instance types comprise of varying combinations of CPU, memory, storage, and networking capacity.

select the default option of t2. micro – this instance type is covered within the free tier. Then click on Configure Instance Details

Configure Instance Details

Configure EC2 instance details as per requirements of your environment and click on Add Storage.

Add Storage

Give size 50 GB for root volume.

Click on Add Tags.

Add Storage

Click on Add Tags.

Provide the name for the Linux virtual machine for easier understanding and click on Configure Security Groups.

Configure Security Group

A security group allows configuring firewall rules to allow traffic as needed. Only one rule has been added to allow remote connection.

SSH Is enough to connect to our Linux virtual server and click on Review and Launch

Review Instance Launch

Review and confirm the configuration of the instance. Click on the Edit button on each configuration item to make changes and click on Launch.

Choose Existing Key Pair and Launch Your Instance

Choose existing key pair and name it My Linux. Then click Download Key Pair.

After you have downloaded and saved your key pair, click Launch Instance to start your Linux instance.

Click on View Instances to view the instance you have just created and see its status.

We can see Linux Server “My Linux – AMI (First Account – Mumbai)” which was created earlier.

6. Connect to Linux Instance through putty and Verify files

Copy Public DNS of your instance.

Enter public DNS in putty and upload PPK file then terminal will be opened.

It will ask username, specify “ec2-user” .

Open Linux Terminal

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
Using username "ec2-user".
 
Authenticating with public key "imported-openssh-key"
 
Last login: Sat Nov 23 19:50:40 2019 from 124.123.103.5
 
 
 
       __|  __|_  )
 
       _|  (     /   Amazon Linux 2 AMI
 
      ___|\___|___|
 
 
 
https://aws.amazon.com/amazon-linux-2/
 
5 package(s) needed for security, out of 13 available
 
Run "sudo yum update" to apply all updates.
 
[ec2-user@ip-172-31-0-157 ~]$

Switch to root user

1
2
3
4
 
[ec2-user@ip-172-31-0-157 ~]$ sudo su
 
[root@ip-172-31-0-157 ec2-user]#

Verify files in current directory

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
root@ip-172-31-43-140 ec2-user]# ls
 
ktexperts
 
[root@ip-172-31-43-140 ec2-user]# tree
 
.
 
└── ktexperts
 
    └── aws
 
1 directory, 1 file
 
[root@ip-172-31-43-140 ec2-user]#

Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates

KTEXPERTS is always active on below social media platforms.

Facebook : https://www.facebook.com/ktexperts/
LinkedIn : https://www.linkedin.com/company/ktexperts/
Twitter : https://twitter.com/ktexpertsadmin
YouTube : https://www.youtube.com/c/ktexperts
Instagram : https://www.instagram.com/knowledgesharingplatform

Share via:
Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

You might also like...

  • Real-Time Use Case : IAM (Identity and Access Management)

    Real-Time Use Case : IAM (Identity and Access Management)

  • AWS : Real Time Use Case On Storage

    AWS : Real Time Use Case On Storage

  • How to Create AWS EC2 Instance Using Cloud Formation

    How to Create AWS EC2 Instance Using Cloud Formation

Previous Post: Copy EBS Volume Snapshot to Another Region and Attach to EC2 Instance
Next Post: GoldenGate Monitoring Commands

Add Comment Cancel reply

Recent Comments

  • Krishna on Installation of Oracle Linux In windows
  • Binnary Ajay Kumar on How to move or rename Oracle Home
  • Prabhu on How to move or rename Oracle Home
  • Krishna on Protected: How to kill Long Running Query using scripts.
  • krishna on Linux Basic Commands for DevOps (PART-2)

Categories

Ad

Started ktexperts.com with a small hope of sharing knowledge, And today we can proudly say that ktexperts.com is being accessed from all corners of the world. Here’s a glimpse of our growth.

About KTEXPERTS

KT Experts is one enthusiastic knowledge-sharing platform. The platform concentrates on all Database Technologies like Oracle Database Administration(DBA), Oracle RAC, Oracle GoldenGate, MySQL, SQL Server Database Administration, Cassandra, AWS and DevOps.

This page consists of all the well-developed articles  of the Technologies. This is an effort of many dedicated professionals for a better IT world.

We have received the best reviews over time and the usage of this page has been increasingly drastic. So why wait? Let’s get started!!!

Thank you 

Follow Our Social Networking Sites

Recent Posts

  • Automating OSWatcher Log Capture with oswlogs_capture.sh

    Automating OSWatcher Log Capture with oswlogs_capture.sh

  • COMPRESSION IN CASSANDRA

    COMPRESSION IN CASSANDRA

  • INSTALLING CASSANDRA USING DEBIAN PACKAGES

    INSTALLING CASSANDRA USING DEBIAN PACKAGES

  • OBJECT ORIENTED PROGRAMMING IN PYTHON

    OBJECT ORIENTED PROGRAMMING IN PYTHON

  • CASSANDRA INSTALLATION USING

    CASSANDRA INSTALLATION USING

Our Partners

Website Visitors


Locations of visitors to this page

COPYRIGHT © 2017 - KTEXPERTS.COM Back To Top
sponsored