aws-cdk-lib.aws_backup.BackupPlan

class BackupPlan (construct)

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

Implements IConstruct, IDependable, IResource, IBackupPlan

A backup plan.

Example

// Daily, weekly and monthly with 5 year retention
const plan = backup.BackupPlan.dailyWeeklyMonthly5YearRetention(this, 'Plan');

Initializer

new BackupPlan(scope: Construct, id: string, props?: BackupPlanProps)

Parameters

  • scope Construct
  • id string
  • props BackupPlanProps

Construct Props

NameTypeDescription
backupPlanName?stringThe display name of the backup plan.
backupPlanRules?BackupPlanRule[]Rules for the backup plan.
backupVault?IBackupVaultThe backup vault where backups are stored.
windowsVss?booleanEnable Windows VSS backup.

backupPlanName?

Type: string (optional, default: A CDK generated name)

The display name of the backup plan.


backupPlanRules?

Type: BackupPlanRule[] (optional, default: use addRule() to add rules)

Rules for the backup plan.

Use addRule() to add rules after instantiation.


backupVault?

Type: IBackupVault (optional, default: use the vault defined at the rule level. If not defined a new common vault for the plan will be created)

The backup vault where backups are stored.


windowsVss?

Type: boolean (optional, default: false)

Enable Windows VSS backup.

See also: https://docs.aws.amazon.com/aws-backup/latest/devguide/windows-backups.html

Properties

NameTypeDescription
backupPlanArnstringThe ARN of the backup plan.
backupPlanIdstringThe identifier of the backup plan.
backupVaultIBackupVaultThe backup vault where backups are stored if not defined at the rule level.
envResourceEnvironmentThe environment this resource belongs to.
nodeNodeThe tree node.
stackStackThe stack in which this resource is defined.
versionIdstringVersion Id.

backupPlanArn

Type: string

The ARN of the backup plan.


backupPlanId

Type: string

The identifier of the backup plan.


backupVault

Type: IBackupVault

The backup vault where backups are stored if not defined at the rule level.


env

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


node

Type: Node

The tree node.


stack

Type: Stack

The stack in which this resource is defined.


versionId

Type: string

Version Id.

Methods

NameDescription
addRule(rule)Adds a rule to a plan.
addSelection(id, options)Adds a selection to this plan.
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
toString()Returns a string representation of this construct.
static daily35DayRetention(scope, id, backupVault?)Daily with 35 day retention.
static dailyMonthly1YearRetention(scope, id, backupVault?)Daily and monthly with 1 year retention.
static dailyWeeklyMonthly5YearRetention(scope, id, backupVault?)Daily, weekly and monthly with 5 year retention.
static dailyWeeklyMonthly7YearRetention(scope, id, backupVault?)Daily, weekly and monthly with 7 year retention.
static fromBackupPlanId(scope, id, backupPlanId)Import an existing backup plan.

addRule(rule)

public addRule(rule: BackupPlanRule): void

Parameters

  • rule BackupPlanRule — the rule to add.

Adds a rule to a plan.


addSelection(id, options)

public addSelection(id: string, options: BackupSelectionOptions): BackupSelection

Parameters

  • id string
  • options BackupSelectionOptions

Returns

  • BackupSelection

Adds a selection to this plan.


applyRemovalPolicy(policy)

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).


toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.


static daily35DayRetention(scope, id, backupVault?)

public static daily35DayRetention(scope: Construct, id: string, backupVault?: IBackupVault): BackupPlan

Parameters

  • scope Construct
  • id string
  • backupVault IBackupVault

Returns

  • BackupPlan

Daily with 35 day retention.


static dailyMonthly1YearRetention(scope, id, backupVault?)

public static dailyMonthly1YearRetention(scope: Construct, id: string, backupVault?: IBackupVault): BackupPlan

Parameters

  • scope Construct
  • id string
  • backupVault IBackupVault

Returns

  • BackupPlan

Daily and monthly with 1 year retention.


static dailyWeeklyMonthly5YearRetention(scope, id, backupVault?)

public static dailyWeeklyMonthly5YearRetention(scope: Construct, id: string, backupVault?: IBackupVault): BackupPlan

Parameters

  • scope Construct
  • id string
  • backupVault IBackupVault

Returns

  • BackupPlan

Daily, weekly and monthly with 5 year retention.


static dailyWeeklyMonthly7YearRetention(scope, id, backupVault?)

public static dailyWeeklyMonthly7YearRetention(scope: Construct, id: string, backupVault?: IBackupVault): BackupPlan

Parameters

  • scope Construct
  • id string
  • backupVault IBackupVault

Returns

  • BackupPlan

Daily, weekly and monthly with 7 year retention.


static fromBackupPlanId(scope, id, backupPlanId)

public static fromBackupPlanId(scope: Construct, id: string, backupPlanId: string): IBackupPlan

Parameters

  • scope Construct
  • id string
  • backupPlanId string

Returns

  • IBackupPlan

Import an existing backup plan.