Sub topic 16
Monitoring jobs and auditing compliance
This chapter assumes you can create vaults, plans and selections from the earlier chapters. A backup plan that fails silently is not protection, so you need two things. Alerts tell you when a job fails. Evidence tells you that your resources are covered as your policy requires.
What you can watch
Every backup, restore and copy runs as a job with a state such as RUNNING, COMPLETED, FAILED or EXPIRED. AWS Backup exposes these states in three ways.
| Mechanism | Best for |
|---|---|
| Job list commands and the console | Checking status by hand |
| Vault notifications (Amazon SNS) | Simple email or chat alerts per vault |
| Amazon EventBridge events | Routing events to Lambda, tickets or other accounts |
To find recent failures from the CLI:
aws backup list-backup-jobs --by-state FAILEDThe output includes a StatusMessage for each job. It is usually the fastest way to find the cause, such as a missing role permission or a job that missed its completion window.
Notifications with SNS
Notifications attach to a vault, not to a plan. Create an SNS topic first. Its access policy must allow the backup.amazonaws.com service principal to publish, otherwise no messages arrive.
aws backup put-backup-vault-notifications \
--backup-vault-name app-vault \
--sns-topic-arn arn:aws:sns:us-east-1:123456789012:backup-alerts \
--backup-vault-events BACKUP_JOB_COMPLETED COPY_JOB_FAILED RESTORE_JOB_COMPLETEDBACKUP_JOB_COMPLETED fires for every final state, including failures. Filter on the message content if you only want problems.
Routing events with EventBridge
AWS Backup publishes job state changes to the default event bus with the source aws.backup. This pattern matches backup jobs that failed or expired:
{
"source": ["aws.backup"],
"detail-type": ["Backup Job State Change"],
"detail": {
"state": ["FAILED", "EXPIRED"]
}
}Save it as pattern.json, then create the rule:
aws events put-rule \
--name backup-job-problems \
--event-pattern file://pattern.jsonAdd a target, such as an SNS topic or a Lambda function, with aws events put-targets. The rule does nothing until it has a target.
Auditing with Backup Audit Manager
Alerts show what happened. Audit Manager shows whether your setup meets a standard. It has two parts.
- A framework is a set of controls evaluated continuously. Examples are "resources are protected by a backup plan", "backup frequency meets a minimum" and "retention is at least N days".
- A report plan generates a report in an S3 bucket. Job reports list jobs and their outcomes. Compliance reports show how each resource scored against a framework.
Frameworks only evaluate resources of the types you scope them to. Resource tracking must be enabled in the Region for the resource-compliance controls to report. Audit Manager reads configuration and job data. It does not change your plans, so a failing control tells you about a gap but does not fix it.
Exercise
A vault has notifications enabled for BACKUPJOBCOMPLETED, but no messages arrive in the SNS topic. Name the most likely cause and one way to alert only on failures.
Show answer
The SNS topic's access policy probably does not allow the backup.amazonaws.com service principal to publish. To alert only on failures, create an EventBridge rule that matches source aws.backup, detail-type "Backup Job State Change" and states FAILED or EXPIRED, and give it a target.