Amazon EC2 Auto Scaling event reference - Amazon EC2 Auto Scaling

Amazon EC2 Auto Scaling event reference

Using Amazon EventBridge, you can create rules that match incoming events and route them to targets for processing.

Lifecycle action events

When you add lifecycle hooks to your Auto Scaling group, Amazon EC2 Auto Scaling sends events to EventBridge when an instance transitions into a wait state. Events are produced on a best-effort basis.

Scale-out lifecycle action

The following example event shows that Amazon EC2 Auto Scaling moved an instance to a Pending:Wait state due to a launch lifecycle hook.

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

Scale-in lifecycle action

The following example event shows that Amazon EC2 Auto Scaling moved an instance to a Terminating:Wait state due to a termination lifecycle hook.

Important

When an Auto Scaling group returns instances to a warm pool on scale in, returning instances to the warm pool can also generate EC2 Instance-terminate Lifecycle Action events. Events that are delivered when an instance moves to the wait state on scale in have WarmPool as the value for Destination. For more information, see 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" } }

Successful scaling events

The following examples show the event types for successful scaling events. Events are produced on a best-effort basis.

Successful scale-out event

The following example event shows that Amazon EC2 Auto Scaling successfully launched an instance.

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

Successful scale-in event

The following example event shows that Amazon EC2 Auto Scaling successfully terminated an instance.

Important

When an Auto Scaling group returns instances to a warm pool on scale in, returning instances to the warm pool can also generate EC2 Instance Terminate Successful events. Events that are delivered when an instance successfully returns to the warm pool have WarmPool as the value for Destination. For more information, see 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" } }

Unsuccessful scaling events

The following examples show the event types for unsuccessful scaling events. Events are produced on a best-effort basis.

Unsuccessful scale-out event

The following example event shows that Amazon EC2 Auto Scaling failed to launch an instance.

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

Unsuccessful scale-in event

The following example event shows that Amazon EC2 Auto Scaling failed to terminate an instance.

Important

When an Auto Scaling group returns instances to a warm pool on scale in, failing to return instances to the warm pool can also generate EC2 Instance Terminate Unsuccessful events. Events that are delivered when an instance fails to return to the warm pool have WarmPool as the value for Destination. For more information, see 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" } }

Instance refresh events

The following examples show events for the instance refresh feature. Events are produced on a best-effort basis.

Checkpoint reached

When the number of instances that have been replaced reaches the percentage threshold defined for the checkpoint, Amazon EC2 Auto Scaling sends the following event.

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

Instance refresh started

When the status of an instance refresh changes to InProgress, Amazon EC2 Auto Scaling sends the following event.

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

Instance refresh succeeded

When the status of an instance refresh changes to Successful, Amazon EC2 Auto Scaling sends the following event.

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

Instance refresh failed

When the status of an instance refresh changes to Failed, Amazon EC2 Auto Scaling sends the following event.

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

Instance refresh cancelled

When the status of an instance refresh changes to Cancelled, Amazon EC2 Auto Scaling sends the following event.

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

Instance refresh rollback started

When the status of an instance refresh changes to RollbackInProgress, Amazon EC2 Auto Scaling sends the following event.

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

Instance refresh rollback succeeded

When the status of an instance refresh changes to RollbackSuccessful, Amazon EC2 Auto Scaling sends the following event.

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

Instance refresh rollback failed

When the status of an instance refresh changes to Failed, Amazon EC2 Auto Scaling sends the following event.

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