File tree 3 files changed +71
-3
lines changed
packages/aws-cdk-lib/aws-rds 3 files changed +71
-3
lines changed Original file line number Diff line number Diff line change @@ -538,7 +538,7 @@ export interface DatabaseInstanceNewProps {
538
538
/**
539
539
* The amount of time, in days, to retain Performance Insights data.
540
540
*
541
- * @default 7
541
+ * @default 7 this is the free tier
542
542
*/
543
543
readonly performanceInsightRetention ?: PerformanceInsightRetention ;
544
544
Original file line number Diff line number Diff line change @@ -529,16 +529,46 @@ export interface RotationMultiUserOptions extends CommonRotationUserOptions {
529
529
}
530
530
531
531
/**
532
- * The retention period for Performance Insight.
532
+ * The retention period for Performance Insight data, in days.
533
+ *
534
+ * Per https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbinstance.html#cfn-rds-dbinstance-performanceinsightsretentionperiod
535
+ * This must be either
536
+ * - 7 days (the default, free tier)
537
+ * - month * 31, where month is a number of months from 1-23
538
+ * - 731 (2 years)
533
539
*/
534
540
export enum PerformanceInsightRetention {
535
541
/**
536
542
* Default retention period of 7 days.
537
543
*/
538
544
DEFAULT = 7 ,
539
545
546
+ MONTHS_1 = 31 ,
547
+ MONTHS_2 = 31 * 2 ,
548
+ MONTHS_3 = 31 * 3 ,
549
+ MONTHS_4 = 31 * 4 ,
550
+ MONTHS_5 = 31 * 5 ,
551
+ MONTHS_6 = 31 * 6 ,
552
+ MONTHS_7 = 31 * 7 ,
553
+ MONTHS_8 = 31 * 8 ,
554
+ MONTHS_9 = 31 * 9 ,
555
+ MONTHS_10 = 31 * 10 ,
556
+ MONTHS_11 = 31 * 11 ,
557
+ MONTHS_12 = 31 * 12 ,
558
+ MONTHS_13 = 31 * 13 ,
559
+ MONTHS_14 = 31 * 14 ,
560
+ MONTHS_15 = 31 * 15 ,
561
+ MONTHS_16 = 31 * 16 ,
562
+ MONTHS_17 = 31 * 17 ,
563
+ MONTHS_18 = 31 * 18 ,
564
+ MONTHS_19 = 31 * 19 ,
565
+ MONTHS_20 = 31 * 20 ,
566
+ MONTHS_21 = 31 * 21 ,
567
+ MONTHS_22 = 31 * 22 ,
568
+ MONTHS_23 = 31 * 23 ,
569
+
540
570
/**
541
571
* Long term retention period of 2 years.
542
572
*/
543
- LONG_TERM = 731
573
+ LONG_TERM = 731 ,
544
574
}
Original file line number Diff line number Diff line change @@ -1349,6 +1349,44 @@ describe('instance', () => {
1349
1349
} ) ;
1350
1350
} ) ;
1351
1351
1352
+ test . each < keyof typeof rds . PerformanceInsightRetention > ( [
1353
+ 'DEFAULT' ,
1354
+ 'MONTHS_1' ,
1355
+ 'MONTHS_2' ,
1356
+ 'MONTHS_3' ,
1357
+ 'MONTHS_4' ,
1358
+ 'MONTHS_5' ,
1359
+ 'MONTHS_6' ,
1360
+ 'MONTHS_7' ,
1361
+ 'MONTHS_8' ,
1362
+ 'MONTHS_9' ,
1363
+ 'MONTHS_10' ,
1364
+ 'MONTHS_11' ,
1365
+ 'MONTHS_12' ,
1366
+ 'MONTHS_13' ,
1367
+ 'MONTHS_14' ,
1368
+ 'MONTHS_15' ,
1369
+ 'MONTHS_16' ,
1370
+ 'MONTHS_17' ,
1371
+ 'MONTHS_18' ,
1372
+ 'MONTHS_19' ,
1373
+ 'MONTHS_20' ,
1374
+ 'MONTHS_21' ,
1375
+ 'MONTHS_22' ,
1376
+ 'MONTHS_23' ,
1377
+ 'LONG_TERM' ,
1378
+ ] ) ( 'performance insights retention of %s' , ( performanceInsightRetentionKey ) => {
1379
+ new rds . DatabaseInstance ( stack , 'Instance' , {
1380
+ engine : rds . DatabaseInstanceEngine . mysql ( { version : rds . MysqlEngineVersion . VER_8_0_19 } ) ,
1381
+ vpc,
1382
+ performanceInsightRetention : rds . PerformanceInsightRetention [ performanceInsightRetentionKey ] ,
1383
+ } ) ;
1384
+
1385
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::RDS::DBInstance' , {
1386
+ PerformanceInsightsRetentionPeriod : rds . PerformanceInsightRetention [ performanceInsightRetentionKey ] ,
1387
+ } ) ;
1388
+ } ) ;
1389
+
1352
1390
test ( 'throws if performance insights fields are set but performance insights is disabled' , ( ) => {
1353
1391
expect ( ( ) => {
1354
1392
new rds . DatabaseInstance ( stack , 'Instance' , {
You can’t perform that action at this time.
0 commit comments