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: RDS construct cannot create Aurora serverless in Isolated VPC #30827

Closed
zmgehlke opened this issue Jul 11, 2024 · 5 comments
Closed
Assignees
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@zmgehlke
Copy link

Describe the bug

I create a VPC using the CDK with isolated networks.

this.vpc = new cdk.aws_ec2.Vpc(this, 'vpc', {
            ipAddresses: cdk.aws_ec2.IpAddresses.cidr('10.0.0.0/16'),
            createInternetGateway: false,
            subnetConfiguration: [
                {
                    name: 'isolated',
                    subnetType: cdk.aws_ec2.SubnetType.PRIVATE_ISOLATED,
                    cidrMask: 24,
                }
            ]
        })

I then create a subnet group:

        const subnetGroup = new cdk.aws_rds.SubnetGroup(this, 'subnets', {
            description: 'ledger-isolated',
            subnetGroupName: 'ledger-isolated',
            removalPolicy: cdk.RemovalPolicy.DESTROY,

            vpc: props.vpc,
            vpcSubnets: {
                subnets: props.vpc.isolatedSubnets
            },
        })

I then create an RDS cluster:

        this.table = new cdk.aws_rds.DatabaseCluster(this, 'ledger', {
            engine: cdk.aws_rds.DatabaseClusterEngine.auroraPostgres({version: cdk.aws_rds.AuroraPostgresEngineVersion.VER_16_2}),
            deletionProtection: false, // TODO: Enable for production.
            
            serverlessV2MaxCapacity: 2,
            serverlessV2MinCapacity: 0.5,
            vpcSubnets: subnetGroup,

            writer: cdk.aws_rds.ClusterInstance.serverlessV2('writer'),
            readers: [
                cdk.aws_rds.ClusterInstance.serverlessV2('reader')
            ]
        });

I get the following error:

Error: Provide either vpc or instanceProps.vpc, but not both
    at new DatabaseClusterNew [...]
    at new DatabaseCluster [...]

I have tried numerous options on the subnet group and other definitions; no combination of features appears to work.

Expected Behavior

Create RDS serverless cluster in isolated VPC.

Current Behavior

Inscrutable error about defining VPC settings.

Reproduction Steps

See above.

Possible Solution

No response

Additional Information/Context

I'm deeply frustrated that the CDK decided to become "smart" by automating so many important features -- because you took a good product and made it impossible to use, due to the continually malfunctioning automation. RDS wasn't previously impossible to set up, due to the CDK breaking when small customizations were made.

CDK CLI Version

2.148.0

Framework Version

No response

Node.js Version

20.15.1

OS

Ubuntu 22.04

Language

TypeScript

Language Version

No response

Other information

No response

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

khushail commented Jul 12, 2024

Hey @zmgehlke , thanks for reaching out. Looks like you faced this issue in the latest version.Could you please mention in which CDK version you found it to be correctly working ?

@khushail khushail added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Jul 12, 2024
@khushail khushail self-assigned this Jul 12, 2024
@zmgehlke
Copy link
Author

Hi @khushail -- I appreciate your effort investigating this issue, but unfortunately it's been a few years since I've used the RDS construct (since circa 2022) and I no longer know which specific version I was using.

I'm not actually convinced that I'm reporting the correct error, eg if I switch the definition:

    serverlessV2MaxCapacity: 2,
    serverlessV2MinCapacity: 0.5,
    vpc: props.vpc,
    vpcSubnets: subnetGroup,

...then I get a new error where it apparently cannot find the correct subnet entities. My larger complaint is that no variety of options appears to work in even this relatively basic case to accomplish a relatively simple goal -- deploying severless RDS into a VPC.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jul 14, 2024
@khushail khushail added p1 investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Jul 16, 2024
@khushail
Copy link
Contributor

khushail commented Jul 16, 2024

Hi @zmgehlke , Looks like your issue is quite similar to this one - #29256

The sample code shared here might be what you are looking for- #29256 (comment)

 const cluster = new rds.DatabaseCluster(this, 'Database', {
          engine: rds.DatabaseClusterEngine.auroraMysql({
            version: rds.AuroraMysqlEngineVersion.VER_3_05_2,
          }),
          storageEncrypted: true,
          vpcSubnets: {
            subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
          },
          writer: rds.ClusterInstance.provisioned('instance1', {
            instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.LARGE),
            publiclyAccessible: false,
          }),
          readers: [rds.ClusterInstance.provisioned('instance2', {
            instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.LARGE),
            publiclyAccessible: false,
          })],
          vpc,
        });

Let me know if it works for you

@khushail khushail added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. p2 and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. p1 labels Jul 16, 2024
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Jul 19, 2024
@aws-cdk-automation
Copy link
Collaborator

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.

@aws aws locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

3 participants