인스턴스 새로 고침 예제 이벤트 및 패턴 - Amazon EC2 Auto Scaling

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

인스턴스 새로 고침 예제 이벤트 및 패턴

Amazon EventBridge를 사용하여 수신 이벤트와 일치하는 규칙을 생성하고 처리 대상으로 라우팅할 수 있습니다.

인스턴스 새로 고침 이벤트

다음 예는 인스턴스 새로 고침 기능에 대한 이벤트를 보여줍니다. 이벤트는 최선의 작업에 근거하여 생성됩니다.

체크포인트 도달

교체된 인스턴스의 수가 체크포인트에 정의된 백분율 임계값에 도달하면 Amazon EC2 Auto Scaling은 다음 이벤트를 보냅니다.

{ "version": "0", "id": "12345678-1234-1234-1234-123456789012", "detail-type": "EC2 Auto Scaling Instance Refresh Checkpoint Reached", "source": "aws.autoscaling", "account": "123456789012", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-west-2", "resources": [ "auto-scaling-group-arn" ], "detail": { "InstanceRefreshId": "ab00cf8f-9126-4f3c-8010-dbb8cad6fb86", "AutoScalingGroupName": "my-asg", "CheckpointPercentage": "50", "CheckpointDelay": "300" } }

인스턴스 새로 고침 시작됨

인스턴스 새로 고침 상태가 InProgress로 바뀌면 Amazon EC2 Auto Scaling이 다음 이벤트를 보냅니다.

{ "version": "0", "id": "12345678-1234-1234-1234-123456789012", "detail-type": "EC2 Auto Scaling Instance Refresh Started", "source": "aws.autoscaling", "account": "123456789012", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-west-2", "resources": [ "auto-scaling-group-arn" ], "detail": { "InstanceRefreshId": "c613620e-07e2-4ed2-a9e2-ef8258911ade", "AutoScalingGroupName": "my-asg" } }

인스턴스 새로 고침 성공

인스턴스 새로 고침 상태가 Successful로 바뀌면 Amazon EC2 Auto Scaling이 다음 이벤트를 보냅니다.

{ "version": "0", "id": "12345678-1234-1234-1234-123456789012", "detail-type": "EC2 Auto Scaling Instance Refresh Succeeded", "source": "aws.autoscaling", "account": "123456789012", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-west-2", "resources": [ "auto-scaling-group-arn" ], "detail": { "InstanceRefreshId": "c613620e-07e2-4ed2-a9e2-ef8258911ade", "AutoScalingGroupName": "my-asg" } }

인스턴스 새로 고침 실패

인스턴스 새로 고침 상태가 Failed로 바뀌면 Amazon EC2 Auto Scaling이 다음 이벤트를 보냅니다.

{ "version": "0", "id": "12345678-1234-1234-1234-123456789012", "detail-type": "EC2 Auto Scaling Instance Refresh Failed", "source": "aws.autoscaling", "account": "123456789012", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-west-2", "resources": [ "auto-scaling-group-arn" ], "detail": { "InstanceRefreshId": "c613620e-07e2-4ed2-a9e2-ef8258911ade", "AutoScalingGroupName": "my-asg" } }

인스턴스 새로 고침 취소됨

인스턴스 새로 고침 상태가 Cancelled로 바뀌면 Amazon EC2 Auto Scaling이 다음 이벤트를 보냅니다.

{ "version": "0", "id": "12345678-1234-1234-1234-123456789012", "detail-type": "EC2 Auto Scaling Instance Refresh Cancelled", "source": "aws.autoscaling", "account": "123456789012", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-west-2", "resources": [ "auto-scaling-group-arn" ], "detail": { "InstanceRefreshId": "c613620e-07e2-4ed2-a9e2-ef8258911ade", "AutoScalingGroupName": "my-asg" } }

인스턴스 새로 고침 롤백 시작

인스턴스 새로 고침 상태가 RollbackInProgress로 바뀌면 Amazon EC2 Auto Scaling이 다음 이벤트를 보냅니다.

{ "version": "0", "id": "12345678-1234-1234-1234-123456789012", "detail-type": "EC2 Auto Scaling Instance Refresh Rollback Started", "source": "aws.autoscaling", "account": "123456789012", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-west-2", "resources": [ "auto-scaling-group-arn" ], "detail": { "InstanceRefreshId": "c613620e-07e2-4ed2-a9e2-ef8258911ade", "AutoScalingGroupName": "my-asg" } }

인스턴스 새로 고침 롤백 성공

인스턴스 새로 고침 상태가 RollbackSuccessful로 바뀌면 Amazon EC2 Auto Scaling이 다음 이벤트를 보냅니다.

{ "version": "0", "id": "12345678-1234-1234-1234-123456789012", "detail-type": "EC2 Auto Scaling Instance Refresh Rollback Succeeded", "source": "aws.autoscaling", "account": "123456789012", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-west-2", "resources": [ "auto-scaling-group-arn" ], "detail": { "InstanceRefreshId": "c613620e-07e2-4ed2-a9e2-ef8258911ade", "AutoScalingGroupName": "my-asg" } }

인스턴스 새로 고침 롤백 실패

인스턴스 새로 고침 상태가 Failed로 바뀌면 Amazon EC2 Auto Scaling이 다음 이벤트를 보냅니다.

{ "version": "0", "id": "12345678-1234-1234-1234-123456789012", "detail-type": "EC2 Auto Scaling Instance Refresh Rollback Failed", "source": "aws.autoscaling", "account": "123456789012", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-west-2", "resources": [ "auto-scaling-group-arn" ], "detail": { "InstanceRefreshId": "c613620e-07e2-4ed2-a9e2-ef8258911ade", "AutoScalingGroupName": "my-asg" } }

인스턴스 새로 고침 루트 볼륨 수명 주기 이벤트 대체

Auto Scaling 그룹에 수명 주기 후크를 추가하면 인스턴스가 대기 상태로 전환될 때 Amazon EC2 Auto Scaling이 이벤트를 EventBridge로 보냅니다. 자세한 내용은 루트 볼륨 대체와 함께 수명 주기 후크 사용 단원을 참조하십시오.

다음 예제에서는 인스턴스 새로 고침 중에 Auto Scaling 그룹에 루트 볼륨 교체 중인 인스턴스가 있는 경우의 이벤트를 보여줍니다. 이벤트는 최선의 작업에 근거하여 발생됩니다.

루트 볼륨 수명 주기 작업 교체 시작

인스턴스 새로 고침 중에 루트 볼륨 교체를 위해 인스턴스를 선택하고 상태가 로 변경되는 경우ReplacingRootVolume:Wait.

{ "version": "0", "id": "12345678-1234-1234-1234-123456789012", "detail-type": "EC2 Instance-terminate Lifecycle Action", "source": "aws.autoscaling", "account": "123456789012", "time": "2021-01-13T00:12:37.214Z", "region": "us-west-2", "resources": [ "auto-scaling-group-arn" ], "detail": { "LifecycleActionToken": "71514b9d-6a40-4b26-8523-05e7eEXAMPLE", "AutoScalingGroupName": "my-asg", "LifecycleHookName": "my-terminate-lifecycle-hook", "EC2InstanceId": "i-1234567890abcdef0", "LifecycleTransition": "autoscaling:EC2_INSTANCE_TERMINATING", "NotificationMetadata": "additional-info", "Origin": "AutoScalingGroup", "Destination": "AutoScalingGroup", "Action": "ReplaceRootVolume" } }

루트 볼륨 수명 주기 작업 교체 종료

인스턴스가 루트 볼륨 교체를 완료하고 상태가 로 변경되면 Pending:Wait

{ "version": "0", "id": "12345678-1234-1234-1234-123456789012", "detail-type": "EC2 Instance-launch Lifecycle Action", "source": "aws.autoscaling", "account": "123456789012", "time": "2021-01-13T00:12:37.214Z", "region": "us-west-2", "resources": [ "auto-scaling-group-arn" ], "detail": { "LifecycleActionToken": "71514b9d-6a40-4b26-8523-05e7eEXAMPLE", "AutoScalingGroupName": "my-asg", "LifecycleHookName": "my-launch-lifecycle-hook", "EC2InstanceId": "i-1234567890abcdef0", "LifecycleTransition": "autoscaling:EC2_INSTANCE_LAUNCHING", "NotificationMetadata": "additional-info", "Origin": "AutoScalingGroup", "Destination": "AutoScalingGroup", "Action": "ReplaceRootVolume" } }

이벤트 패턴 예

이전 섹션에서는 루트 볼륨 대체 전략을 사용하여 인스턴스 새로 고침 중에 Amazon EC2 Auto Scaling에서 내보내는 예제 이벤트를 제공합니다. EventBridge 이벤트 패턴은 일치하는 이벤트와 동일한 구조를 갖습니다. 패턴은 일치시키려는 필드를 인용하고 찾고 있는 값을 제공합니다. 다음과 같은 이벤트 필드는 작업을 호출하는 규칙에 정의된 이벤트 패턴을 형성합니다.

"source": "aws.autoscaling"

Amazon EC2 Auto Scaling에서 시작된 이벤트를 식별합니다.

"detail-type": "EC2 Instance-launch Lifecycle Action"

이벤트 유형을 식별합니다.

"Action": "ReplaceRootVolume"

인스턴스에서 수행 중인 작업을 식별합니다.

다음 샘플 이벤트 패턴을 사용하여 루트 볼륨을 대체하기 위해 준비 중인 인스턴스와 연결된 모든 이벤트를 캡처합니다.

{ "source": [ "aws.autoscaling" ], "detail-type": [ "EC2 Instance-terminate Lifecycle Action" ], "detail": { "Action": [ "ReplaceRootVolume" ] } }

루트 볼륨 교체를 완료한 후 서비스로 반환되는 인스턴스와 연결된 모든 이벤트를 캡처하려면 다음 샘플 이벤트 패턴을 사용합니다.

{ "source": [ "aws.autoscaling" ], "detail-type": [ "EC2 Instance-launch Lifecycle Action" ], "detail": { "Action": [ "ReplaceRootVolume" ] } }