Overview
I had an opportunity to bulk delete Amazon ECR repositories, so here are my notes. Please exercise caution when running these commands.
Creating a List of Repositories
I referenced the following article.

aws cliでECSのリポジトリ内にどんなimageタグがbuildされているかワンライナーで答える - Qiita
時間の無い人向け 下記コマンドののところをご自身のECS(Amazon EC2 Container Service)に登録されたrepositoryNameに置き換えて実行します。 $ aws ecr list-images --repos...
Run the following command.
aws ecr describe-repositories --output json | jq -re ".repositories[].repositoryName" > repository.list
On macOS, if you don't have the jq command, install it with brew install jq.
Deletion
Run the following command. The --force flag is used to delete even if images exist.
for X in `awk '{print $1}' repository.list` ; do aws ecr delete-repository --repository-name $X --force ; done
Summary
Please exercise sufficient caution when using these commands. I hope this serves as a helpful reference.




Comments
…