Skip to content

Instantly share code, notes, and snippets.

@carloscarucce
Created June 14, 2024 12:38
Show Gist options
  • Save carloscarucce/1624485fb2664db1ab6dd29e87e466aa to your computer and use it in GitHub Desktop.
Save carloscarucce/1624485fb2664db1ab6dd29e87e466aa to your computer and use it in GitHub Desktop.
Renames all repositories in AWS code commit using awscli + jq
#!/bin/bash
PROFILE=my-profile
REGION=us-east-1
CODE_REPOSITORIES=$(aws codecommit list-repositories --no-paginate --profile=$PROFILE --region=$REGION |jq -r .repositories[].repositoryName)
for REPO in $CODE_REPOSITORIES; do
NEW_REPO_NAME="${REPO}_deprecated"
echo "- Reponame: ${REPO}; New name: ${NEW_REPO_NAME}"
aws codecommit update-repository-name \
--old-name=$REPO \
--new-name=$NEW_REPO_NAME \
--profile=$PROFILE \
--region=$REGION && echo 'Renamed' || echo 'Failed'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment