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

RDS: "DBCluster not found" if deletionProtection changes #25988

Closed
ctapobep opened this issue Jun 15, 2023 · 5 comments
Closed

RDS: "DBCluster not found" if deletionProtection changes #25988

ctapobep opened this issue Jun 15, 2023 · 5 comments
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. effort/small Small work item – less than a day of effort p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@ctapobep
Copy link

ctapobep commented Jun 15, 2023

Describe the bug

I was getting a very strange error DBCluster not found, even though all the IDs were matching and all. Spent quite a lot of time figuring out that the reason was that deletionProtection changed from false to true. Here's output of cdk diff

Expected Behavior

The DB Cluster is updated to the new deletionProtection. Or at least the error explicitly says that the new settings can't be applied.

Current Behavior

Cryptic "DBCluster not found" error when doing cdk deploy

Reproduction Steps

  1. Write a CDK cluster with deletionProtection: true. Example:
        new ServerlessCluster(scope, scope.stackName + "-DB", {
            // DB to connect to when admin user creates the rest of databases. We won't store data in this
            // database though, it's needed only for the initial connection. There could be multiple databases
            // we want to create for different apps & purposes.
            defaultDatabaseName: 'postgres',
            engine: DatabaseClusterEngine.AURORA_POSTGRESQL,
            vpc: networkInfo.vpc,
            vpcSubnets: ...,
            securityGroups: [sg],
            parameterGroup: ParameterGroup.fromParameterGroupName(scope,
                'ParameterGroup',
                'default.aurora-postgresql10'
            ),
            scaling: {
                autoPause: Duration.hours(2), // never pause in PRD, it takes half a min to wake up!
                minCapacity: 2, maxCapacity: 2
            },
            enableDataApi: true, // to be able to run queries from Query Editor in AWS Console
            deletionProtection: true,
            removalPolicy: RemovalPolicy.RETAIN
        });```
2. After it's created, change `deletionProtection` to `false`

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.82.0

### Framework Version

_No response_

### Node.js Version

v18.16.0

### OS

MacOS

### Language

Typescript

### Language Version

_No response_

### Other information

_No response_
@ctapobep ctapobep added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 15, 2023
@github-actions github-actions bot added the @aws-cdk/aws-rds Related to Amazon Relational Database label Jun 15, 2023
@peterwoodworth
Copy link
Contributor

What's your cdk diff output?

@peterwoodworth peterwoodworth added p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. 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 Jun 15, 2023
@github-actions
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 the closing-soon This issue will automatically close in 4 days unless further comments are made. label Jun 17, 2023
@ctapobep
Copy link
Author

ctapobep commented Jun 19, 2023

I've added cdk diff output to the original post. I can't reproduce the issue outside of that particular stack. What I just noticed is that my DB is called vtlb3-vtlbdbf5332276-4uuqn6ztsud7. I don't know where that 3 came from since the stack name is called VTLB. But my hunch is that this 3 is the culprit. The ID that I give to the cluster in my code is "VTLB-DB". So maybe I just deleted the cluster 🤷

Would be helpful if CloudFormation say which physical ID it was looking for - that would've pointed me in the right direction right away.

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Jun 19, 2023
@peterwoodworth
Copy link
Contributor

Yeah it's probably not an issue with deletion protection, but some weirdness with names coming from somewhere. If you find a way to reproduce that, let us know. Otherwise, I'm not sure there's much we can help with here.

@peterwoodworth peterwoodworth added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jun 23, 2023
@github-actions
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 Jun 26, 2023
@github-actions github-actions bot closed this as completed Jul 1, 2023
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. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/small Small work item – less than a day of effort 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

2 participants