How can I configure Amazon EventBridge notifications for failed AWS Backup Jobs?

5 minute read
0

I want to receive an email notification when my AWS Backup job fails.

Short description

You can use Amazon EventBridge to monitor your AWS Backup events. For example, you might want to receive a notification when your backup job fails. AWS Backup sends events to EventBridge in a best effort manner every 5 minutes. Although you can also use Amazon CloudWatch Events, it's a best practice to use EventBridge to manage your backup events. If you make changes in either CloudWatch Events or EventBridge, the changes appear in both service consoles.

To activate notifications for failed backup jobs in one AWS Region using EventBridge, follow these steps:

  1. Create an Amazon Simple Notification Service (Amazon SNS) topic in your Region, for example us-east-1.
  2. Create a subscription to the SNS topic and then confirm the subscription.
  3. Create a rule in EventBridge in your Region using the SNS topic that you created as the target.

Note: You can also configure your AWS account to send events to or receive events from other AWS accounts. This can be useful if the accounts belong to the same organization in AWS Organizations. Similarly, this method is useful if the accounts belong to organizations that are partners or have a similar relationship. For more information, see Sending and receiving events between AWS accounts and Sending and receiving Amazon EventBridge events between AWS accounts.

Resolution

Create an SNS topic

First, create an SNS topic. An SNS topic is a logical access point that acts as a communication channel. This topic allows you to group multiple endpoints such as AWS Lambda, Amazon SNS, HTTP/S, or an email address. The following steps use an email address as an endpoint.

  1. Open the Amazon SNS console.
  2. On the Create topic page, choose Create Topic.
  3. In the Create topic window, choose Standard.
  4. Enter a Name and, optionally, a Display name for the topic.
  5. Choose Create topic.

Create a subscription to the SNS topic and confirm the subscription

Subscribe an endpoint to the SNS topic that you created in order to receive published messages. When you subscribe an endpoint to an SNS topic, the endpoint receives messages published to the associated SNS topic. Use the following steps to create and confirm a subscription to your SNS topic.

  1. After you create the topic in the previous section, the Topic details windows appears. Choose the Subscriptions tab, and then choose Create subscription.
  2. For Protocol type, choose Email.
  3. For Endpoint, enter the email you want to receive notifications.
  4. Choose Create subscription.
  5. Your email subscription is now pending. AWS then sends an email to confirm your subscription. Click on the Confirm subscription link in this email.

Create a rule in EventBridge with the SNS topic as the target

When you create a rule for your events, you specify an action that EventBridge takes when it receives an event that matches the event pattern in the rule. When an event matches, EventBridge sends the event to the specified target and triggers the action defined in the rule.

When an AWS service in your account emits an event, the event always goes to the default event bus for your account. To write a rule that matches events from AWS services in your account, you must associate it with the default event bus.

Follow these steps to create a rule for an AWS service:

  1. Open the EventBridge console.

  2. In the navigation pane, choose Rules, and then choose Create rule.

  3. Enter a name and description for the rule.

  4. For Event bus, choose the event bus that you want to associate with this rule. If you want this rule to match events that come from your account, then choose AWS default event bus.

  5. For Rule type, choose Rule with an event pattern, and then choose Next.

  6. For Event source, choose Other.

  7. For Event pattern, choose Custom pattern (JSON editor) and then add the following event pattern.

    Note: You can also modify the following procedure to receive notifications for other AWS Backup related events. For detail-type, enter Copy Job State, Change, or Restore Job State Change. For detail, enter ABORTED, COMPLETED, EXPIRED, RUNNING, or PENDING.

    {
     "source": ["aws.backup"],
     "detail-type": ["Backup Job State Change"],
     "detail": {
     "state": ["FAILED"]
     }
    }
  8. Choose Next.

  9. For Target types, choose AWS service.

  10. For Select a target, choose the SNS topic that you created in the first step.

  11. For Topic, choose the SNS topic, and then choose Next.

  12. Enter one or more optional tags for the rule, and then choose Next.

  13. Review the details of the rule and then choose Create rule.

Test the notifications by creating an on-demand job

To test notifications, Create an Amazon Elastic Block Store (Amazon EBS) volume. Then create an on-demand backup job. Delete the EBS volume that you created to cause the backup job to fail. You then receive an email notification for the failed backup job. This confirms that your notifications are correctly configured.

Related information

Create a rule in Amazon EventBridge

AWS OFFICIAL
AWS OFFICIALUpdated 10 months ago