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: Cannot set ServerlessCluster minCapacity to 0.5 ACU #30309

Closed
zmillman opened this issue May 22, 2024 · 6 comments · Fixed by #30316
Closed

RDS: Cannot set ServerlessCluster minCapacity to 0.5 ACU #30309

zmillman opened this issue May 22, 2024 · 6 comments · Fixed by #30316
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Comments

@zmillman
Copy link

Describe the bug

The Aurora Serverless v2 docs say that you can set capacity to 0.5 ACUs:

The smallest Aurora Serverless v2 capacity that you can define is 0.5 ACUs. You can specify a higher number if it's less than or equal to the maximum capacity value. Setting the minimum capacity to a small number lets lightly loaded DB clusters consume minimal compute resources. At the same time, they stay ready to accept connections immediately and scale up when they become busy.

However, this can't be configured using the CDK node library (I'm using 2.140.0) because AuroraCapacityUnit is hardcoded to a fixed set of powers of 2 in aws-rds/lib/serverless-cluster.ts

Expected Behavior

I expected to be able to set minCapacity to 0.5

Current Behavior

Screenshot 2024-05-22 at 11 02 26 AM

Reproduction Steps

With aws-cdk-lib@2.140.0:

import {
  AuroraCapacityUnit,
  AuroraPostgresEngineVersion,
  DatabaseClusterEngine,
  ServerlessCluster,
} from "aws-cdk-lib/aws-rds";
import { Construct } from "constructs";

export class DB extends Construct {
  constructor(scope: Construct, id: string) {
    super(scope, id);

    new ServerlessCluster(this, "Database", {
      engine: DatabaseClusterEngine.auroraPostgres({
        version: AuroraPostgresEngineVersion.VER_13_12,
      }),
      scaling: {
        minCapacity: 0.5,
        maxCapacity: AuroraCapacityUnit.ACU_4,
      },
    });
  }
}

Possible Solution

Provide ACU_0_5 = 0.5 as an option for AuroraCapacityUnit

Additional Information/Context

No response

CDK CLI Version

2.140.0

Framework Version

No response

Node.js Version

v20.10.0

OS

MacOs

Language

TypeScript

Language Version

5.4.5

Other information

No response

@zmillman zmillman added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 22, 2024
@github-actions github-actions bot added the @aws-cdk/aws-rds Related to Amazon Relational Database label May 22, 2024
@khushail khushail added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels May 22, 2024
@khushail khushail self-assigned this May 22, 2024
@khushail
Copy link
Contributor

Hi @zmillman , thanks for reporting this. I see that in the docs its mentioned one can give minCapacity as 0.5

Screenshot 2024-05-22 at 12 17 29 PM

but in the actual code, these are the authorized values -

export enum AuroraCapacityUnit {

I reproduced the error with given code and it shows error while mentioning the value as 0.5.

@khushail khushail added p2 effort/small Small work item – less than a day of effort and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels May 22, 2024
@khushail khushail removed their assignment May 22, 2024
@mazyu36
Copy link
Contributor

mazyu36 commented May 22, 2024

Hi.

Using the ServerlessCluster class indicates that you are trying to use Serveless v1, is that correct?

If so, I think it is expected behavior that you cannot set the ACU to 0.5, as this is not supported in CloudFormation either.

If you want to use ServerlessV2, you should use the DatabaseCluster class instead. For this class, the ACU option is a number, so setting it to 0.5 would be possible.

@zmillman
Copy link
Author

Oh! Switching to DatabaseCluster works for me.

I assumed that ServerlessCluster would start up a v2 cluster instead of a v1 cluster (there's nothing on that page to indicate which version it creates)

Perhaps someone could update the library docs so it's clearer that ServerlessCluster configures a v1 and DatabaseCluster handles v2?

@mazyu36
Copy link
Contributor

mazyu36 commented May 23, 2024

I also had the same misunderstanding before. 😅
I agree it is unclear, so I submitted a PR to improve the documentation.

mergify bot pushed a commit that referenced this issue May 24, 2024
### Issue # (if applicable)

Closes #30309.

### Reason for this change
The rds.ServerlessCluster is for Serverless v1, but this is not explicitly stated in the documentation, which could be misleading as it may imply that it is for Serverless v2.



### Description of changes
Added to the README and TSdocs that rds.ServerlessCluster is for v1 of Aurora Serverless



### Description of how you validated changes
Do nothing because only documentation improvements


### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@mergify mergify bot closed this as completed in #30316 May 24, 2024
Copy link

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

atanaspam pushed a commit to atanaspam/aws-cdk that referenced this issue Jun 3, 2024
### Issue # (if applicable)

Closes aws#30309.

### Reason for this change
The rds.ServerlessCluster is for Serverless v1, but this is not explicitly stated in the documentation, which could be misleading as it may imply that it is for Serverless v2.



### Description of changes
Added to the README and TSdocs that rds.ServerlessCluster is for v1 of Aurora Serverless



### Description of how you validated changes
Do nothing because only documentation improvements


### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
vdahlberg pushed a commit to vdahlberg/aws-cdk that referenced this issue Jun 10, 2024
### Issue # (if applicable)

Closes aws#30309.

### Reason for this change
The rds.ServerlessCluster is for Serverless v1, but this is not explicitly stated in the documentation, which could be misleading as it may imply that it is for Serverless v2.



### Description of changes
Added to the README and TSdocs that rds.ServerlessCluster is for v1 of Aurora Serverless



### Description of how you validated changes
Do nothing because only documentation improvements


### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@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. effort/small Small work item – less than a day of effort p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants