BackupResource

class aws_cdk.aws_backup.BackupResource(resource=None, tag_condition=None, construct=None)

Bases: object

A resource to backup.

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-postgresql10"),
    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)
    ]
)
Parameters
  • resource (Optional[str]) –

  • tag_condition (Union[TagCondition, Dict[str, Any], None]) –

  • construct (Optional[Construct]) –

Attributes

construct

A construct.

resource

A resource.

tag_condition

A condition on a tag.

Static Methods

classmethod from_arn(arn)

A list of ARNs or match patterns such as arn:aws:ec2:us-east-1:123456789012:volume/*.

Parameters

arn (str) –

Return type

BackupResource

classmethod from_construct(construct)

Adds all supported resources in a construct.

Parameters

construct (Construct) – The construct containing resources to backup.

Return type

BackupResource

classmethod from_dynamo_db_table(table)

A DynamoDB table.

Parameters

table (ITable) –

Return type

BackupResource

classmethod from_ec2_instance(instance)

An EC2 instance.

Parameters

instance (IInstance) –

Return type

BackupResource

classmethod from_efs_file_system(file_system)

An EFS file system.

Parameters

file_system (IFileSystem) –

Return type

BackupResource

classmethod from_rds_database_cluster(cluster)

A RDS database cluter.

Parameters

cluster (IDatabaseCluster) –

Return type

BackupResource

classmethod from_rds_database_instance(instance)

A RDS database instance.

Parameters

instance (IDatabaseInstance) –

Return type

BackupResource

classmethod from_rds_serverless_cluster(cluster)

An Aurora database instance.

Parameters

cluster (IServerlessCluster) –

Return type

BackupResource

classmethod from_tag(key, value, operation=None)

A tag condition.

Parameters
  • key (str) –

  • value (str) –

  • operation (Optional[TagOperation]) –

Return type

BackupResource