In this article, I will walk you through how to set up monitoring of events using a combination of Amazon EventBridge, Amazon SNS, and AWS Backup.
Consider a scenario where you need to capture change of state within AWS Backup like when backup job started, when it is completed, when it's failed etc. When a backup job fails, you need to send an email via Amazon SNS to admin team to notify them so they can act on that accordingly.
You can now capture these events in Amazon EventBridge to describe change of state in backup vault and send out notification using Amazon SNS.
How to get started
In this section, we will learn how to get started using EventBridge for monitoring AWS Backup states.
Step 1
Login to AWS Console.
Create an AWS RDS database if not exists. I already have a database created with name ‘database-kk’.
Step 2
Create a new Backup Plan.
Step 3
Select option Build a new plan.
Enter name for backup plan as shown below -
Step 4
Configure backup rule configuration by defining a backup rule name and backup vault where backups will be stored.
Choose backup frequency like Daily, Weekly, monthly as per your choice. You can also define lifecycle rule at the same window only.
Step 5
When backup plan has been created it will appear in list.
Step 6
Go to Amazon EventBridge service and click on Create Rule button.
Step 7
Define your rule name. I used event-backup for this demo.
Next, select the Rule withEvent pattern radio button and click Next button.
Step 8
In Build event pattern step, select AWS events or EventBridge partner events radio button.
Step 9
In Event Pattern section, select Backup as AWS Service and Event type as Backup Job State Change. Click Next.
Step 10
We will be using Amazon SNS as Target for event notification and I don’t have SNS topic created already. Go to AWS SNS service and choose type as Standard.
Enter name for SNS Topic. I write send-email for this demo.
Step 11
Now we need to create a subscription where we choose Protocol as Email and write email in Endpoint.
Step 12
Once SNS topic has been created, will go back to EventBridge window to select targets. This could be a Lambda function, an SNS topic, or any number of other options available in the drop-down menu. In our example, I chose SNS topic which we have created and click Next.
Step 12
Leave default in next window.
Review our option and click on Create Rule button.
Step 14
When Event Rule has been created, it will appear in Rule list
Step 15
In the next run, when AWS backup job got started, Amazon eventbridge will send out notification via AWS SNS similar to screenshot below -