S3 moving files between buckets on different accounts?

前端 未结 5 1081
不知归路
不知归路 2020-12-13 00:35

I\'m doing some work for a client that has 2 separate AWS accounts. We need to move all the files in a bucket on one of their S3 accounts to a new bucket on the 2nd account.

5条回答
  •  庸人自扰
    2020-12-13 01:25

    Even if Roles and Policies are an really elegant way, I've another solution:

    1. Get your AWS-Credentials for Source-Buckets-Account
    2. Same for Destination-Buckets-Account
    3. On your local machine (Desktop or any Server outside of AWS) create a new profile with the Credentials of the Source-Bucket-Accounts.

      aws --profile ${YOUR_CUSTOM_PROFILE} configure

    4. fill in aws_access_key_id and aws_secret_access_key (you may skip Region and Output)

    5. Save your Destination-Bucket-Credentials as Environment-Variables

      export AWS_ACCESS_KEY_ID=AKI...

      export AWS_SECRET_ACCESS_KEY=CN...

    6. Now do the sync, but add the crucial "profile"-Parameter

      aws --profile ${YOUR_CUSTOM_PROFILE} s3 sync s3://${SOURCE_BUCKET_NAME} s3://${DESTINATION_BUCKET_NAME}

提交回复
热议问题