ECS (Elastic Container Service)
aws-annoying ecs task-definition-lifecycle
Expire and delete ECS task definitions.
Expire and delete ECS task definitions for a given family, keeping revisions adhering to the given constraint. You can use this command to clean up old task definitions that are no longer needed.
Example usage:
aws-annoying ecs task-definition-lifecycle \
--family <task-definition-family> \
--keep-latest 5 \
--delete
Source code in aws_annoying/cli/ecs/task_definition_lifecycle.py
aws-annoying ecs wait-for-deployment
Wait for ECS deployment for a specific service to start, complete and stabilize.
It's designed to be used after triggering a deployment (e.g., updating service, deploying new task definition), in conjunction with CI/CD pipelines or deployment scripts.
Below is an example of using this command in GitHub Actions workflow:
...
- name: Deploy to ECS service
id: deploy-ecs
uses: aws-actions/amazon-ecs-deploy-task-definition@v2
with:
task-definition: ${{ steps.render-task-definition.outputs.task-definition }}
cluster: ${{ vars.AWS_ECS_CLUSTER }}
service: ${{ vars.AWS_ECS_SERVICE }}
wait-for-service-stability: false
- name: Wait for deployment complete
run: |
pipx run aws-annoying \
--verbose \
ecs wait-for-deployment \
--cluster '${{ vars.AWS_ECS_CLUSTER }}' \
--service '${{ vars.AWS_ECS_SERVICE }}' \
--wait-for-start \
--wait-for-stability \
--timeout-seconds 600 \
--expected-task-definition '${{ steps.deploy-ecs.outputs.task-definition-arn }}'
...
--wait-for-start is necessary because there could be no deployment right after the deploy action.
Source code in aws_annoying/cli/ecs/wait_for_deployment.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |