Repository meant for storing scripts used to transfer objects between different AWS accounts and services
-
S3 file transfer between accounts:
-
Setup the source account. This means:
- Sign into the source account in AWS.
- Attach the policy included in account_transfer_bucket_policy.py to the bucket you want to synchronize in the destination account. As you can see, that script automatically attaches the policy for any bucket you specify.
-
Setup the destination account. This means:
- Sign into the destination account in AWS.
- Create an IAM user that includes the policy included in the same script as 1.1.
- Open AWS CLI and run the following command replacing the related variables:
aws s3 sync s3://SOURCE-BUCKET-NAME s3://DESTINATION-BUCKET-NAME --source-region SOURCE-REGION-NAME --region DESTINATION-REGION-NAME
-
-
ECR image transfer between accounts:
- Open a terminal and go to .aws directory. (
cd ~/.aws
should do the trick in macOS ). - Run your preferred text editor to open the credentials file. We will be creating two AWS profiles, one for the source account and one for the destination account. Specific instructions can be found here. For example, create a profile named Source and a profile named Destination.
- Head to the directory where the ecr_transfer.py script is stored.
- Run the following command:
python ecr_transfer.py --source_profile >Source< --destination_profile >Destination< --destination_account_id >Destination_Account_ID<
replacing the source profile name, the destination profile name and the destination account ID.
- Open a terminal and go to .aws directory. (