How to copy data from s3 to s3 in another account

Thank you for reading this post, don't forget to subscribe!

Need to add the policy to the source s3 bucket
Example on test-dev bucket https://s3.console.aws.amazon.com/s3/buckets/test-dev?region=us-east-1&tab=permissions

Create a policy in the destination account 2222222222

  1. Use this command to sync data
    IMPORTANT!
    The above command should be executed with destination AWS IAM user account credentials only otherwise the copied objects in the destination S3 bucket will still have the source account permissions and won’t be accessible by destination account users.

 

 

ну и на ско­ряк мож­но сде­лать так:

kubectl run --rm -it --tty connect-to-s3 --image=ubuntu --restart=Never -n dev -- bash

apt-get update
apt-get install curl unzip -y

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86\_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install

mkdir ~/.aws

cat > ~/.aws/credentials

cat > ~/.aws/config

export AWS_PROFILE=test1

aws s3 sync s3://SOURCE-BUCKET-NAME s3://DESTINATION-BUCKET-NAME