Amazon Web Services (AWS) Elastic Container Service (ECS) - Delete a Task Definition using the AWS CLI
by
Jeremy Canfield |
Updated: October 23 2023
| Amazon Web Services (AWS) Elastic Container Service (ECS) articles
This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.
A Task Definition is kind of like a Dockerfile or a Kubernetes deployment YAML file, in that it contains keys and values that are used to define how something should be, such as the settings for a container.
The aws ecs list-task-definitions command can be used to list the ECS Task Definitions that have been created. Something like this should be returned.
~]$ aws ecs list-task-definitions
{
"taskDefinitionArns": [
"arn:aws:ecs:us-east-1:123456789012:task-definition/my-task-definition:1",
"arn:aws:ecs:us-east-1:123456789012:task-definition/my-task-definition:2"
]
}
The aws ecs deregister-task-definition command can be used to delete a Task Definition using the Amazon Resource Number (ARN) from the prior command.
aws ecs deregister-task-definition --task-definition arn:aws:ecs:us-east-1:123456789012:task-definition/my-task-definition:2
Did you find this article helpful?
If so, consider buying me a coffee over at