aws-cdk-lib.aws_backup.BackupSelection

class BackupSelection (construct)

LanguageType name
.NETAmazon.CDK.AWS.Backup.BackupSelection
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsbackup#BackupSelection
Javasoftware.amazon.awscdk.services.backup.BackupSelection
Pythonaws_cdk.aws_backup.BackupSelection
TypeScript (source)aws-cdk-lib » aws_backup » BackupSelection

Implements IConstruct, IDependable, IResource, IGrantable

A backup selection.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_backup as backup } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';

declare const backupPlan: backup.BackupPlan;
declare const backupResource: backup.BackupResource;
declare const role: iam.Role;
const backupSelection = new backup.BackupSelection(this, 'MyBackupSelection', {
  backupPlan: backupPlan,
  resources: [backupResource],

  // the properties below are optional
  allowRestores: false,
  backupSelectionName: 'backupSelectionName',
  role: role,
});

Initializer

new BackupSelection(scope: Construct, id: string, props: BackupSelectionProps)

Parameters

  • scope Construct
  • id string
  • props BackupSelectionProps

Construct Props

NameTypeDescription
backupPlanIBackupPlanThe backup plan for this selection.
resourcesBackupResource[]The resources to backup.
allowRestores?booleanWhether to automatically give restores permissions to the role that AWS Backup uses.
backupSelectionName?stringThe name for this selection.
role?IRoleThe role that AWS Backup uses to authenticate when backuping or restoring the resources.

backupPlan

Type: IBackupPlan

The backup plan for this selection.


resources

Type: BackupResource[]

The resources to backup.

Use the helper static methods defined on BackupResource.


allowRestores?

Type: boolean (optional, default: false)

Whether to automatically give restores permissions to the role that AWS Backup uses.

If true, the AWSBackupServiceRolePolicyForRestores managed policy will be attached to the role.


backupSelectionName?

Type: string (optional, default: a CDK generated name)

The name for this selection.


role?

Type: IRole (optional, default: a new role will be created)

The role that AWS Backup uses to authenticate when backuping or restoring the resources.

The AWSBackupServiceRolePolicyForBackup managed policy will be attached to this role.

Properties

NameTypeDescription
backupPlanIdstringThe identifier of the backup plan.
envResourceEnvironmentThe environment this resource belongs to.
grantPrincipalIPrincipalThe principal to grant permissions to.
nodeNodeThe tree node.
selectionIdstringThe identifier of the backup selection.
stackStackThe stack in which this resource is defined.

backupPlanId

Type: string

The identifier of the backup plan.


env

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


grantPrincipal

Type: IPrincipal

The principal to grant permissions to.


node

Type: Node

The tree node.


selectionId

Type: string

The identifier of the backup selection.


stack

Type: Stack

The stack in which this resource is defined.

Methods

NameDescription
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
toString()Returns a string representation of this construct.

applyRemovalPolicy(policy)

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).


toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.