Amazon EC2 Auto Scaling 事件參考 - Amazon EC2 Auto Scaling

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

Amazon EC2 Auto Scaling 事件參考

使用 Amazon EventBridge,您可以建立符合傳入事件規則,並將其路由到目標進行處理。

生命週期動作事件

當您將生命週期掛鉤新增到自動擴展群組時,Amazon EC2 Auto Scaling 會在執行個體轉換為等待狀態 EventBridge時傳送事件至。盡可能產生事件。

橫向擴展生命週期動作

下列範例事件說明了由於啟動 lifecycle hook,Amazon EC2 Auto Scaling 已將執行個體移至 Pending:Wait 狀態。

{ "version": "0", "id": "12345678-1234-1234-1234-123456789012", "detail-type": "EC2 Instance-launch Lifecycle Action", "source": "aws.autoscaling", "account": "123456789012", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-west-2", "resources": [ "auto-scaling-group-arn" ], "detail": { "LifecycleActionToken": "87654321-4321-4321-4321-210987654321", "AutoScalingGroupName": "my-asg", "LifecycleHookName": "my-lifecycle-hook", "EC2InstanceId": "i-1234567890abcdef0", "LifecycleTransition": "autoscaling:EC2_INSTANCE_LAUNCHING", "NotificationMetadata": "additional-info", "Origin": "EC2", "Destination": "AutoScalingGroup" } }

縮減生命週期動作

下列範例事件說明了由於終止 lifecycle hook,Amazon EC2 Auto Scaling 已將執行個體移至 Terminating:Wait 狀態。

重要

當 Auto Scaling 群組在縮減時將執行個體傳回暖集區時,執行個體傳回暖集區也可能會產生 EC2 Instance-terminate Lifecycle Action 事件。在縮減時將執行個體移至等待狀態時,交付的事件會以 WarmPool 作為 Destination 的值。如需詳細資訊,請參閱 Instance reuse policy

{ "version": "0", "id": "12345678-1234-1234-1234-123456789012", "detail-type": "EC2 Instance-terminate Lifecycle Action", "source": "aws.autoscaling", "account": "123456789012", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-west-2", "resources": [ "auto-scaling-group-arn" ], "detail": { "LifecycleActionToken":"87654321-4321-4321-4321-210987654321", "AutoScalingGroupName":"my-asg", "LifecycleHookName":"my-lifecycle-hook", "EC2InstanceId":"i-1234567890abcdef0", "LifecycleTransition":"autoscaling:EC2_INSTANCE_TERMINATING", "NotificationMetadata":"additional-info", "Origin": "AutoScalingGroup", "Destination": "EC2" } }

成功的擴展事件

下列範例顯示成功的擴展事件的事件類型。盡可能產生事件。

成功的橫向擴展事件

下列範例事件說明 Amazon EC2 Auto Scaling 成功啟動執行個體。

{ "version": "0", "id": "12345678-1234-1234-1234-123456789012", "detail-type": "EC2 Instance Launch Successful", "source": "aws.autoscaling", "account": "123456789012", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-west-2", "resources": [ "auto-scaling-group-arn", "instance-arn" ], "detail": { "StatusCode": "InProgress", "Description": "Launching a new EC2 instance: i-12345678", "AutoScalingGroupName": "my-asg", "ActivityId": "87654321-4321-4321-4321-210987654321", "Details": { "Availability Zone": "us-west-2b", "Subnet ID": "subnet-12345678" }, "RequestId": "12345678-1234-1234-1234-123456789012", "StatusMessage": "", "EndTime": "yyyy-mm-ddThh:mm:ssZ", "EC2InstanceId": "i-1234567890abcdef0", "StartTime": "yyyy-mm-ddThh:mm:ssZ", "Cause": "description-text", "Origin": "EC2", "Destination": "AutoScalingGroup" } }

成功的縮減事件

下列範例事件說明 Amazon EC2 Auto Scaling 成功終止執行個體。

重要

當 Auto Scaling 群組在縮減時將執行個體傳回暖集區時,將執行個體傳回暖集區也可能會產生 EC2 Instance Terminate Successful 事件。執行個體成功傳回暖集區時,交付的事件會以 WarmPool 作為 Destination 的值。如需詳細資訊,請參閱 Instance reuse policy

{ "version": "0", "id": "12345678-1234-1234-1234-123456789012", "detail-type": "EC2 Instance Terminate Successful", "source": "aws.autoscaling", "account": "123456789012", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-west-2", "resources": [ "auto-scaling-group-arn", "instance-arn" ], "detail": { "StatusCode": "InProgress", "Description": "Terminating EC2 instance: i-12345678", "AutoScalingGroupName": "my-asg", "ActivityId": "87654321-4321-4321-4321-210987654321", "Details": { "Availability Zone": "us-west-2b", "Subnet ID": "subnet-12345678" }, "RequestId": "12345678-1234-1234-1234-123456789012", "StatusMessage": "", "EndTime": "yyyy-mm-ddThh:mm:ssZ", "EC2InstanceId": "i-1234567890abcdef0", "StartTime": "yyyy-mm-ddThh:mm:ssZ", "Cause": "description-text", "Origin": "AutoScalingGroup", "Destination": "EC2" } }

不成功的擴展事件

下列範例顯示不成功的擴展事件的事件類型。盡可能產生事件。

不成功的橫向擴展事件

下列範例事件說明 Amazon EC2 Auto Scaling 無法啟動執行個體。

{ "version": "0", "id": "12345678-1234-1234-1234-123456789012", "detail-type": "EC2 Instance Launch Unsuccessful", "source": "aws.autoscaling", "account": "123456789012", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-west-2", "resources": [ "auto-scaling-group-arn", "instance-arn" ], "detail": { "StatusCode": "Failed", "AutoScalingGroupName": "my-asg", "ActivityId": "87654321-4321-4321-4321-210987654321", "Details": { "Availability Zone": "us-west-2b", "Subnet ID": "subnet-12345678" }, "RequestId": "12345678-1234-1234-1234-123456789012", "StatusMessage": "message-text", "EndTime": "yyyy-mm-ddThh:mm:ssZ", "EC2InstanceId": "i-1234567890abcdef0", "StartTime": "yyyy-mm-ddThh:mm:ssZ", "Cause": "description-text", "Origin": "EC2", "Destination": "AutoScalingGroup" } }

不成功的縮減事件

下列範例事件說明 Amazon EC2 Auto Scaling 無法終止執行個體。

重要

當 Auto Scaling 群組在縮減時將執行個體傳回暖集區時,無法將執行個體傳回暖集區也可能會產生 EC2 Instance Terminate Unsuccessful 事件。執行個體無法傳回暖集區時,交付的事件會以 WarmPool 作為 Destination 的值。如需詳細資訊,請參閱 Instance reuse policy

{ "version": "0", "id": "12345678-1234-1234-1234-123456789012", "detail-type": "EC2 Instance Terminate Unsuccessful", "source": "aws.autoscaling", "account": "123456789012", "time": "yyyy-mm-ddThh:mm:ssZ", "region": "us-west-2", "resources": [ "auto-scaling-group-arn", "instance-arn" ], "detail": { "StatusCode": "Failed", "AutoScalingGroupName": "my-asg", "ActivityId": "87654321-4321-4321-4321-210987654321", "Details": { "Availability Zone": "us-west-2b", "Subnet ID": "subnet-12345678" }, "RequestId": "12345678-1234-1234-1234-123456789012", "StatusMessage": "message-text", "EndTime": "yyyy-mm-ddThh:mm:ssZ", "EC2InstanceId": "i-1234567890abcdef0", "StartTime": "yyyy-mm-ddThh:mm:ssZ", "Cause": "description-text", "Origin": "AutoScalingGroup", "Destination": "EC2" } }

執行個體重新整理事件

下列範例顯示執行個體重新整理功能的事件。盡可能產生事件。

達到檢查點

當已取代的執行個體數目達到針對檢查點定義的百分比閾值時,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" } }