Created
June 14, 2024 12:38
-
-
Save carloscarucce/1624485fb2664db1ab6dd29e87e466aa to your computer and use it in GitHub Desktop.
Renames all repositories in AWS code commit using awscli + jq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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