Aws-cdk: [aws-cdk] rds module not able to add proxy

Created on 21 Jul 2020  路  5Comments  路  Source: aws/aws-cdk

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: Bug Report

@aws-cdaws-rds bug efformedium in-progress p1

Most helpful comment

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.

https://github.com/aws/aws-cdk/blob/489eae64f6613cac85da2a70b33435052901255b/packages/%40aws-cdk/aws-rds/lib/proxy.ts#L69-L75

Ideas and suggestions are welcome.

All 5 comments

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.

https://github.com/aws/aws-cdk/blob/489eae64f6613cac85da2a70b33435052901255b/packages/%40aws-cdk/aws-rds/lib/proxy.ts#L69-L75

Ideas and suggestions are welcome.

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

Any updates on this @civilizeddev ?

Best,

Roland

@I2olanD I'm sorry for late response.

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

hey @civilizeddev, @skinny85

figured it out :) TY!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kawamoto picture kawamoto  路  3Comments

abelmokadem picture abelmokadem  路  3Comments

peterdeme picture peterdeme  路  3Comments

Kent1 picture Kent1  路  3Comments

artyom-melnikov picture artyom-melnikov  路  3Comments