Review ECS service deployment availability

Review healthy task requirements and spare capacity for ECS deployments together.

Description

An ECS service needs enough healthy tasks during deployment and replacement to limit service interruption. Incompatible deployment settings, health checks and capacity can leave too few tasks or prevent a deployment from progressing. Omitting deployment_configuration still permits service defaults to apply; omission alone does not mean that no tasks are running.

Potential impact

  • Processing capacity may fall or the service may be interrupted during deployment.
  • Insufficient room for new tasks can delay deployment or recovery.

Remediation

  • Review desired_count, minimum_healthy_percent and maximum_percent for the service’s deployment method. Convert percentages to actual task counts to provide enough healthy tasks and replacement capacity.
  • Review placement constraints, cluster capacity and health checks together, and test deployments under operating conditions.

Examples

These examples assume a rolling deployment of an EC2-backed replica service. They require a cluster, task definition and instances that satisfy the placement constraint.

Before

yaml
- name: ECS 서비스 생성
  community.aws.ecs_service:
    state: present
    name: test-service
    cluster: test-cluster
    task_definition: test-task-definition
    desired_count: 3
    placement_constraints:
      - type: memberOf
        expression: "attribute:flavor==test"
    placement_strategy:
      - type: binpack
        field: memory

This requests three tasks without explicit deployment percentages. Check the effective defaults and available capacity.

After

yaml
- name: ECS 서비스 생성
  community.aws.ecs_service:
    state: present
    name: test-service
    cluster: test-cluster
    task_definition: test-task-definition
    desired_count: 3
    deployment_configuration:
      minimum_healthy_percent: 75
      maximum_percent: 150
    placement_constraints:
      - type: memberOf
        expression: "attribute:flavor==test"
    placement_strategy:
      - type: binpack
        field: memory

For three desired tasks, the 75% minimum rounds up to three, and the 150% maximum rounds down to four. Capacity for one additional task is needed to use this deployment configuration.

References