# BackupPlanRule

A backup plan rule.

Obtainable from: BackupPlanRule.daily, BackupPlanRule.monthly1Year, BackupPlanRule.monthly5Year, BackupPlanRule.monthly7Year, BackupPlanRule.weekly
Used as argument in: [BackupPlan.addRule](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_backup.BackupPlan.html#addrule)

- Source: [`aws-backup/lib/rule.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-backup/lib/rule.ts#L182)
- Type last changed: v2.234.0 · 8 Jan 2026

## Example

TypeScript:

```ts
declare const plan: backup.BackupPlan;
plan.addRule(new backup.BackupPlanRule({
  enableContinuousBackup: true,
  deleteAfter: Duration.days(14),
}));
```

Python:

```python
# plan: backup.BackupPlan

plan.add_rule(backup.BackupPlanRule(
    enable_continuous_backup=True,
    delete_after=Duration.days(14)
))
```

Java:

```java
BackupPlan plan;

plan.addRule(BackupPlanRule.Builder.create()
        .enableContinuousBackup(true)
        .deleteAfter(Duration.days(14))
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
BackupPlan plan;

plan.AddRule(new BackupPlanRule(new BackupPlanRuleProps {
    EnableContinuousBackup = true,
    DeleteAfter = Duration.Days(14)
}));
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var plan BackupPlan

plan.AddRule(backup.NewBackupPlanRule(&BackupPlanRuleProps{
	EnableContinuousBackup: jsii.Boolean(true),
	DeleteAfter: awscdk.Duration_Days(jsii.Number(14)),
}))
```

## Initializer

TypeScript:

```ts
new BackupPlanRule(props: BackupPlanRuleProps)
```

Python:

```python
BackupPlanRule(props: BackupPlanRuleProps)
```

Java:

```java
new BackupPlanRule(BackupPlanRuleProps props)
```

C# / .NET:

```csharp
new BackupPlanRule(BackupPlanRuleProps props)
```

Golang:

```go
NewBackupPlanRule(Props BackupPlanRuleProps)
```

## Properties

- `props`: [BackupPlanRuleProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_backup.BackupPlanRuleProps.html) — Properties of BackupPlanRule.

## Methods

- `daily(backupVault?: IBackupVaultRef): BackupPlanRule // chainable` (static) — Daily with 35 days retention.

- `monthly1Year(backupVault?: IBackupVaultRef): BackupPlanRule // chainable` (static) — Monthly 1 year retention, move to cold storage after 1 month.

- `monthly5Year(backupVault?: IBackupVaultRef): BackupPlanRule // chainable` (static) — Monthly 5 year retention, move to cold storage after 3 months.

- `monthly7Year(backupVault?: IBackupVaultRef): BackupPlanRule // chainable` (static) — Monthly 7 year retention, move to cold storage after 3 months.

- `weekly(backupVault?: IBackupVaultRef): BackupPlanRule // chainable` (static) — Weekly with 3 months retention.
