Monitor Capacity Reservations utilization using EventBridge
AWS Health sends events to Amazon EventBridge when a Capacity Reservation in your account is below 20 percent usage over certain periods. With EventBridge, you can establish rules that trigger programmatic actions in response to such events. For example, you can create a rule that automatically cancels a Capacity Reservation when its utilization drops below 20 percent utilization over a 7-day period.
Events in EventBridge are represented as JSON objects. The fields that are unique to the event are contained in the "detail" section of the JSON object. The "event" field contains the event name. The "result" field contains the completed status of the action that triggered the event. For more information, see Amazon EventBridge event patterns in the Amazon EventBridge User Guide.
For more information, see the Amazon EventBridge User Guide.
This feature is not supported in AWS GovCloud (US).
Contents
Events
AWS Health sends the following events when capacity usage for a Capacity Reservation is below 20 percent.
AWS_EC2_ODCR_UNDERUTILIZATION_NOTIFICATION
The following is an example of an event that is generated when a newly created Capacity Reservation is below 20 percent capacity usage over a 24-hour period.
{ "version": "0", "id": "b3e00086-f271-12a1-a36c-55e8ddaa130a", "detail-type": "AWS Health Event", "source": "aws.health", "account": "123456789012", "time": "2023-03-10T12:03:38Z", "region": "ap-south-1", "resources": [ "cr-01234567890abcdef" ], "detail": { "eventArn": "arn:aws:health:ap-south-1::event/EC2/AWS_EC2_ODCR_UNDERUTILIZATION_NOTIFICATION/AWS_EC2_ODCR_UNDERUTILIZATION_NOTIFICATION_cr-01234567890abcdef-6211-4d50-9286-0c9fbc243f04", "service": "EC2", "eventTypeCode": "AWS_EC2_ODCR_UNDERUTILIZATION_NOTIFICATION", "eventTypeCategory": "accountNotification", "startTime": "Fri, 10 Mar 2023 12:03:38 GMT", "endTime": "Fri, 10 Mar 2023 12:03:38 GMT", "eventDescription": [ { "language": "en_US", "latestDescription": "
A description of the event will be provided here
" } ], "affectedEntities": [ { "entityValue": "cr-01234567890abcdef" } ] } }
AWS_EC2_ODCR_UNDERUTILIZATION_NOTIFICATION_SUMMARY
The following is an example of an event that is generated when one or more Capacity Reservation is below 20 percent capacity usage over a 7-day period.
{ "version": "0", "id":"7439d42b-3c7f-ad50-6a88-25e2a70977e2", "detail-type": "AWS Health Event", "source": "aws.health", "account": "123456789012", "time": "2023-03-07T06:06:01Z", "region": "us-east-1", "resources": [ "cr-01234567890abcdef | us-east-1b | t3.medium | Linux/UNIX | 0.0%", "cr-09876543210fedcba | us-east-1a | t3.medium | Linux/UNIX | 0.0%" ], "detail": { "eventArn": "arn:aws:health:us-east-1::event/EC2/AWS_EC2_ODCR_UNDERUTILIZATION_NOTIFICATION_SUMMARY/AWS_EC2_ODCR_UNDERUTILIZATION_NOTIFICATION_SUMMARY_726c1732-d6f6-4037-b9b8-bec3c2d3ba65", "service": "EC2", "eventTypeCode": "AWS_EC2_ODCR_UNDERUTILIZATION_NOTIFICATION_SUMMARY", "eventTypeCategory": "accountNotification", "startTime": "Tue, 7 Mar 2023 06:06:01 GMT", "endTime": "Tue, 7 Mar 2023 06:06:01 GMT", "eventDescription": [ { "language": "en_US", "latestDescription": "
A description of the event will be provided here
" } ], "affectedEntities": [ { "entityValue": "cr-01234567890abcdef | us-east-1b | t3.medium | Linux/UNIX | 0.0%" }, { "entityValue": "cr-09876543210fedcba | us-east-1a | t3.medium | Linux/UNIX | 0.0%" } ] } }
Create an EventBridge rule
To receive email notifications when your Capacity Reservation utilization drops below 20 percent,
create an Amazon SNS topic, and then create an EventBridge rule for the
AWS_EC2_ODCR_UNDERUTILIZATION_NOTIFICATION
event.
To create the Amazon SNS topic
-
Open the Amazon SNS console at https://console.aws.amazon.com/sns/v3/home
. -
In the navigation pane, choose Topics, and then choose Create topic.
-
For Type, choose Standard.
-
For Name, enter a name for the new topic.
-
Choose Create topic.
-
Choose Create subscription.
-
For Protocol, choose Email, and then for Endpoint, enter the email address that receives the notifications.
-
Choose Create subscription.
-
The email address entered above will receive email message with the following subject line:
AWS Notification - Subscription Confirmation
. Follow the directions to confirm your subscription.
To create the EventBridge rule
-
Open the Amazon EventBridge console at https://console.aws.amazon.com/events/
. -
In the navigation pane, choose Rules, and then choose Create rule.
-
For Name, enter a name for the new rule.
-
For Rule type, choose Rule with an event pattern.
-
Choose Next.
-
In the Event pattern, do the following:
-
For Event source, choose AWS services.
-
For AWS service, choose AWS Health.
-
For Event type, choose EC2 ODCR Underutilization Notification.
-
-
Choose Next.
-
For Target 1, do the following:
-
For Target types, choose AWS service.
-
For Select a target, choose SNS topic.
-
For Topic, choose the topic that you created earlier.
-
-
Choose Next and then Next again.
-
Choose Create rule.