Skip to content

Conversation

@mazyu36
Copy link
Contributor

@mazyu36 mazyu36 commented Jun 30, 2025

Issue # (if applicable)

Closes #34743

Reason for this change

Database insights for Aurora Cluster was previously implemented in #32851.

Database insights is also supported for RDS instances, but the current L2 construct
does not support it.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Database-Insights.html

Description of changes

  • Add databaseInsightsMode property to DatabaseInstance class
  • Consolidate validation logic by creating a shared validation module that works for both cluster and instance types

Describe any new or updated permissions being added

N/A

Description of how you validated changes

Add unit tests and integ tests.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team June 30, 2025 05:37
@github-actions github-actions bot added effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 distinguished-contributor [Pilot] contributed 50+ PRs to the CDK labels Jun 30, 2025

const enablePerformanceInsights = props.enablePerformanceInsights
|| props.performanceInsightRetention !== undefined || props.performanceInsightEncryptionKey !== undefined;
if (enablePerformanceInsights && props.enablePerformanceInsights === false) {
Copy link
Contributor Author

@mazyu36 mazyu36 Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I consolidated the validation into the following.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jun 30, 2025
Copy link
Contributor

@badmintoncryer badmintoncryer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! I've added some minor comments.

});
});

test('instance with the standard mode of database insights', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be safe, could you please add a test to verify that databaseInsightsMode.STANDARD can be set even when Performance Insights is disabled?

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jul 2, 2025
Copy link
Contributor

@badmintoncryer badmintoncryer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mazyu36
Copy link
Contributor Author

mazyu36 commented Jul 2, 2025

Thanks always!

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jul 2, 2025
@mazyu36 mazyu36 changed the title feat(rds): support Database Insights for RDS instances. feat(rds): support Database Insights for RDS instances Jul 2, 2025
@leonmk-aws leonmk-aws self-assigned this Jul 4, 2025
Copy link
Contributor

@leonmk-aws leonmk-aws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, left some comments

* Validates database instance properties
*/
export function validateDatabaseInstanceProps(scope: Construct, props: DatabaseInstanceProps): void {
validateAllProps(scope, DatabaseInstance.name, props, databaseInsightsRules as ValidationRule<DatabaseInstanceProps>[]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a new validation rule to validate that Standard mode of Database Insights supports only a retention period of 7 days, as this will be the behavior after November 30 2025 ? See the warning: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.Enabling.html
(We should have done the same for validateDatabseClusterProps but that would be a breaking change)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, this should be a warning since users can set flexible retention periods until November 30, 2025, and some users may have already implemented this for RDS Instances using Escape Hatches.
If a warning is appropriate, it should apply to both RDS Clusters and Instances, so I will implement this in a new PR.

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good callout, let's not add a validation rule. Regarding the warning, this is an option, another one would be to simply add it in the description block and when the new behavior kicks in at the end of November, we can evaluate if these props should be deprecated.

@mergify mergify bot dismissed leonmk-aws’s stale review July 10, 2025 12:12

Pull request has been modified.

@mazyu36 mazyu36 requested a review from leonmk-aws July 12, 2025 08:04
@mergify
Copy link
Contributor

mergify bot commented Jul 17, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 93c5d5f
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Jul 17, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 304e2db into aws:main Jul 17, 2025
18 checks passed
@github-actions
Copy link
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

distinguished-contributor [Pilot] contributed 50+ PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 pr/needs-maintainer-review This PR needs a review from a Core Team Member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rds: support Database Insights for RDS (postgres) Instance

4 participants