{"id":15998656,"url":"https://github.com/manics/aws-ecr-registry-cleaner","last_synced_at":"2025-03-15T10:11:21.563Z","repository":{"id":197653854,"uuid":"658497979","full_name":"manics/aws-ecr-registry-cleaner","owner":"manics","description":"A simple utility to delete ECR images older than a specified number of days","archived":false,"fork":false,"pushed_at":"2024-12-01T20:13:57.000Z","size":52,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-22T00:46:46.413Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-25T23:07:23.000Z","updated_at":"2024-10-02T19:24:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"3af893a4-fbe8-4097-8aba-fd7854715661","html_url":"https://github.com/manics/aws-ecr-registry-cleaner","commit_stats":null,"previous_names":["manics/aws-ecr-registry-cleaner"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manics%2Faws-ecr-registry-cleaner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manics%2Faws-ecr-registry-cleaner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manics%2Faws-ecr-registry-cleaner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manics%2Faws-ecr-registry-cleaner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manics","download_url":"https://codeload.github.com/manics/aws-ecr-registry-cleaner/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243713415,"owners_count":20335567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-08T08:21:02.948Z","updated_at":"2025-03-15T10:11:21.543Z","avatar_url":"https://github.com/manics.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWS ECR Registry cleaner\n\n[![Go](https://github.com/manics/aws-ecr-registry-cleaner/actions/workflows/build.yml/badge.svg)](https://github.com/manics/aws-ecr-registry-cleaner/actions/workflows/build.yml)\n\nA simple utility to delete ECR images older than a specified number of days.\n\nThis utility scans all repositories in an ECR registry and deletes images that haven't been pulled.\n\nECR supports [lifecycle policies](https://docs.aws.amazon.com/AmazonECR/latest/userguide/LifecyclePolicies.html), but currently deleting an image that hasn't been pulled for a specified number of days (`sinceImagePulled`) is not supported:\nhttps://github.com/aws/containers-roadmap/issues/921\n\nIf it's added in the future this utility will not be needed.\n\n## Build and run locally\n\nYou must install [Go 1.20](https://tip.golang.org/doc/go1.20).\nIf you are a Python developer using [Conda](https://docs.conda.io/en/latest/) or [Mamba](https://mamba.readthedocs.io/) and just want a quick way to install Go:\n\n```\nconda create -n go -c conda-forge go=1.20 go-cgo=1.20\nconda activate go\n```\n\n```\nmake build\nmake test\n```\n\nRun with Amazon Web Services using the local [AWS credentials](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html):\n\nDelete images that haven't been pulled for at least 7 days, then exit:\n\n```\naws-ecr-registry-cleaner -expires-after-pull-days=7\n```\n\nDelete all images\n\n```\naws-ecr-registry-cleaner -expires-after-pull-days=0\n```\n\nDelete images that haven't been pulled for at least 7 days, then re-run after one hour:\n\n```\naws-ecr-registry-cleaner -expires-after-pull-days=7 -loop-delay=3600\n```\n\nFor for help run\n\n```\naws-ecr-registry-cleaner -help\n```\n\n## Build and run container\n\n```\npodman build -t aws-ecr-registry-cleaner .\n```\n\nDelete images that haven't been pulled for at least 7 days:\n\n```\npodman run --rm -it \\\n  -eAWS_REGION=region \\\n  -eAWS_ACCESS_KEY_ID=access-key \\\n  -eAWS_SECRET_ACCESS_KEY=secret-key \\\n  aws-ecr-registry-cleaner -expires-after-pull-days=7\n```\n\n## Running in the cloud\n\nThe recommended way to run this service is to use an IAM\n[instance profile (AWS)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html)\nto authenticate with the cloud provider.\n\n## Development\n\nBuild and run\n\n```\nmake build\nmake test\n```\n\nFor more detailed testing of a single test:\n\n```\ngo test -v ./amazon/ -run TestScanAndDeleteRepos\n```\n\nUpdate modules:\n\n```\nmake update-deps\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanics%2Faws-ecr-registry-cleaner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanics%2Faws-ecr-registry-cleaner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanics%2Faws-ecr-registry-cleaner/lists"}