We can achieve this migrate Amazon S3 bucket files from one AWS account to another AWS account in a simple steps.

Step 1:

Install the AWS CLI into machine

1
2
3
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
Migrate Amazon S3 bucket files from one AWS account to another AWS account

Migrate Amazon S3 bucket files from one AWS account to another AWS account

Step 2:

Download the Amazon S3 Buckets from old account to local folder:
Connect to first AWS account using below command in CLI

1
2
3
4
5
6
7
sudo aws configure

AWS Access Key ID [None]: <Your Access Key>

AWS Secret Access Key [None]: <Your Secret Key>

Default region name [None]: <Region>

Step 3:

Export (Download) the data from old account using below command

1
sudo aws s3 sync s3://<bucket name> <local folder>

Step 4:

To upload the buckets to the new account
Log in to the new AWS account and create the Amazon S3 bucket name.
Connect to second AWS account using below command in CLI

1
2
3
4
5
6
7
sudo aws configure

AWS Access Key ID [Previous Key]: <Your New Account Access Key>

AWS Secret Access Key [Previous Secret]: <Your New Account Secret Key>

Default region name [Previous Region]: <New Account Region>

Step 5:

Go the specific folder (Bucket name)

1
cd [bucket folder name]

Step 6:

Import (Upload) the data from old account to new account using below command

1
sudo aws s3 sync . s3://<bucket name>

With these steps we can migrate Amazon S3 Bucket‘s files and folder from AWS account to another AWS account’s S3 Bucket.

Note: It is good for smaller size of buckets. We need to check the alternative methods for bigger in size.

Categories: AWSHosting

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *