aws ecs register-task-definition: New ECS Revision in CI
Register a new task definition revision pointing at a freshly built image.
aws ecs register-task-definition creates a new immutable revision of a task definition, typically with an updated container image tag. In CI you render a JSON file with the new image, register it, capture the revision, then call update-service.
Common flags
--cli-input-json file://taskdef.json- supply the full task definition from a file--family- the task definition family name--container-definitions- inline container array (alternative to a file)--query "taskDefinition.revision"- capture the new revision number
Example in CI
Register a rendered task definition and capture the revision.
shell
aws ecs register-task-definition --cli-input-json file://taskdef.json --query "taskDefinition.revision" --output textCommon errors in CI
- An error occurred (ClientException) - invalid or missing required task definition fields
- Error parsing parameter cli-input-json - malformed JSON or wrong file:// path
- An error occurred (AccessDeniedException) - role lacks ecs:RegisterTaskDefinition or iam:PassRole
Key takeaways
- register-task-definition creates a new immutable revision from JSON.
- It commonly needs iam:PassRole for the task execution role.
- Capture taskDefinition.revision to feed into ecs update-service.
Related guides
aws ecs update-service: Deploy to ECS in CIaws ecs update-service triggers a new ECS deployment with an updated task definition. Learn the force-new-dep…
aws ecs describe-services: Check ECS Rollout in CIaws ecs describe-services reports the status, deployments, and running counts of ECS services. Use it in CI t…
aws iam create-role: Create an IAM Role for CIaws iam create-role creates an IAM role with a trust policy - including the OIDC trust used by GitHub Actions…