Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws_rds: unable to use per-instance parameters #27035

Closed
jessecollier opened this issue Sep 6, 2023 · 3 comments · Fixed by #27040
Closed

aws_rds: unable to use per-instance parameters #27035

jessecollier opened this issue Sep 6, 2023 · 3 comments · Fixed by #27040
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database bug This issue is a bug. effort/small Small work item – less than a day of effort p1

Comments

@jessecollier
Copy link

Describe the bug

When trying to use the parameters property during ClusterInstance.provisioned, it will try to create a ParameterGroup for you using the id InstanceParameterGroup.

If you try to have multiple instances (ie multiple readers) in a DatabaseCluster, this will throw error:

Error: There is already a Construct with name 'InstanceParameterGroup' in DatabaseCluster [Database]

Here's the specific line of code:
https://github.com/aws/aws-cdk/blob/v2.94.0/packages/aws-cdk-lib/aws-rds/lib/aurora-cluster-instance.ts#L457-L464

Expected Behavior

I should be able to provide a simple parameters object and a parameter group to be created for each unique instance.

Current Behavior

Throws an error

Reproduction Steps

Create a DatabaseCluster with multiple readers with the parameters: {} property set:

ClusterInstance.provisioned(`Instance${id}`, {
         parameters: {}
    });

Possible Solution

The ParameterGroup scope is the cluster, either the scope should be specific to the ClusterInstance, or the ParameterGroup should have a unique ID.

Additional Information/Context

No response

CDK CLI Version

2.94.0

Framework Version

No response

Node.js Version

18

OS

mac osx latest

Language

Typescript

Language Version

No response

Other information

No response

@jessecollier jessecollier added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 6, 2023
@github-actions github-actions bot added the @aws-cdk/aws-rds Related to Amazon Relational Database label Sep 6, 2023
@jessecollier
Copy link
Author

This is my current work-around to be compatible with how it was created using instanceProps

const cluster = new DatabaseCluster();
const numberOfInstances = 3
const paramGroup = new ParameterGroup(
      cluster,
      'InstanceParameterGroup',
      {
        engine: cluster.engine!,
        parameters: {},
      },
    );

    for (let i = 0; i < (numberOfInstances ?? 1); i++) {
      const instance = cluster.node.findChild(
        `Instance${i + 1}`,
      ) as CfnDBInstance;
      instance.addOverride(
        'Properties.DBParameterGroupName',
        paramGroup.bindToInstance({}).parameterGroupName,
      );
    }

@peterwoodworth peterwoodworth added p1 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Sep 6, 2023
@peterwoodworth
Copy link
Contributor

Makes sense, thanks for the report

@mergify mergify bot closed this as completed in #27040 Sep 22, 2023
mergify bot pushed a commit that referenced this issue Sep 22, 2023
…r feature flag) (#27040)

This PR fixes that DatabaseCluster cannot create multiple readers with each parameters.

Closes #27035.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database bug This issue is a bug. effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants