# PerformanceInsightRetention

The retention period for Performance Insight data, in days.

Per https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbinstance.html#cfn-rds-dbinstance-performanceinsightsretentionperiod
This must be either
- 7 days (the default, free tier)
- month * 31, where month is a number of months from 1-23
- 731 (2 years)

- Source: [`aws-rds/lib/props.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-rds/lib/props.ts#L559)
- Type last changed: v2.78.0 · 4 May 2023

## Example

TypeScript:

```ts
declare const vpc: ec2.Vpc;
declare const kmsKey: kms.Key;
new rds.DatabaseCluster(this, 'Database', {
  engine: rds.DatabaseClusterEngine.AURORA,
  vpc: vpc,
  enablePerformanceInsights: true,
  performanceInsightRetention: rds.PerformanceInsightRetention.LONG_TERM,
  performanceInsightEncryptionKey: kmsKey,
  writer: rds.ClusterInstance.provisioned('Writer', {
    instanceType: ec2.InstanceType.of(ec2.InstanceClass.R7G, ec2.InstanceSize.LARGE),
  }),
});
```

Python:

```python
# vpc: ec2.Vpc
# kms_key: kms.Key

rds.DatabaseCluster(self, "Database",
    engine=rds.DatabaseClusterEngine.AURORA,
    vpc=vpc,
    enable_performance_insights=True,
    performance_insight_retention=rds.PerformanceInsightRetention.LONG_TERM,
    performance_insight_encryption_key=kms_key,
    writer=rds.ClusterInstance.provisioned("Writer",
        instance_type=ec2.InstanceType.of(ec2.InstanceClass.R7G, ec2.InstanceSize.LARGE)
    )
)
```

Java:

```java
Vpc vpc;
Key kmsKey;

DatabaseCluster.Builder.create(this, "Database")
        .engine(DatabaseClusterEngine.AURORA)
        .vpc(vpc)
        .enablePerformanceInsights(true)
        .performanceInsightRetention(PerformanceInsightRetention.LONG_TERM)
        .performanceInsightEncryptionKey(kmsKey)
        .writer(ClusterInstance.provisioned("Writer", ProvisionedClusterInstanceProps.builder()
                .instanceType(InstanceType.of(InstanceClass.R7G, InstanceSize.LARGE))
                .build()))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
Vpc vpc;
Key kmsKey;

new DatabaseCluster(this, "Database", new DatabaseClusterProps {
    Engine = DatabaseClusterEngine.AURORA,
    Vpc = vpc,
    EnablePerformanceInsights = true,
    PerformanceInsightRetention = PerformanceInsightRetention.LONG_TERM,
    PerformanceInsightEncryptionKey = kmsKey,
    Writer = ClusterInstance.Provisioned("Writer", new ProvisionedClusterInstanceProps {
        InstanceType = InstanceType.Of(InstanceClass.R7G, InstanceSize.LARGE)
    })
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var vpc Vpc
var kmsKey Key

rds.NewDatabaseCluster(this, jsii.String("Database"), &DatabaseClusterProps{
	Engine: rds.DatabaseClusterEngine_AURORA(),
	Vpc: vpc,
	EnablePerformanceInsights: jsii.Boolean(true),
	PerformanceInsightRetention: rds.PerformanceInsightRetention_LONG_TERM,
	PerformanceInsightEncryptionKey: kmsKey,
	Writer: rds.ClusterInstance_Provisioned(jsii.String("Writer"), &ProvisionedClusterInstanceProps{
		InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_R7G, ec2.InstanceSize_LARGE),
	}),
})
```

## Members

| Member | Description |
| --- | --- |
| `DEFAULT` | Default retention period of 7 days. |
| `MONTHS_1` |  |
| `MONTHS_2` |  |
| `MONTHS_3` |  |
| `MONTHS_4` |  |
| `MONTHS_5` |  |
| `MONTHS_6` |  |
| `MONTHS_7` |  |
| `MONTHS_8` |  |
| `MONTHS_9` |  |
| `MONTHS_10` |  |
| `MONTHS_11` |  |
| `MONTHS_12` |  |
| `MONTHS_13` |  |
| `MONTHS_14` |  |
| `MONTHS_15` |  |
| `MONTHS_16` |  |
| `MONTHS_17` |  |
| `MONTHS_18` |  |
| `MONTHS_19` |  |
| `MONTHS_20` |  |
| `MONTHS_21` |  |
| `MONTHS_22` |  |
| `MONTHS_23` |  |
| `LONG_TERM` | Long term retention period of 2 years. |

## Referenced by

- [`ClusterInstanceOptions`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.ClusterInstanceOptions.html).performanceInsightRetention
- [`DatabaseCluster`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.DatabaseCluster.html).performanceInsightRetention
- [`DatabaseClusterFromSnapshot`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.DatabaseClusterFromSnapshot.html).performanceInsightRetention
- [`DatabaseClusterFromSnapshotProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.DatabaseClusterFromSnapshotProps.html).performanceInsightRetention
- [`DatabaseClusterProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.DatabaseClusterProps.html).performanceInsightRetention
- [`DatabaseInstanceNewProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.DatabaseInstanceNewProps.html).performanceInsightRetention
- [`IAuroraClusterInstance`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.IAuroraClusterInstance.html).performanceInsightRetention
- [`InstanceProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.InstanceProps.html).performanceInsightRetention
