Data Migration Between S3 Buckets Using AWS CLI
How to Transfer Data Between S3 Buckets with AWS CLI

Infosec Poet and CAP-certified DevOps/SecOps Engineer, passionate about security, creativity, and continuous learning.
Tasks
Create a new private S3 bucket named
xfusion-sync-9739.Migrate all data from the existing
xfusion-s3-29917bucket to the newxfusion-sync-9739bucket.Ensure data consistency between both buckets.
Use the AWS CLI for creating the bucket and migrating the data.
Steps
Ensure that we have aws cli configured with credentials.
aws configure~ on ☁️ (us-east-1) ➜ aws configure AWS Access Key ID [****************KG6C]: AWS Secret Access Key [****************LyeE]: Default region name [us-east-1]: Default output format [None]: ~ on ☁️ (us-east-1) ➜Time to create a new private S3 bucket named
xfusion-sync-9739.aws s3api create-bucket --bucket xfusion-sync-9739 --region us-east-1
Verify the bucket is created or not.
aws s3 ls
Migrate Data from the Source Bucket.
aws s3 sync s3://xfusion-s3-29917 s3://xfusion-sync-9739
Verify Data Consistency
Compare the total number of objects in both buckets to confirm the data migration was successful.
For the source bucket:
aws s3 ls s3://xfusion-s3-29917 --recursive --summarize | grep "Total Objects"
For the destination bucket:
aws s3 ls s3://xfusion-s3-29917 --recursive --summarize | grep "Total Objects"
Boom! we have successfully solved the exercise.
#happylearning #cloud #aws #S3 #awscli





