Skip to content
v2.274.0

BackupPlan L2 construct ​

A backup plan.

Example ​

ts
// Daily, weekly and monthly with 5 year retention
const plan = backup.BackupPlan.dailyWeeklyMonthly5YearRetention(this, 'Plan');
python
# Daily, weekly and monthly with 5 year retention
plan = backup.BackupPlan.daily_weekly_monthly5_year_retention(self, "Plan")
java
// Daily, weekly and monthly with 5 year retention
BackupPlan plan = BackupPlan.dailyWeeklyMonthly5YearRetention(this, "Plan");
csharp
// Install: dotnet add package Amazon.CDK.Lib
// Daily, weekly and monthly with 5 year retention
var plan = BackupPlan.DailyWeeklyMonthly5YearRetention(this, "Plan");
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Daily, weekly and monthly with 5 year retention
plan := backup.BackupPlan_DailyWeeklyMonthly5YearRetention(this, jsii.String("Plan"))

Initializer ​

ts
new BackupPlan(scope: Construct, id: string, props?: BackupPlanProps)
python
BackupPlan(scope: Construct, id: str, props: typing.Optional[BackupPlanProps] = None)
java
new BackupPlan(Construct scope, String id, BackupPlanProps props)
csharp
new BackupPlan(Construct scope, string id, BackupPlanProps? props = null)
go
NewBackupPlan(Scope Construct, Id *string, Props BackupPlanProps)

Construct Props ​

backupPlanNamestringbackup_plan_namestrbackupPlanNameStringBackupPlanNamestringBackupPlanName*string= A CDK generated name#
The display name of the backup plan.
backupPlanRulesBackupPlanRule[]backup_plan_rulestyping.List[BackupPlanRule]backupPlanRulesList<BackupPlanRule>BackupPlanRulesBackupPlanRule[]BackupPlanRules*[]BackupPlanRule= use `addRule()` to add rules#
Rules for the backup plan.

Use addRule() to add rules after instantiation.

backupVaultIBackupVaultRefbackup_vaultIBackupVaultRefbackupVaultIBackupVaultRefBackupVaultIBackupVaultRefBackupVaultIBackupVaultRef= use the vault defined at the rul…#
The backup vault where backups are stored.
default

Default: use the vault defined at the rule level. If not defined a new common vault for the plan will be created

windowsVssbooleanwindows_vssboolwindowsVssBooleanWindowsVssboolWindowsVss*bool= false#
Enable Windows VSS backup.

Properties ​

backupPlanArnstringbackup_plan_arnstrbackupPlanArnStringBackupPlanArnstringBackupPlanArn*stringrequired#
The ARN of the backup plan.
backupPlanIdstringbackup_plan_idstrbackupPlanIdStringBackupPlanIdstringBackupPlanId*stringrequired#
The identifier of the backup plan.
backupPlanRefBackupPlanReferencebackup_plan_refBackupPlanReferencebackupPlanRefBackupPlanReferenceBackupPlanRefBackupPlanReferenceBackupPlanRefBackupPlanReferencerequired#
A reference to a BackupPlan resource.
backupVaultIBackupVaultbackup_vaultIBackupVaultbackupVaultIBackupVaultBackupVaultIBackupVaultBackupVaultIBackupVaultrequired#
The backup vault where backups are stored if not defined at the rule level.
The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#
Uniquely identifies this class.
stackStackstackStackstackStackStackStackStackStackrequired#
The stack in which this resource is defined.
versionIdstringversion_idstrversionIdStringVersionIdstringVersionId*stringrequired#
Version Id.

Methods ​

addRule(rule: BackupPlanRule): voiddef add_rule(self, rule: BackupPlanRule) -> Nonepublic void addRule(BackupPlanRule rule)public void AddRule(BackupPlanRule rule)func AddRule(Rule BackupPlanRule)#
Adds a rule to a plan.
1 parameter

Parameters

  • ruleruleruleruleRule — the rule to add.
addSelection(id: string, options: BackupSelectionOptions): BackupSelectiondef add_selection(self, id: str, options: BackupSelectionOptions) -> BackupSelectionpublic BackupSelection addSelection(String id, BackupSelectionOptions options)public BackupSelection AddSelection(string id, BackupSelectionOptions options)func AddSelection(Id *string, Options BackupSelectionOptions) BackupSelection#
Adds a selection to this plan.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Override the cross-stack reference strength for this resource.
notes · 1 parameter

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

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).

daily35DayRetention(scope: Construct, id: string, backupVault?: IBackupVaultRef): BackupPlan // chainable@staticmethod def daily35_day_retention(scope: Construct, id: str, backup_vault: typing.Optional[IBackupVaultRef] = None) -> BackupPlanpublic static BackupPlan daily35DayRetention(Construct scope, String id, IBackupVaultRef backupVault)public static BackupPlan Daily35DayRetention(Construct scope, string id, IBackupVaultRef? backupVault = null)func Daily35DayRetention(Scope Construct, Id *string, BackupVault IBackupVaultRef) BackupPlanstatic#
Daily with 35 day retention.
dailyMonthly1YearRetention(scope: Construct, id: string, backupVault?: IBackupVaultRef): BackupPlan // chainable@staticmethod def daily_monthly1_year_retention(scope: Construct, id: str, backup_vault: typing.Optional[IBackupVaultRef] = None) -> BackupPlanpublic static BackupPlan dailyMonthly1YearRetention(Construct scope, String id, IBackupVaultRef backupVault)public static BackupPlan DailyMonthly1YearRetention(Construct scope, string id, IBackupVaultRef? backupVault = null)func DailyMonthly1YearRetention(Scope Construct, Id *string, BackupVault IBackupVaultRef) BackupPlanstatic#
Daily and monthly with 1 year retention.
dailyWeeklyMonthly5YearRetention(scope: Construct, id: string, backupVault?: IBackupVaultRef): BackupPlan // chainable@staticmethod def daily_weekly_monthly5_year_retention(scope: Construct, id: str, backup_vault: typing.Optional[IBackupVaultRef] = None) -> BackupPlanpublic static BackupPlan dailyWeeklyMonthly5YearRetention(Construct scope, String id, IBackupVaultRef backupVault)public static BackupPlan DailyWeeklyMonthly5YearRetention(Construct scope, string id, IBackupVaultRef? backupVault = null)func DailyWeeklyMonthly5YearRetention(Scope Construct, Id *string, BackupVault IBackupVaultRef) BackupPlanstatic#
Daily, weekly and monthly with 5 year retention.
dailyWeeklyMonthly7YearRetention(scope: Construct, id: string, backupVault?: IBackupVaultRef): BackupPlan // chainable@staticmethod def daily_weekly_monthly7_year_retention(scope: Construct, id: str, backup_vault: typing.Optional[IBackupVaultRef] = None) -> BackupPlanpublic static BackupPlan dailyWeeklyMonthly7YearRetention(Construct scope, String id, IBackupVaultRef backupVault)public static BackupPlan DailyWeeklyMonthly7YearRetention(Construct scope, string id, IBackupVaultRef? backupVault = null)func DailyWeeklyMonthly7YearRetention(Scope Construct, Id *string, BackupVault IBackupVaultRef) BackupPlanstatic#
Daily, weekly and monthly with 7 year retention.
fromBackupPlanId(scope: Construct, id: string, backupPlanId: string): IBackupPlan@staticmethod def from_backup_plan_id(scope: Construct, id: str, backup_plan_id: str) -> IBackupPlanpublic static IBackupPlan fromBackupPlanId(Construct scope, String id, String backupPlanId)public static IBackupPlan FromBackupPlanId(Construct scope, string id, string backupPlanId)func FromBackupPlanId(Scope Construct, Id *string, BackupPlanId *string) IBackupPlanstatic#
Import an existing backup plan.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#
Returns true if the construct was created by CDK, and false otherwise.
isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#
Check whether the given construct is a Resource.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.