Description
For a rolling deployment, plan how many healthy tasks must keep running and where replacements can start. If you omit deployment_configuration, the service uses its defaults.
Potential impact
Too few healthy tasks can interrupt service. A deployment can stall if no eligible instance can start a replacement.
Remediation
Apply minimum_healthy_percent and maximum_percent to desired_count to get the deployment limits. Check spare capacity on instances that meet the placement constraint and watch task health during rollout.
Examples
Both excerpts request three tasks for the same EC2 replica service. Supply the named cluster, task definition and instances matching flavor==test.
Before
- 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
After
- 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
The 75% minimum rounds up to three and the 150% maximum rounds down to four. Starting a replacement while the three existing tasks remain requires room for one more task.