(aws_rds): (publiclyAccessible prop support to DatabaseCluster construct for Aurora PostgreSQL and MySQL engines
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 71
Description
### Describe the feature
The DatabaseCluster construct in `aws-cdk-lib.aws_rds` does not expose a `publiclyAccessible` property for any Aurora engine types (aurora-mysql, aurora-postgresql).
According to the [CloudFormation documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-publiclyaccessible), the `PubliclyAccessible` property is supported for AWS::RDS::DBCluster when the Engine is set to `postgres` or `mysql`.
However, the [CDK DatabaseCluster construct](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.DatabaseCluster.html) does not expose this property at all.
### Use Case
We run [AWS Guard rules](https://github.com/aws-cloudformation/aws-guard-rules-registry/tree/main/rules/aws) against our cloudformation template and cloudformation hooks were set to fail during the stack creation/update if `publiclyAccessible` prop is not set or set to `True` for `AWS::RDS::DBCluster`
As per AWS documentation, CDK doesn't support `publiclyAccessible` prop for any RDS engine.
When tried adding `publiclyAccessible: false` prop in CDK, the `cdk synth` fails with below reason and we ended up adding the CFN NAG suppression rules as an one time exception to skip the stack failure.
`Object literal may only specify known properties, and 'publiclyAccessible' does not exist in type 'DatabaseClusterProps'.ts(2353)
(property) publiclyAccessible: boolean`
### Proposed Solution
The DatabaseCluster construct should support the `publiclyAccessible` property for engines where the underlying CloudFormation `AWS::RDS::DBCluster` resource supports it (specifically postgres and mysql engines).
### Other Information
_No response_
### Acknowledgements
- [x] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### AWS CDK Library version (aws-cdk-lib)
2.232.1
### AWS CDK CLI version
2.1105.0
### Environment details (OS name and version, etc.)
Debian GNU/Linux 11
Contributor guide
Research direction
Start at the DatabaseCluster construct and DatabaseClusterProps in aws-cdk-lib.aws_rds, then trace how Aurora PostgreSQL and MySQL properties are synthesized to AWS::RDS::DBCluster. Add support for publiclyAccessible only where CloudFormation supports it, and verify that cdk synth produces the expected property for the supported engines.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, mysql, postgresql, typescript
- Domain
- cloud, databases, infrastructure
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100