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-cdk-lib/aws-rds/DatabaseCluster: DatabaseCluster.instanceEndpoints does not return writer endpoints #29279

Closed
steffenjambit opened this issue Feb 27, 2024 · 3 comments · Fixed by #29337
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database bug This issue is a bug. effort/medium Medium work item – several days of effort p1

Comments

@steffenjambit
Copy link

steffenjambit commented Feb 27, 2024

Describe the bug

The DatabaseCluster.instanceEndpoints only returns the reader endpoints but not the writer endpoints, while DatabaseCluster.instanceIdentifiers returns identifiers for both.

Expected Behavior

According to the documentation I would expect both endpoints return the information for all instances:
Screenshot 2024-02-27 at 14 45 39

i.e. DatabaseCluster.instanceEndpoints should return writer and reader endpoints.

Current Behavior

DatabaseCluster.instanceEndpoints only returns the reader endpoints but not the writer endpoints

Reproduction Steps

const clusterProps:DatabaseClusterProps = {
     …,
     writer: ClusterInstance.serverlessV2('writer'),
     readers: [ClusterInstance.serverlessV2('reader')],
     …
};
databaseCluster = new DatabaseCluster(
    this,
   `${id}`,
     {
       ...clusterProps,
        credentials: Credentials.fromSecret(secret),
     },
);
databaseCluster.instanceEndpoints

Possible Solution

the writer endpoint should be added to instanceEndpoints here:

instanceIdentifiers.push(writer.instanceIdentifier);

Screenshot 2024-02-27 at 14 53 30

Additional Information/Context

No response

CDK CLI Version

2.130.0

Framework Version

No response

Node.js Version

v18.17.1

OS

Mac

Language

TypeScript

Language Version

No response

Other information

No response

@steffenjambit steffenjambit added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 27, 2024
@github-actions github-actions bot added the @aws-cdk/aws-rds Related to Amazon Relational Database label Feb 27, 2024
@pahud
Copy link
Contributor

pahud commented Feb 27, 2024

According to this

(props.readers ?? []).forEach(instance => {
const clusterInstance = instance.bind(this, this, {
monitoringInterval: props.monitoringInterval,
monitoringRole: monitoringRole,
removalPolicy: props.removalPolicy ?? RemovalPolicy.SNAPSHOT,
subnetGroup: this.subnetGroup,
});
readers.push(clusterInstance);
if (clusterInstance.tier < 2) {
this.validateReaderInstance(writer, clusterInstance);
}
instanceEndpoints.push(new Endpoint(clusterInstance.dbInstanceEndpointAddress, this.clusterEndpoint.port));
instanceIdentifiers.push(clusterInstance.instanceIdentifier);
});
this.validateClusterInstances(writer, readers);

Only reader endpoints are returned and writer's is missing.

@pahud pahud added p1 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Feb 27, 2024
@mergify mergify bot closed this as completed in #29337 Mar 8, 2024
@mergify mergify bot closed this as completed in ca59616 Mar 8, 2024
Copy link

github-actions bot commented Mar 8, 2024

⚠️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.

1 similar comment
Copy link

github-actions bot commented Mar 8, 2024

⚠️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/medium Medium work item – several days of effort p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants