AWS Backup Vault Notifications

This page shows how to write Terraform and CloudFormation for AWS Backup Vault Notifications and write them securely.

aws_backup_vault_notifications (Terraform)

The Vault Notifications in AWS Backup can be configured in Terraform with the resource name aws_backup_vault_notifications. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

notifications.tf#L25
resource "aws_backup_vault_notifications" "backup_events" {
  count               = var.enabled && length(var.notifications) > 0 ? 1 : 0
  backup_vault_name   = var.vault_name != null ? var.vault_name : "Default"
  sns_topic_arn       = lookup(var.notifications, "sns_topic_arn", null)
  backup_vault_events = lookup(var.notifications, "backup_vault_events", [])
}
backup_vault_notifications.tf#L4
resource "aws_backup_vault_notifications" "backup_vault_notifications" {
  count = var.enable_backup_vault_notifications ? 1 : 0

  backup_vault_name   = var.backup_vault_notifications_backup_vault_name != "" ? var.backup_vault_notifications_backup_vault_name : (var.enable_backup_vault ? element(aws_backup_vault.backup_vault.*.name, 0) : null)
  sns_topic_arn       = var.backup_vault_notifications_sns_topic_arn
  backup_vault_events = var.backup_vault_notifications_backup_vault_events
backup_vault_notifications.tf#L4
resource "aws_backup_vault_notifications" "backup_vault_notifications" {
  count = var.enable_backup_vault_notifications ? 1 : 0

  backup_vault_name   = var.backup_vault_notifications_backup_vault_name != "" ? var.backup_vault_notifications_backup_vault_name : (var.enable_backup_vault ? element(aws_backup_vault.backup_vault.*.name, 0) : null)
  sns_topic_arn       = var.backup_vault_notifications_sns_topic_arn
  backup_vault_events = var.backup_vault_notifications_backup_vault_events
backup.tf#L30
resource "aws_backup_vault_notifications" "backup" {
    count = var.notification_sns_topic_arn == null ? 0 : 1

    backup_vault_name = aws_backup_vault.backup_vault.id
    sns_topic_arn = var.notification_sns_topic_arn
    backup_vault_events = var.notification_vault_events
notifications.tf#L34
resource "aws_backup_vault_notifications" "backup_events" {
  count               = local.enable_notifications ? 1 : 0
  backup_vault_name   = var.backup_vault_name
  sns_topic_arn = local.enable_notifications && var.sns_topic_arn == "" ? aws_sns_topic.backup_events[0].arn : var.sns_topic_arn
  backup_vault_events = var.backup_vault_events
}

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides an AWS Backup vault notifications resource.

AWS::Backup::BackupVault NotificationObjectType (CloudFormation)

The BackupVault NotificationObjectType in Backup can be configured in CloudFormation with the resource name AWS::Backup::BackupVault NotificationObjectType. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

BackupVaultEvents An array of events that indicate the status of jobs to back up resources to the backup vault. For valid events, see BackupVaultEvents in the AWS Backup API Guide.
Required: Yes
Type: List of String
Update requires: No interruption

SNSTopicArn An ARN that uniquely identifies an Amazon Simple Notification Service (Amazon SNS) topic; for example, arn:aws:sns:us-west-2:111122223333:MyTopic.
Required: Yes
Type: String
Update requires: No interruption

Explanation in CloudFormation Registry

Specifies an object containing SNS event notification properties for the target backup vault.

Frequently asked questions

What is AWS Backup Vault Notifications?

AWS Backup Vault Notifications is a resource for Backup of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Backup Vault Notifications?

For Terraform, the mtp-devops/terraform-v1-aws-backup, asrkata/SebastianUA-terraform and SebastianUA/terraform source code examples are useful. See the Terraform Example section for further details.