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] rds module not able to add proxy #9195

Closed
I2olanD opened this issue Jul 21, 2020 · 8 comments · Fixed by #10488
Closed

[aws-cdk] rds module not able to add proxy #9195

I2olanD opened this issue Jul 21, 2020 · 8 comments · Fixed by #10488
Assignees
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 in-progress This issue is being actively worked on. p1
Milestone

Comments

@I2olanD
Copy link

I2olanD commented Jul 21, 2020

Hey,
i'm currently trying to add a RDS proxy to my db cluster. Apparently, i get following error:
Cannot read property 'engine' of undefined.

Reproduction Steps

		const vpc = ec2.Vpc.fromLookup(myScope, 'someId', { 
			vpcId: 'vpc-id'
		});

		const securityGroup = ec2.SecurityGroup.fromSecurityGroupId(myScope, 
			'someId', 
			'securit-group-id'
		);

		const cluster = DatabaseCluster.fromDatabaseClusterAttributes(myScope, 'someId', {
			port,
			securityGroups: [securityGroup],
			clusterIdentifier: 'cluster-identifier',
			instanceIdentifiers: ['instance-identifier'],
			clusterEndpointAddress: ''writer-endpoint,
			readerEndpointAddress: 'reader-endpoint',
			instanceEndpointAddresses: ['instance endpoint']
		});

		const secret = new Secret(myScope, 'Secret');

		cluster.addProxy('testProxy', {
			borrowTimeout: cdk.Duration.seconds(30),
			maxConnectionsPercent: 50,
			secrets: [secret],
			vpc
		});

Error Log

Cannot read property 'engine' of undefined.

Environment

  • **CLI Version :1.53.0
  • **Framework Version: 1.53.0
  • **Node.js Version: 10.19.0
  • OS :
  • **Language (Version): all

This is 🐛 Bug Report

@I2olanD I2olanD added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 21, 2020
@skinny85 skinny85 self-assigned this Jul 21, 2020
@skinny85 skinny85 added @aws-cdk/aws-rds Related to Amazon Relational Database effort/medium Medium work item – several days of effort p1 and removed needs-triage This issue or PR still needs to be triaged. labels Jul 21, 2020
@civilizeddev
Copy link
Contributor

Sorry, currently not available

DatabaseCluster.fromDatabaseClusterAttributes returns IDatabaseCluster, which doesn't have engine in it.

There's no way to read engine from imported RDS instance/cluster resource at the moment.

Its' unstable that it currently rely on (this.dbCluster.node.defaultChild as CfnDBCluster).engine.

if (this.dbCluster && this.dbInstance) {
throw new Error('Proxy cannot target both database cluster and database instance.');
} else if (this.dbCluster) {
engine = (this.dbCluster.node.defaultChild as CfnDBCluster).engine;
} else if (this.dbInstance) {
engine = (this.dbInstance.node.defaultChild as CfnDBInstance).engine;
}

Ideas and suggestions are welcome.

@I2olanD
Copy link
Author

I2olanD commented Jul 22, 2020

Would it be possible to add the engine property to the IDatabaseCluster?

@I2olanD
Copy link
Author

I2olanD commented Sep 16, 2020

Any updates on this @civilizeddev ?

Best,

Roland

skinny85 added a commit to skinny85/aws-cdk that referenced this issue Sep 23, 2020
The current ProxyTarget relied on the underlying L1s to get the engine type
for a given Cluster/Instance.
Change IDatabaseCluster and IInstanceEngine to add an (optional)
`engine` property that is used instead.
Allow the user to specify the engine when importing a Cluster or Instance.

Also move the logic of determining the engine family into IEngine.

Fixes aws#9195
@SomayaB SomayaB added the in-progress This issue is being actively worked on. label Sep 23, 2020
@civilizeddev
Copy link
Contributor

@I2olanD I'm sorry for late response.

As for this issue, @skinny85 suggested a better solution.

@mergify mergify bot closed this as completed in #10488 Sep 23, 2020
mergify bot pushed a commit that referenced this issue Sep 23, 2020
The current ProxyTarget relied on the underlying L1s to get the engine type
for a given Cluster/Instance.
Change IDatabaseCluster and IInstanceEngine to add an (optional)
`engine` property that is used instead.
Allow the user to specify the engine when importing a Cluster or Instance.

Also move the logic of determining the engine family into `IEngine`.

Fixes #9195

----

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

I2olanD commented Oct 29, 2020

hey @civilizeddev, @skinny85

figured it out :) TY!

@tvb
Copy link

tvb commented Feb 1, 2023

@I2olanD care to elaborate how?

@aws-apradana
Copy link

Any solution for this? Im impacted with the same issue as well

@I2olanD
Copy link
Author

I2olanD commented May 23, 2023

hey @tvb, sorry for the super late response. I don't have access to that codebase anymore but if i remember correctly, we created a new cluster via "DatabaseClusterFromSnapshot" and added the proxy to that.

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 in-progress This issue is being actively worked on. p1
Projects
None yet
6 participants