Skip to content

Instantly share code, notes, and snippets.

@regmicmahesh
Created January 11, 2023 08:03
Show Gist options
  • Save regmicmahesh/4aabacc9766e15c1ce635b642a8a2790 to your computer and use it in GitHub Desktop.
Save regmicmahesh/4aabacc9766e15c1ce635b642a8a2790 to your computer and use it in GitHub Desktop.
sync aws across accounts
#!/bin/bash
function sync_aws() {
SRC_BUCKET=$1
FOLDER_NAME=$2
DEST_BUCKET=$3
export DEFAULT_AWS_REGION=us-east-1
export AWS_REGION=us-east-1
export AWS_PROFILE=default
aws s3 sync s3://${SRC_BUCKET} ./${FOLDER_NAME}
export AWS_PROFILE=ml
aws s3 sync ./${FOLDER_NAME} s3://${DEST_BUCKET}
rm -rf ./${FOLDER_NAME}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment