BackupSelectionOptions
- class aws_cdk.aws_backup.BackupSelectionOptions(*, resources, allow_restores=None, backup_selection_name=None, disable_default_backup_policy=None, role=None)
Bases:
object
Options for a BackupSelection.
- Parameters:
resources (
Sequence
[BackupResource
]) – The resources to backup. Use the helper static methods defined onBackupResource
.allow_restores (
Optional
[bool
]) – Whether to automatically give restores permissions to the role that AWS Backup uses. Iftrue
, theAWSBackupServiceRolePolicyForRestores
managed policy will be attached to the role. Default: falsebackup_selection_name (
Optional
[str
]) – The name for this selection. Default: - a CDK generated namedisable_default_backup_policy (
Optional
[bool
]) – Whether to disable automatically assigning default backup permissions to the role that AWS Backup uses. Iffalse
, theAWSBackupServiceRolePolicyForBackup
managed policy will be attached to the role. Default: falserole (
Optional
[IRole
]) – The role that AWS Backup uses to authenticate when backuping or restoring the resources. TheAWSBackupServiceRolePolicyForBackup
managed policy will be attached to this role unlessdisableDefaultBackupPolicy
is set totrue
. Default: - a new role will be created
- ExampleMetadata:
infused
Example:
# plan: backup.BackupPlan # vpc: ec2.Vpc my_table = dynamodb.Table.from_table_name(self, "Table", "myTableName") my_database_instance = rds.DatabaseInstance(self, "DatabaseInstance", engine=rds.DatabaseInstanceEngine.mysql(version=rds.MysqlEngineVersion.VER_8_0_26), vpc=vpc ) my_database_cluster = rds.DatabaseCluster(self, "DatabaseCluster", engine=rds.DatabaseClusterEngine.aurora_mysql(version=rds.AuroraMysqlEngineVersion.VER_2_08_1), credentials=rds.Credentials.from_generated_secret("clusteradmin"), instance_props=rds.InstanceProps( vpc=vpc ) ) my_serverless_cluster = rds.ServerlessCluster(self, "ServerlessCluster", engine=rds.DatabaseClusterEngine.AURORA_POSTGRESQL, parameter_group=rds.ParameterGroup.from_parameter_group_name(self, "ParameterGroup", "default.aurora-postgresql11"), vpc=vpc ) my_cool_construct = Construct(self, "MyCoolConstruct") plan.add_selection("Selection", resources=[ backup.BackupResource.from_dynamo_db_table(my_table), # A DynamoDB table backup.BackupResource.from_rds_database_instance(my_database_instance), # A RDS instance backup.BackupResource.from_rds_database_cluster(my_database_cluster), # A RDS database cluster backup.BackupResource.from_rds_serverless_cluster(my_serverless_cluster), # An Aurora Serverless cluster backup.BackupResource.from_tag("stage", "prod"), # All resources that are tagged stage=prod in the region/account backup.BackupResource.from_construct(my_cool_construct) ] )
Attributes
- allow_restores
Whether to automatically give restores permissions to the role that AWS Backup uses.
If
true
, theAWSBackupServiceRolePolicyForRestores
managed policy will be attached to the role.- Default:
false
- backup_selection_name
The name for this selection.
- Default:
a CDK generated name
- disable_default_backup_policy
Whether to disable automatically assigning default backup permissions to the role that AWS Backup uses.
If
false
, theAWSBackupServiceRolePolicyForBackup
managed policy will be attached to the role.- Default:
false
- resources
The resources to backup.
Use the helper static methods defined on
BackupResource
.
- role
The role that AWS Backup uses to authenticate when backuping or restoring the resources.
The
AWSBackupServiceRolePolicyForBackup
managed policy will be attached to this role unlessdisableDefaultBackupPolicy
is set totrue
.- Default:
a new role will be created