Delete an ECS task definition using AWS CLI
A bash script for deleting ECS task definitions using the AWS CLI
Installation
Download the script below and use chmod to make it executable:
chmod +x delete-tasks.sh
Script
Usage
Modify the following variables to use the script:
TASKNAME- The task definition family to delete from. Useaws ecs list-task-definitionsto list task definitions if you are unsure.START- The revision number to start deleting fromEND- The revision number to stop deleting at
Note that task definitions are 1 based, not zero based, so to delete the first 1000 task definition revisions set START=1 and END=1000
âšī¸ Info: Deleting task definitions may take a while. The task definitions will not be instantly deleted. Instead they will transition to DELETE_IN_PROGRESS state and ECS will gradually clean up these task definitions in the background when they are no longer in use by any ECS services or running tasks.