Skip to content
v2.275.0

BackupSelectionOptions Struct ​

Options for a BackupSelection.

Example ​

ts
declare const plan: backup.BackupPlan;
declare const vpc: ec2.Vpc;
const myTable = dynamodb.Table.fromTableName(this, 'Table', 'myTableName');
const myDatabaseInstance = new rds.DatabaseInstance(this, 'DatabaseInstance', {
  engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_26 }),
  vpc,
});
const myDatabaseCluster = new rds.DatabaseCluster(this, 'DatabaseCluster', {
  engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_2_08_1 }),
  credentials: rds.Credentials.fromGeneratedSecret('clusteradmin'),
  instanceProps: {
    vpc,
  },
});
const myServerlessCluster = new rds.ServerlessCluster(this, 'ServerlessCluster', {
  engine: rds.DatabaseClusterEngine.AURORA_POSTGRESQL,
  parameterGroup: rds.ParameterGroup.fromParameterGroupName(this, 'ParameterGroup', 'default.aurora-postgresql11'),
  vpc,
});
const myCoolConstruct = new Construct(this, 'MyCoolConstruct');

plan.addSelection('Selection', {
  resources: [
    backup.BackupResource.fromDynamoDbTable(myTable), // A DynamoDB table
    backup.BackupResource.fromRdsDatabaseInstance(myDatabaseInstance), // A RDS instance
    backup.BackupResource.fromRdsDatabaseCluster(myDatabaseCluster), // A RDS database cluster
    backup.BackupResource.fromRdsServerlessCluster(myServerlessCluster), // An Aurora Serverless cluster
    backup.BackupResource.fromTag('stage', 'prod'), // All resources that are tagged stage=prod in the region/account
    backup.BackupResource.fromConstruct(myCoolConstruct), // All backupable resources in `myCoolConstruct`
  ]
})

Properties ​

allowRestoresoptionalbooleanallow_restoresoptionalboolallowRestoresoptionalBooleanAllowRestoresoptionalboolAllowRestoresoptional*bool= 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.

backupSelectionNameoptionalstringbackup_selection_nameoptionalstrbackupSelectionNameoptionalStringBackupSelectionNameoptionalstringBackupSelectionNameoptional*string#
The name for this selection.

Default: a CDK generated name

disableDefaultBackupPolicyoptionalbooleandisable_default_backup_policyoptionalbooldisableDefaultBackupPolicyoptionalBooleanDisableDefaultBackupPolicyoptionalboolDisableDefaultBackupPolicyoptional*bool= false#
Whether to disable automatically assigning default backup permissions to the role that AWS Backup uses.

If false, the AWSBackupServiceRolePolicyForBackup managed policy will be attached to the role.

resourcesBackupResource[]resourcestyping.List[BackupResource]resourcesList<BackupResource>ResourcesBackupResource[]Resources*[]BackupResourcerequired#
The resources to backup.

Use the helper static methods defined on BackupResource.

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

Default: a new role will be created

The AWSBackupServiceRolePolicyForBackup managed policy will be attached to this role unless disableDefaultBackupPolicy is set to true.