I want to be notified if my AWS Backup job fails. How can I set up email notifications for an unsuccessful backup job?
Short description
Use Amazon Simple Notification Service (Amazon SNS) to send email notifications about failed backup jobs. Follow these steps to configure Amazon SNS and your backup vault for notifications:
1. Create an SNS topic to send AWS Backup notifications to.
2. Configure your backup vault to send notifications to the SNS topic.
3. Create an SNS subscription that filters notifications to backup jobs that are unsuccessful.
4. Monitor emails for notifications.
To receive notifications for other events, such as restore jobs and recovery points, see Using Amazon SNS to track AWS Backup events.
Resolution
Create an SNS topic to send AWS Backup notifications
1. Open the Amazon SNS console.
2. From the navigation pane, choose Topics.
3. Choose Create topic.
4. For Name, enter a name for the topic.
5. Choose Create topic.
6. Under the Details of the topic that you just created, copy the value for ARN (Amazon Resource Name). You need this value for later steps.
7. Above the Details pane, choose Edit.
8. Expand Access policy.
9. In the JSON editor, append the following permissions into the policy:
Important: Replace the value for Resource with the ARN that you copied in step 6.
{
"Sid": "My-statement-id",
"Effect": "Allow",
"Principal": {
"Service": "backup.amazonaws.com"
},
"Action": "SNS:Publish",
"Resource": "arn:aws:sns:eu-west-1:111111111111:exampletopic"
}
10. Choose Save changes.
Configure your backup vault to send notifications to the SNS topic
1. Install and configure the AWS Command Line Interface (AWS CLI).
2. Using the AWS CLI, run the put-backup-vault-notifications command with --backup-vault-events set to BACKUP_JOB_COMPLETED. Replace the following values in the example command:
--endpoint-url: the endpoint for the AWS Region where you have the backup vault
eu-west-1: the AWS Region where you have the backup vault
--backup-vault-name: the name of your backup vault
--sns-topic-arn: the ARN of the SNS topic that you created
aws backup put-backup-vault-notifications --endpoint-url https://backup.eu-west-1.amazonaws.com --backup-vault-name examplevault --sns-topic-arn arn:aws:sns:eu-west-1:111111111111:exampletopic --backup-vault-events BACKUP_JOB_COMPLETED
Note: If you receive errors when running AWS CLI commands, make sure that you’re using the most recent version of the AWS CLI.
3. Run the get-backup-vault-notifications command to confirm that notifications are configured:
aws backup get-backup-vault-notifications --backup-vault-name examplevault
The command returns output similar to the following:
{
"BackupVaultName": "examplevault",
"BackupVaultArn": "arn:aws:backup:eu-west-1:111111111111:backup-vault:examplevault",
"SNSTopicArn": "arn:aws:sns:eu-west-1:111111111111:exampletopic",
"BackupVaultEvents": [
"BACKUP_JOB_COMPLETED"
]
}
Create an SNS subscription that filters notifications to backup jobs that are unsuccessful
1. Open the Amazon SNS console.
2. From the navigation pane, choose Subscriptions.
3. Choose Create subscription.
4. For Topic ARN, select the SNS topic that you created.
5. For Protocol, select Email-JSON.
6. For Endpoint, enter the email address where you want to get email notifications about failed backup jobs.
7. Expand Subscription filter policy.
8. In the JSON editor, enter the following:
{
"State": [
{
"anything-but": "COMPLETED"
}
]
}
9. Choose Create subscription.
10. The email address that you entered in step 6 receives a subscription confirmation email. Be sure to confirm the SNS subscription.
Monitor emails for notifications
When your vault has an unsuccessful backup job, you get an email notification similar to the following:
"An AWS Backup job was stopped. Resource ARN : arn:aws:ec2:eu-west-1:111111111111:volume/vol-example56d7w92d4b. BackupJob ID : example4-3dd5-5678-b52d-90bd749355a5"
You can test notifications by creating two on-demand backups and then stopping one of the backups. You get an email notification for the stopped backup only.
Related information
Troubleshooting AWS Backup