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
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 {
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 {
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 {
resource "aws_backup_selection" "backup_good" {
iam_role_arn = "arn"
name = "tf_example_backup_selection"
plan_id = "123456"
resources = [
resource "aws_backup_selection" "backup_good" {
iam_role_arn = "arn"
name = "tf_example_backup_selection"
plan_id = "123456"
resources = [
Parameters
-
iam_role_arn
required - string -
id
optional computed - string -
name
required - string -
plan_id
required - string -
resources
optional - set of string -
selection_tag
set block
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
Type: AWS::Backup::BackupSelection
Properties:
BackupPlanId: !Ref rDefaultFileSystemBackupPlan
BackupSelection:
IamRoleArn: !Sub arn:aws:iam::${AWS::AccountId}:role/service-role/AWSBackupDefaultServiceRole
ListOfTags:
Type: "AWS::Backup::BackupSelection"
Properties:
BackupSelection:
SelectionName: "TagBasedBackupSelection-01"
IamRoleArn: !GetAtt BackupRole.Arn
ListOfTags:
Type: "AWS::Backup::BackupSelection"
Properties:
BackupSelection:
SelectionName: "DailyBackupSelection"
IamRoleArn: !GetAtt BackupRole.Arn
ListOfTags:
Type: "AWS::Backup::BackupSelection"
Properties:
BackupSelection:
SelectionName: "TagBasedBackupSelectionDaily"
IamRoleArn: !GetAtt BackupRole.Arn
ListOfTags:
Type: "AWS::Backup::BackupSelection"
Properties:
BackupSelection:
SelectionName: "TagBasedBackupSelectionDaily"
IamRoleArn: !GetAtt BackupRole.Arn
ListOfTags:
"Type": "AWS::Backup::BackupSelection",
"Properties": {
"BackupPlanId": { "Ref": "BackupPlan" },
"BackupSelection": {
"IamRoleArn": { "Fn::GetAtt": ["BackupRole", "Arn"] },
"Resources": [
"Type" : "AWS::Backup::BackupSelection",
"Properties" : {
"BackupPlanId" : { "Ref": "BackupPlan" },
"BackupSelection" : {
"SelectionName" : { "Ref": "UniqueIdentifierParam" },
"IamRoleArn" : { "Fn::GetAtt" : ["BackupRole", "Arn"] },
"Type" : "AWS::Backup::BackupSelection",
"Properties" : {
"BackupPlanId" : { "Ref": "BackupPlan" },
"BackupSelection" : {
"SelectionName" : { "Ref": "UniqueIdentifierParam" },
"IamRoleArn" : { "Fn::GetAtt" : ["BackupRole", "Arn"] },
"Type": "AWS::Backup::BackupSelection",
"Properties": {
"BackupPlanId": {
"Fn::GetAtt": [
"PlanDAF4E53A",
"BackupPlanId"
"Type": "AWS::Backup::BackupSelection",
"Properties": {
"BackupPlanId": {
"Fn::GetAtt": [
"PlanDAF4E53A",
"BackupPlanId"
Parameters
-
BackupPlanId
required - String -
BackupSelection
required - BackupSelectionResourceType
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.