Creating EventBridge rules for instance refresh events - Amazon EC2 Auto Scaling

Creating EventBridge rules for instance refresh events

This section shows you how to create an Amazon EventBridge rule that notifies you whenever a checkpoint is reached during an instance refresh. The procedure for setting up email notifications through Amazon SNS is included. To use Amazon SNS to send email notifications, you must first create a topic and then subscribe your email addresses to the topic.

For more information about working with EventBridge, see Using Amazon EC2 Auto Scaling with EventBridge.

Create an Amazon SNS topic

An SNS topic is a logical access point, a communication channel that your Auto Scaling group uses to send the notifications. You create a topic by specifying a name for your topic.

When you create a topic name, the name must meet the following requirements:

  • Between 1 and 256 characters long

  • Contain uppercase and lowercase ASCII letters, numbers, underscores, or hyphens

For more information, see Creating an Amazon SNS topic in the Amazon Simple Notification Service Developer Guide.

Subscribe to the Amazon SNS topic

To receive the notifications that your Auto Scaling group sends to the topic, you must subscribe an endpoint to the topic. In this procedure, for Endpoint, specify the email address where you want to receive the notifications from Amazon EC2 Auto Scaling.

For more information, see Subscribing to an Amazon SNS topic in the Amazon Simple Notification Service Developer Guide.

Confirm your Amazon SNS subscription

Amazon SNS sends a confirmation email to the email address you specified in the previous step.

Make sure that you open the email from AWS Notifications and choose the link to confirm the subscription before you continue with the next step.

You will receive an acknowledgment message from AWS. Amazon SNS is now configured to receive notifications and send the notification as an email to the email address that you specified.

Route events to your Amazon SNS topic

Create a rule that matches selected events and routes them to your Amazon SNS topic to notify subscribed email addresses.

To create a rule that routes instance refresh events to your Amazon SNS topic

  1. Open the Amazon EventBridge console at https://console.aws.amazon.com/events/.

  2. In the navigation pane, under Events, choose Rules.

  3. In the Rules section, choose Create rule.

  4. Enter a name and description for the rule.

  5. For Define pattern, do the following:

    1. Choose Event Pattern.

    2. For Event matching pattern, choose Pre-defined by service.

    3. For Service provider, choose Amazon Web Services.

    4. For Service Name, choose Auto Scaling.

    5. For Event type, choose Instance Refresh.

    6. By default, the rule matches any instance refresh event. To create a rule that notifies you whenever a checkpoint is reached during an instance refresh, choose Specific instance event(s) and select EC2 Auto Scaling Instance Refresh Checkpoint Reached.

    7. By default, the rule matches any Auto Scaling group in the Region. To make the rule match a specific Auto Scaling group, choose Specific group name(s) and select one or more Auto Scaling groups.

  6. For Select event bus, choose AWS default event bus. When an AWS service in your account emits an event, it always goes to your account's default event bus.

  7. For Target, choose SNS topic.

  8. For Topic, select the Amazon SNS topic that you created.

  9. For Configure input, choose the input for the email notification.

  10. Choose Create.