ECS 서비스 배포 가용성 설정 점검

ECS 배포 중 필요한 정상 태스크 수와 실행 여유 용량을 함께 확인하세요.

설명

롤링 배포 시 계속 실행할 정상 태스크 수와 교체 태스크를 배치할 용량을 함께 정하세요. deployment_configuration을 생략하면 서비스 기본값이 적용됩니다.

잠재적 영향

처리 용량이 부족해지거나 새 태스크를 배치하지 못해 배포가 멈출 수 있습니다.

해결 방법

desired_count에 minimum_healthy_percent와 maximum_percent를 적용해 최소·최대 태스크 수를 계산하세요. 배치 조건을 만족하는 인스턴스에 여유 용량이 있는지 확인하고 배포 중 태스크 상태를 점검하세요.

예시

두 예시는 같은 EC2 복제 서비스에 태스크 3개를 요청합니다. 지정한 클러스터와 태스크 정의, flavor==test 조건을 만족하는 인스턴스가 필요합니다.

변경 전

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

변경 후

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

75%인 최소 수는 올림해 3개, 150%인 최대 수는 내림해 4개입니다. 기존 태스크를 유지한 채 교체를 시작하려면 한 개를 더 배치할 공간이 필요합니다.

참조