Skip to content

fix(rds): fix default port in proxy - #37638

Open
tiksangng wants to merge 6 commits into
aws:mainfrom
tiksangng:37635-proxy-default-port
Open

tiksangng wants to merge 6 commits into
aws:mainfrom
tiksangng:37635-proxy-default-port

Conversation

@tiksangng

Copy link
Copy Markdown

Issue # (if applicable)

Closes #37635.

Reason for this change

To fix a synthesis crash (Cannot call allowDefaultPortFrom(): this resource has no default port) that occurs because DatabaseProxy fails to inherit the default port from its underlying DatabaseCluster or DatabaseInstance target.

Description of changes

  • Exposed _defaultPort on ProxyTarget to allow the target's port to be read internally before the proxy binds to it.
  • Initialized the ec2.Connections object inside DatabaseProxy with the target's defaultPort.

Describe any new or updated permissions being added

N/A

Description of how you validated changes

  • Added new unit tests to ensure the default port can be inferred from the proxy targets.

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 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. p2 labels Apr 19, 2026
@aws-cdk-automation
aws-cdk-automation requested a review from a team April 19, 2026 09:13

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

(This review is outdated)

@aws-cdk-automation
aws-cdk-automation dismissed their stale review April 21, 2026 13:47

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

@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 Jul 31, 2026
@maintainer-for-aws

Copy link
Copy Markdown

Automated review

A maintainer will still review this — treat the notes below as a starting point.

This PR fixes a broken abstraction in aws-rds: a DatabaseProxy never propagated its target database's port into its ec2.Connections, so proxy.connections.allowDefaultPortFrom(...) / allowDefaultPortFromAnyIpv4(...) always threw "this resource has no default port". The fix adds an @internal ProxyTarget._defaultPort getter and seeds the proxy's Connections with the target's port (an Endpoint.Port token, matching real RDS Proxy behavior where the proxy listens on the DB engine's port). The change is small, correctly ordered so bind() still sees the proxy's security groups, and preserves prior behavior for imported targets that report no port. Two new unit tests (instance and cluster targets) and an integ update exercise the fixed path with regression-catching assertions on the resulting ingress rule. No issues found on this change.

🔴 0 blocking · 🟡 0 recommended · ⚪ 0 optional


Generated automatically. React 👍 or 👎 to tell us whether this review helped, so we can improve these reviews.

This branch was successfully deployed

1 active deployment
automation — 926308d7 Deployed Sep 25, 2026 by gjurova via validate-pr #369378
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. p2 pr/community-review-timeout pr/needs-maintainer-review This PR needs a review from a Core Team Member pr/request-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-rds): DatabaseProxy does not inherit defaultPort from ProxyTarget, causing allowDefaultPortFrom to fail

4 participants