Skip to content

Instantly share code, notes, and snippets.

@jlamoree
Created May 23, 2025 21:22
Show Gist options
  • Save jlamoree/27022eb2c429cb3529eae1f7d3720690 to your computer and use it in GitHub Desktop.
Save jlamoree/27022eb2c429cb3529eae1f7d3720690 to your computer and use it in GitHub Desktop.
src_profile="sso-account-old"
src_account_id=$(aws sts get-caller-identity --profile $src_profile --query Account --output text)
src_region="us-west-2"
src_registry="${src_account_id}.dkr.ecr.${src_region}.amazonaws.com"
src_creds=$(aws ecr get-login-password --region $src_region --profile $src_profile)
dest_profile="sso-account-new"
dest_account_id=$(aws sts get-caller-identity --profile $dest_profile --query Account --output text)
dest_region="us-west-2"
dest_registry="${dest_account_id}.dkr.ecr.${dest_region}.amazonaws.com"
dest_creds=$(aws ecr get-login-password --region $dest_region --profile $dest_profile)
repositories="
magic-api/processor
magic-api/scheduler
iac-utils
devops/database-clients
"
for repository in $repositories; do
if [[ "$repository" == */* ]]; then
dest_repo_path="/${repository%/*}"
else
dest_repo_path=""
fi
skopeo sync --all --src docker --src-creds "AWS:$src_creds" --dest docker --dest-creds "AWS:$dest_creds" \
"${src_registry}/${repository}" "${dest_registry}${dest_repo_path}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment