Transferring Files Across AWS S3 Buckets in Different AWS Accounts Using Scripting
Step 1: Create source AWS Account (name: “AS”) and S3 Bucket (name: “same-cb-bucket-sagar” )

Step 2: Create destination AWS Account (DG) and S3 Bucket (name: “same-cb-bucket-sagar-dest”)

Step 3: Configure IAM Roles (name: “s3-role-cb-src-as”) and Policies (name: “s3-cb-policy-lambda-sagar”) in the source AWS account.


Step 4: Create Lambda Function (name: “s3-cb-lmbda”) and add the S3 trigger in the Source AWS account.

Code Used (NodeJs and Also Python boto3):



Python:

Step 5: Add Bucket Policy in the destination S3 Bucket (name: “same-cb-bucket-sagar-dest”):

Step 6: Test the Function by uploading any file to source AWS bucket: File to be uploaded: leadsquared.png

Step 7: Now verify in the destination bucket.

Conclusion:
In this assignment, we transferred S3 bucket data from a source AWS account to a destination AWS account's S3 bucket using a Lambda trigger function. The process involved: ● Setting up the necessary AWS resources. ● Configuring IAM roles and policies. ● Creating a Lambda function. ● Testing the functionality.
This assignment has provided hands-on experience working with AWS services, IAM roles, Lambda functions, and S3 buckets. It has showcased the power and flexibility of AWS to automate data transfer tasks and securely manage resources across different AWS accounts.