Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

ecs task remove

#!/usr/bin/env bash

get_task_definition_arns() {
    aws ecs list-task-definitions --region <region> --family-prefix <task-definition> 
        | jq -M -r '.taskDefinitionArns | .[]'
}

delete_task_definition() {
    local arn=$1

    aws ecs deregister-task-definition 
        --region <region> 
        --task-definition "${arn}" > /dev/null
}

for arn in $(get_task_definition_arns)
do
    echo "Deregistering ${arn}..."
    delete_task_definition "${arn}"
done
Source by devcoops.com #
 
PREVIOUS NEXT
Tagged: #ecs #task #remove
ADD COMMENT
Topic
Name
6+2 =