aws-cdk-lib.aws_backup.BackupSelectionOptions

interface BackupSelectionOptions

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

Options for a BackupSelection.

Example

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-postgresql10'),
  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

NameTypeDescription
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.

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.