class BackupResource
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Backup.BackupResource |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsbackup#BackupResource |
Java | software.amazon.awscdk.services.backup.BackupResource |
Python | aws_cdk.aws_backup.BackupResource |
TypeScript (source) | aws-cdk-lib » aws_backup » BackupResource |
A resource to backup.
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-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`
]
})
Initializer
new BackupResource(resource?: string, tagCondition?: TagCondition, construct?: Construct)
Parameters
- resource
string
- tagCondition
Tag
Condition - construct
Construct
Properties
Name | Type | Description |
---|---|---|
construct? | Construct | A construct. |
resource? | string | A resource. |
tag | Tag | A condition on a tag. |
construct?
Type:
Construct
(optional)
A construct.
resource?
Type:
string
(optional)
A resource.
tagCondition?
Type:
Tag
(optional)
A condition on a tag.
Methods
Name | Description |
---|---|
static from | A list of ARNs or match patterns such as arn:aws:ec2:us-east-1:123456789012:volume/* . |
static from | Adds all supported resources in a construct. |
static from | A DynamoDB table. |
static from | An EC2 instance. |
static from | An EFS file system. |
static from | A RDS database cluter. |
static from | A RDS database instance. |
static from | An Aurora database instance. |
static from | A tag condition. |
Arn(arn)
static frompublic static fromArn(arn: string): BackupResource
Parameters
- arn
string
Returns
A list of ARNs or match patterns such as arn:aws:ec2:us-east-1:123456789012:volume/*
.
Construct(construct)
static frompublic static fromConstruct(construct: Construct): BackupResource
Parameters
- construct
Construct
— The construct containing resources to backup.
Returns
Adds all supported resources in a construct.
DynamoDbTable(table)
static frompublic static fromDynamoDbTable(table: ITable): BackupResource
Parameters
- table
ITable
Returns
A DynamoDB table.
Ec2Instance(instance)
static frompublic static fromEc2Instance(instance: IInstance): BackupResource
Parameters
- instance
IInstance
Returns
An EC2 instance.
EfsFileSystem(fileSystem)
static frompublic static fromEfsFileSystem(fileSystem: IFileSystem): BackupResource
Parameters
- fileSystem
IFile
System
Returns
An EFS file system.
RdsDatabaseCluster(cluster)
static frompublic static fromRdsDatabaseCluster(cluster: IDatabaseCluster): BackupResource
Parameters
- cluster
IDatabase
Cluster
Returns
A RDS database cluter.
RdsDatabaseInstance(instance)
static frompublic static fromRdsDatabaseInstance(instance: IDatabaseInstance): BackupResource
Parameters
- instance
IDatabase
Instance
Returns
A RDS database instance.
RdsServerlessCluster(cluster)
static frompublic static fromRdsServerlessCluster(cluster: IServerlessCluster): BackupResource
Parameters
- cluster
IServerless
Cluster
Returns
An Aurora database instance.
Tag(key, value, operation?)
static frompublic static fromTag(key: string, value: string, operation?: TagOperation): BackupResource
Parameters
- key
string
- value
string
- operation
Tag
Operation
Returns
A tag condition.