aws-rds: dbProxyName case mismatch
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 74
Description
### Describe the bug
Not sure that this is a bug per se, but it's surprising behavior. If you create a `DatabaseProxy` without `dbProxyName` set, and the construct ID is mixed case, RDS will automatically convert it to lowercase when the proxy is created.
This causes issues with other parts of the CDK if you use the `dbNameProxy`, because that ref will use the mixed-case name, leading to mismatches in the rest of the application. I encountered this when trying to create a Cloudwatch Alarm using the proxy name.
There is a workaround: you can just explicitly set the `dbProxyName` to the lowercased variant of your construct ID.
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Library Version
_No response_
### Expected Behavior
I expected the `dbProxyName` property to return the lowercased version of the identifier, since that is what the proxy is created with.
### Current Behavior
`dbProxyName` returns the mixed cased variant of the identifier.
### Reproduction Steps
```
this.proxy = new DatabaseProxy(this, `${props.stage}-AuroraProxy`, {
proxyTarget: ProxyTarget.fromCluster(this.cluster),
secrets: [this.secret],
vpc: props.vpc,
vpcSubnets: { subnetType: SubnetType.PRIVATE_WITH_EGRESS },
securityGroups: [this.proxySecurityGroup],
requireTLS: false,
});
this.metric = new Metric({
namespace: 'AWS/RDS',
metricName: 'DatabaseConnections',
dimensionsMap: {
ProxyName: this.proxy.dbProxyName,
TargetGroup: 'default',
TargetRole: 'READ_ONLY',
},
statistic: 'Sum',
period: Duration.minutes(1),
label: 'ReadOnly Connections',
});
```
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### AWS CDK Library version (aws-cdk-lib)
2.191.0
### AWS CDK CLI version
2.1011.0
### Node.js Version
24.18.0
### OS
Amazon Linux 2
### Language
TypeScript
### Language Version
6.0.2
### Other information
_No response_
Contributor guide
Research direction
Start at the DatabaseProxy construct and its dbProxyName property, then reproduce the mixed-case construct ID with the provided CloudWatch metric example. Check the generated RDS proxy name and the value exposed through dbProxyName; done means they match in lowercase and a regression test covers the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100