aws-cdk-lib.aws_backup.BackupSelectionOptions
interface BackupSelectionOptions
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Backup.BackupSelectionOptions |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsbackup#BackupSelectionOptions |
![]() | software.amazon.awscdk.services.backup.BackupSelectionOptions |
![]() | aws_cdk.aws_backup.BackupSelectionOptions |
![]() | 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
Name | Type | Description |
---|---|---|
resources | Backup [] | The resources to backup. |
allow | boolean | Whether to automatically give restores permissions to the role that AWS Backup uses. |
backup | string | The name for this selection. |
role? | IRole | The role that AWS Backup uses to authenticate when backuping or restoring the resources. |
resources
Type:
Backup
[]
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.