Created
July 2, 2020 16:41
-
-
Save yogeek/79451eeb411af58cb953d410a0dab0c2 to your computer and use it in GitHub Desktop.
ECR
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 | |
REPOS=$(aws ecr describe-repositories --query 'repositories[].repositoryName' --output text) | |
for repo in $REPOS; do | |
TAGS=$(aws ecr list-images --repository-name $repo --query 'imageIds[].imageDigest' --output text) | |
for tag in $TAGS; do | |
echo "Deleting image: $tag" | |
aws ecr batch-delete-image --repository-name $repo --image-ids imageDigest=$tag | |
done | |
done | |
echo "Deleting repos..." | |
for repo in $REPOS; do | |
aws ecr delete-repository --repository-name $repo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment