Skip to content

feat(rds): add Read/Write IOPS metrics to DatabaseInstance and VolumeRead/Write IOPs metrics to DatabaseCluster#35773

Merged
mergify[bot] merged 21 commits intoaws:mainfrom
jasdeepbhalla:issue_35327_add_metricReadIOPs_method_to_DatabaseClusterBase
Jan 15, 2026
Merged

feat(rds): add Read/Write IOPS metrics to DatabaseInstance and VolumeRead/Write IOPs metrics to DatabaseCluster#35773
mergify[bot] merged 21 commits intoaws:mainfrom
jasdeepbhalla:issue_35327_add_metricReadIOPs_method_to_DatabaseClusterBase

Conversation

@jasdeepbhalla
Copy link
Copy Markdown
Contributor

@jasdeepbhalla jasdeepbhalla commented Oct 17, 2025

Issue #35327

Closes #35327.

Reason for this change

Users cannot easily track ReadIOPs/WriteIOPs at the instance-level and VolumeReadIOPs/VolumeWriteIOPs at the cluster level.

Description of changes

This change adds support for additional Amazon RDS IOPS CloudWatch metrics to improve observability for both database instances and clusters.

New metrics introduced:

  • DatabaseInstance
    • metricReadIOPS()
    • metricWriteIOPS()

Instance Level metrics are supported as per these docs

  • DatabaseCluster
    • metricVolumeReadIOPs()
    • metricVolumeWriteIOPs()

Cluster Level metrics are supported as per these docs

These metrics align with existing RDS CloudWatch metrics and follow the same conventions as other metric helpers in the CDK.

Changes included

  • Added new metric helper methods to RDS instance and cluster constructs
  • Updated RDS README with usage examples
  • Added unit tests validating metric resolution
  • Added integration tests to verify metrics can be used to create alarms

Describe any new or updated permissions being added

  • No new IAM permissions are required, as this change only exposes a CloudWatch metric for monitoring purposes.

Description of how you validated changes

  • Unit tests added for both instance- and cluster-level metrics
  • Integration tests added to ensure metrics synthesize correctly and support alarm creation

Checklist


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

@github-actions github-actions bot added the effort/medium Medium work item – several days of effort label Oct 17, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team October 17, 2025 22:33
@github-actions github-actions bot added feature-request A feature should be added or improved. p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Oct 17, 2025
Copy link
Copy Markdown
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

(This review is outdated)

@jasdeepbhalla jasdeepbhalla changed the title feat(aws-rds): add metricReadIOPs method to DatabaseClusterBase feat(rds): add metricReadIOPs method to DatabaseClusterBase Oct 17, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review October 18, 2025 00:11

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@jasdeepbhalla
Copy link
Copy Markdown
Contributor Author

@pahud This PR is ready for review!

@jasdeepbhalla jasdeepbhalla force-pushed the issue_35327_add_metricReadIOPs_method_to_DatabaseClusterBase branch from 38157e0 to 31788ad Compare November 17, 2025 20:31
@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 Nov 18, 2025
@badmintoncryer
Copy link
Copy Markdown
Contributor

Thank you for your contribution!

Copy link
Copy Markdown
Member

@ozelalisen ozelalisen left a comment

Choose a reason for hiding this comment

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

You have merge conflicts too

* Represents the average of the ReadIOPS values across all instances in the cluster.
*/
public metricReadIOPS(props?: cloudwatch.MetricOptions) {
return this.metric('ReadIOPS', { statistic: 'Average', ...props });
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This metric is not available on cluster level, checking docs here: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.AuroraMonitoring.Metrics.html, could you please move this metric implementation to instance, because this would give an empty metric. For cluster level, we should use VolumeReadIOPs, but I do not see this metric is also available within CDK, so feel free to update this metric as VolumeReadIOPs and add ReadIOPS in instance level metrics.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thats a good catch @ozelalisen. I have updated the code to add Read/Write IOPS for DB Instance, and Volume Read/Write IOPS for DB Cluster.

@ozelalisen ozelalisen self-assigned this Jan 8, 2026
@jasdeepbhalla jasdeepbhalla changed the title feat(rds): add metricReadIOPs method to DatabaseClusterBase feat(rds): add metric: ReadIOPS to DatabaseInstance and metric: VolumeReadIOPs to DatabaseCluster Jan 9, 2026
@mergify mergify bot dismissed ozelalisen’s stale review January 12, 2026 20:21

Pull request has been modified.

Copy link
Copy Markdown
Member

@ozelalisen ozelalisen left a comment

Choose a reason for hiding this comment

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

PR Build is failing, you need to update snapshots

Comment on lines +49 to +53
cdkCommandOptions: {
deploy: {
args: {
rollback: true,
},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need to specify these arguments

Comment on lines +39 to +44
cdkCommandOptions: {
deploy: {
args: {
rollback: true,
},
},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need to provide these arguments


const app = new cdk.App();
const stack = new cdk.Stack(app, 'aws-cdk-rds-instance-iops-metric', {
terminationProtection: false,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

not needed


const app = new cdk.App();
const stack = new cdk.Stack(app, 'aws-cdk-rds-cluster-volume-iops-metric', {
terminationProtection: false,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

not needed

const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2, restrictDefaultSecurityGroup: false });

const instance = new rds.DatabaseInstance(stack, 'Instance', {
engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_16 }),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please upgrade the version

engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_16 }),
vpc,
multiAz: false,
publiclyAccessible: true,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

not needed

@mergify mergify bot dismissed ozelalisen’s stale review January 13, 2026 20:38

Pull request has been modified.

Copy link
Copy Markdown
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

(This review is outdated)

Copy link
Copy Markdown
Member

@ozelalisen ozelalisen left a comment

Choose a reason for hiding this comment

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

You should add snapshots for integ tests, build is failing due to that

@jasdeepbhalla
Copy link
Copy Markdown
Contributor Author

@ozelalisen Added the integration tests, this PR is ready for review.

@aws-cdk-automation aws-cdk-automation dismissed their stale review January 14, 2026 10:48

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@ozelalisen ozelalisen added the pr/needs-integration-tests-deployment Requires the PR to deploy the integration test snapshots. label Jan 14, 2026
@ozelalisen ozelalisen temporarily deployed to deployment-integ-test January 14, 2026 10:52 — with GitHub Actions Inactive
@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 Jan 14, 2026
Copy link
Copy Markdown
Member

@ozelalisen ozelalisen left a comment

Choose a reason for hiding this comment

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

Have some final comments regarding instance level metric configuration, see reference: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/appinsights-metrics-rds.html

* @default - average over 5 minutes
*/
public metricReadIOPs(props?: cloudwatch.MetricOptions) {
return this.metric('ReadIOPs', { statistic: 'Average', ...props });
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be ReadIOPS, all capital, this will return empty CW metric

Suggested change
return this.metric('ReadIOPs', { statistic: 'Average', ...props });
return this.metric('ReadIOPS', { statistic: 'Average', ...props });

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for my other comment regarding Aurora restriction, for instance level this is supported for all, let's remove incorrect doc above regarding restriction

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

aah ok, updated 👍

* @default - average over 5 minutes
*/
public metricWriteIOPs(props?: cloudwatch.MetricOptions) {
return this.metric('WriteIOPs', { statistic: 'Average', ...props });
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should be capital

Suggested change
return this.metric('WriteIOPs', { statistic: 'Average', ...props });
return this.metric('WriteIOPS', { statistic: 'Average', ...props });

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for my other comment regarding Aurora restriction, for instance level this is supported for all, let's remove incorrect doc above regarding restriction

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

aah ok, updated 👍

@jasdeepbhalla jasdeepbhalla force-pushed the issue_35327_add_metricReadIOPs_method_to_DatabaseClusterBase branch from 0655cb5 to 6fb924e Compare January 14, 2026 20:06
@mergify mergify bot dismissed ozelalisen’s stale review January 14, 2026 20:07

Pull request has been modified.

@ozelalisen ozelalisen removed the pr/needs-integration-tests-deployment Requires the PR to deploy the integration test snapshots. label Jan 15, 2026
Copy link
Copy Markdown
Member

@ozelalisen ozelalisen left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for addressing all comments!

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 15, 2026

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
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 15, 2026

Merge Queue Status

✅ The pull request has been merged at a95ed2e

This pull request spent 42 minutes 1 second in the queue, including 41 minutes 51 seconds running CI.
The checks were run in-place.

Required conditions to merge

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jan 15, 2026

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 d8e023d into aws:main Jan 15, 2026
22 of 23 checks passed
@github-actions
Copy link
Copy Markdown
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 Jan 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws-rds: add metricReadIOPs method to DatabaseClusterFromSnapshot

5 participants