AWS Backup Selection

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

aws_backup_selection (Terraform)

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

Example Usage from GitHub

backup.tf#L15
resource "aws_backup_selection" "backup_web" {
    iam_role_arn = "arn:aws:iam::533616270150:role/service-role/AWSBackupDefaultServiceRole"
    name = "backup-WEB"
    plan_id = aws_backup_plan.backup_plan.id

    selection_tag {
main.tf#L26
resource "aws_backup_selection" "selection_by_tag" {
  iam_role_arn = var.selection_by_tag_iam_role_arn
  name         = var.selection_by_tag_name
  plan_id      = var.selection_by_tag_plan_id

  selection_tag {
backup-plan.tf#L115
resource "aws_backup_selection" "daily_except_sunday_selection" {
  plan_id = aws_backup_plan.daily_except_sunday.id
  name = "daily_except_sunday_selection"
  iam_role_arn = aws_iam_role.AWSBackupServiceRolePolicyForBackup.arn

  selection_tag {
main.tf#L19
resource "aws_backup_selection" "backup_good" {
  iam_role_arn = "arn"
  name         = "tf_example_backup_selection"
  plan_id      = "123456"

  resources = [
main.tf#L19
resource "aws_backup_selection" "backup_good" {
  iam_role_arn = "arn"
  name         = "tf_example_backup_selection"
  plan_id      = "123456"

  resources = [

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

Manages selection conditions for AWS Backup plan resources.

AWS::Backup::BackupSelection (CloudFormation)

The BackupSelection in Backup can be configured in CloudFormation with the resource name AWS::Backup::BackupSelection. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

awsbackup.yml#L56
    Type: AWS::Backup::BackupSelection
    Properties:
      BackupPlanId: !Ref rDefaultFileSystemBackupPlan
      BackupSelection:
        IamRoleArn: !Sub arn:aws:iam::${AWS::AccountId}:role/service-role/AWSBackupDefaultServiceRole
        ListOfTags:
tag-based-backup-selection-no-parameters.yml#L48
    Type: "AWS::Backup::BackupSelection"
    Properties:
      BackupSelection:
        SelectionName: "TagBasedBackupSelection-01"
        IamRoleArn:  !GetAtt BackupRole.Arn
        ListOfTags:
AWS-Backup.yml#L149
    Type: "AWS::Backup::BackupSelection"
    Properties:
      BackupSelection:
        SelectionName: "DailyBackupSelection"
        IamRoleArn: !GetAtt BackupRole.Arn
        ListOfTags:
backup-tagoptions.yml#L103
    Type: "AWS::Backup::BackupSelection"
    Properties:
      BackupSelection:
        SelectionName: "TagBasedBackupSelectionDaily"
        IamRoleArn: !GetAtt BackupRole.Arn
        ListOfTags:
backup-tagoptions.yml#L103
    Type: "AWS::Backup::BackupSelection"
    Properties:
      BackupSelection:
        SelectionName: "TagBasedBackupSelectionDaily"
        IamRoleArn: !GetAtt BackupRole.Arn
        ListOfTags:
selection.json#L3
    "Type": "AWS::Backup::BackupSelection",
        "Properties": {
            "BackupPlanId": { "Ref": "BackupPlan" },
            "BackupSelection": {
                "IamRoleArn": { "Fn::GetAtt": ["BackupRole", "Arn"] },
                "Resources": [
selections.json#L3
        "Type" : "AWS::Backup::BackupSelection",
        "Properties" : {
            "BackupPlanId" : { "Ref": "BackupPlan" },
            "BackupSelection" : {
                "SelectionName" : { "Ref": "UniqueIdentifierParam" },
                "IamRoleArn" : { "Fn::GetAtt" : ["BackupRole", "Arn"] },
selections.json#L3
        "Type" : "AWS::Backup::BackupSelection",
        "Properties" : {
            "BackupPlanId" : { "Ref": "BackupPlan" },
            "BackupSelection" : {
                "SelectionName" : { "Ref": "UniqueIdentifierParam" },
                "IamRoleArn" : { "Fn::GetAtt" : ["BackupRole", "Arn"] },
integ.backup.expected.json#L121
      "Type": "AWS::Backup::BackupSelection",
      "Properties": {
        "BackupPlanId": {
          "Fn::GetAtt": [
            "PlanDAF4E53A",
            "BackupPlanId"
integ.backup.expected.json#L121
      "Type": "AWS::Backup::BackupSelection",
      "Properties": {
        "BackupPlanId": {
          "Fn::GetAtt": [
            "PlanDAF4E53A",
            "BackupPlanId"

Parameters

Explanation in CloudFormation Registry

Specifies a set of resources to assign to a backup plan.

Frequently asked questions

What is AWS Backup Selection?

AWS Backup Selection 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 Selection?

For Terraform, the SeongHyukJang/3-Tier-Architecture, weyderfs/terraform-aws-modules and andresriancho/aws-backup source code examples are useful. See the Terraform Example section for further details.

For CloudFormation, the grolston/aws-backup-manager, hiteshkacholiya/aws-reusable-solutions and Finnianz/WAR-template-test source code examples are useful. See the CloudFormation Example section for further details.