{"id":19853876,"url":"https://github.com/magnetikonline/aws-ecs-task-definition-cleanup","last_synced_at":"2025-05-02T01:30:25.591Z","repository":{"id":182445034,"uuid":"642665603","full_name":"magnetikonline/aws-ecs-task-definition-cleanup","owner":"magnetikonline","description":"Python CLI utility to help maintain legacy AWS ECS task definitions in bulk.","archived":false,"fork":false,"pushed_at":"2024-11-26T01:15:16.000Z","size":5,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T20:25:03.214Z","etag":null,"topics":["aws","aws-ecs","docker","task-definition"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magnetikonline.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}},"created_at":"2023-05-19T04:40:34.000Z","updated_at":"2025-02-14T23:10:34.000Z","dependencies_parsed_at":"2023-12-22T05:20:41.628Z","dependency_job_id":null,"html_url":"https://github.com/magnetikonline/aws-ecs-task-definition-cleanup","commit_stats":null,"previous_names":["magnetikonline/aws-ecs-task-definition-cleanup"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magnetikonline%2Faws-ecs-task-definition-cleanup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magnetikonline%2Faws-ecs-task-definition-cleanup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magnetikonline%2Faws-ecs-task-definition-cleanup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magnetikonline%2Faws-ecs-task-definition-cleanup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magnetikonline","download_url":"https://codeload.github.com/magnetikonline/aws-ecs-task-definition-cleanup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251969232,"owners_count":21673180,"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":["aws","aws-ecs","docker","task-definition"],"created_at":"2024-11-12T14:07:57.596Z","updated_at":"2025-05-02T01:30:25.338Z","avatar_url":"https://github.com/magnetikonline.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWS ECS task definition cleanup\n\nPython CLI utility to help maintain legacy [AWS ECS task definitions](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html).\n\nThe utility offers the following:\n\n- Set task definitions `ACTIVE` -\u003e `INACTIVE` that are not associated to ECS tasks.\n- Mark currently `INACTIVE` task definitions for deletion by ECS.\n\n## Requirements\n\n- Python 3.10+\n- [Boto3](https://boto3.amazonaws.com/v1/documentation/api/latest/index.html)\n\t```sh\n\tpip install boto3\n\t```\n\n## Usage\n\n**Note:** adding a `--commit` argument will **apply changes** to ECS task definitions, otherwise all commands are executed in a safe \"dry run\" mode.\n\nLocate task definitions unused by ECS tasks, set `INACTIVE`:\n\n```sh\nAWS_REGION=\"ap-southeast-2\" \\\n  ./cleanup.py --set-inactive\n```\n\nBy default `--set-inactive` _will not_ mark task definitions `INACTIVE` if _any version_ of said definition is in use.\n\nFor example:\n\n- Task definition `arn:aws:ecs:REGION:ACCOUNT_ID:task-definition/my-task-definition:123` is currently in use by an ECS task.\n- Utility locates unused task definition `arn:aws:ecs:REGION:ACCOUNT_ID:task-definition/my-task-definition:666`, but will not mark `INACTIVE` as there are other `my-task-definition:*` definition versions in use.\n\nIn order to set all unused task definition _versions_ `INACTIVE` - only leaving in use definition versions `ACTIVE`:\n\n```sh\nAWS_REGION=\"ap-southeast-2\" \\\n  ./cleanup.py --set-inactive=aggressive\n```\n\nMark currently `INACTIVE` task definitions for deletion by the ECS subsystem:\n\n```sh\nAWS_REGION=\"ap-southeast-2\" \\\n  ./cleanup.py --delete-inactive\n```\n\nFinally, both operations can be executed together:\n\n```sh\nAWS_REGION=\"ap-southeast-2\" \\\n  ./cleanup.py --set-inactive=aggressive --delete-inactive\n```\n\n## Reference\n\n- https://aws.amazon.com/blogs/containers/announcing-amazon-ecs-task-definition-deletion/\n- https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deregister-task-definition-v2.html\n- https://docs.aws.amazon.com/AmazonECS/latest/developerguide/delete-task-definition-v2.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagnetikonline%2Faws-ecs-task-definition-cleanup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagnetikonline%2Faws-ecs-task-definition-cleanup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagnetikonline%2Faws-ecs-task-definition-cleanup/lists"}