aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.57k stars 3.88k forks source link

aws-rds: RDS Database Cluster support for GlobalDatabaseIdentifier #22212

Open alpatekar opened 2 years ago

alpatekar commented 2 years ago

Describe the feature

Add GlobalClusterIdentifier parameter to rds DatabaseCluster construct, in order to be able to add database clusters to Global Aurora Databases, for example in different regions. The parameter is already supported through Cloudformation.

Use Case

I want to add a database cluster in a different region to my Aurora Global Database cluster using CDK. This should be possible through the GlobalClusterIdentifier parameter.

Proposed Solution

No response

Other Information

No response

Acknowledgements

CDK version used

2.40.0

Environment details (OS name and version, etc.)

OSX

corymhall commented 2 years ago

This issue has been classified as p2. That means a workaround is available or it is deemed a nice-to-have feature. Given the amount of work there is to do and the relative priority of this issue, the CDK team is unlikely to address it. That does not mean the issue will never be fixed! If someone from the community submits a PR to fix this issue, and the PR is small and straightforward enough, and meets the quality bars to be reviewed and merged with little effort we will accept that PR. PRs that do not build or need complex or multiple rounds of reviews are unlikely to be merged and will be closed to keep our backlog manageable.

In the mean time, remember that you can always use the escape hatch (https://docs.aws.amazon.com/cdk/v2/guide/cfn_layer.html) mechanism to have fine control over the CloudFormation output you want. We will keep the issue open for discoverability, to collect upvotes, and to facilitate discussion around this topic.

We use +1s on this issue to help prioritize our work, and are happy to re-evaluate the prioritization of this issue based on community feedback. You can reach out to the cdk.dev community on Slack (https://cdk.dev/) to solicit support for reprioritization.

joshbalfour commented 1 year ago

For anyone who finds this in the future, this is how you can do what @corymhall describes above: https://gist.github.com/joshbalfour/385b0bbfa270e43078cda8468799b67a

ekeyser commented 1 year ago

@joshbalfour thanks for the link to your code. It'd be interesting to know how to do this is the context of pipelines (pipelines.CodePipeline). Here's the problem: in one pipeline stack a CfnGlobalCluster has been defined and deployed. In another pipeline stack (in another region) one would like to add a cluster as child to the already deployed CfnGlobalCluster except that in the cdk code the global cluster resource/reference/variable is not accessible so there is no way to reference it. Nor is there a way using Cfn constructs to import an existing resource (as far as I am aware).

Perhaps I can define the CfnGlobalCluster outside the context of the stack and pass it as a reference to the stack where I need it. I don't even think this is possible because I don't think Stack allows for custom properties. Even if this were possible this completely breaks the declarative philosophy of cdk and would require a step-wise implementation approach.

Honestly I think the only way around this is to have a cdk native construct which allows for importing of global cluster resources.

I guess one last implementation would be to spin up with all RDS resources completely outside of the pipeline Stack in each region, export the resource values, import the references in the pipeline stacks. I guess that would work albeit quite a hacky approach.