Amazon EC2 Auto Scaling 事件参考 - Amazon A EC2 uto Scaling

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

Amazon EC2 Auto Scaling 事件参考

使用 Amazon EventBridge,您可以创建匹配传入事件规则,并将它们路由到目标进行处理。

生命周期操作事件

当您向 Auto Scaling 组添加生命周期挂钩时,Amazon EC2 Auto Scaling 会在实例过渡到等待状态 EventBridge时向发送事件。事件会尽可能生成。

横向扩展生命周期操作

在此示例事件中,由于启动生命周期挂钩的原因,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" } }

横向缩减生命周期操作

在此示例事件中,由于终止生命周期挂钩的原因,Amazon EC2 Auto Scaling 已将一个实例移至 Terminating:Wait 状态。

重要

当自动扩缩组在横向缩减时将实例退回暖池的情况下,将实例退回暖池也会生成 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 成功终止了一个实例。

重要

当自动扩缩组在横向缩减时将实例退回暖池的情况下,将实例退回暖池也会生成 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 未能终止一个实例。

重要

当自动扩缩组在横向缩减时将实例退回暖池的情况下,未能将实例退回暖池也会生成 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" } }

实例刷新已开始

Amazon EC2 Auto Scaling 将在实例刷新状态更改为 InProgress 时发出以下事件。

{ "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" } }

实例刷新成功

Amazon EC2 Auto Scaling 将在实例刷新状态更改为 Successful 时发出以下事件。

{ "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" } }

实例刷新失败

Amazon EC2 Auto Scaling 将在实例刷新状态更改为 Failed 时发出以下事件。

{ "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" } }

实例刷新已取消

Amazon EC2 Auto Scaling 将在实例刷新状态更改为 Cancelled 时发出以下事件。

{ "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" } }

实例刷新回滚已开始

Amazon EC2 Auto Scaling 将在实例刷新状态更改为 RollbackInProgress 时发出以下事件。

{ "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" } }

实例刷新回滚成功

Amazon EC2 Auto Scaling 将在实例刷新状态更改为 RollbackSuccessful 时发出以下事件。

{ "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" } }

实例刷新回滚失败

Amazon EC2 Auto Scaling 将在实例刷新状态更改为 Failed 时发出以下事件。

{ "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" } }