Skip to content

Cannot set Aurora PostgreSQL Serverless v2 to 0 min capacity

0

engine_version = "15.12"

Installed hashicorp/aws v5.70.0

"seconds_until_auto_pause" = 600

When setting min capacity for serverlessv2 clusters I get the below error message for some clusters, others have worked correctly. I am running on a compliant Postgres and AWS provider version.

Error: expected serverlessv2_scaling_configuration.0.min_capacity to be in the range (0.500000 - 128.000000), got 0.000000

3 Answers
2
Accepted Answer

Hello.

In "aws v5.70.0", the minimum allowed value for min_capacity is 1 or greater.
Perhaps updating your Terraform AWS provider will solve the problem.
https://registry.terraform.io/providers/hashicorp/aws/5.70.0/docs/resources/rds_cluster

min_capacity - (Optional) Minimum capacity for an Aurora DB cluster in serverless DB engine mode. The minimum capacity must be lesser than or equal to the maximum capacity. Valid Aurora MySQL capacity values are 1, 2, 4, 8, 16, 32, 64, 128, 256. Valid Aurora PostgreSQL capacity values are (2, 4, 8, 16, 32, 64, 192, and 384). Defaults to 1.

By the way, if it is "6.36.0", 0 is allowed as stated in the following document.
https://registry.terraform.io/providers/hashicorp/aws/6.36.0/docs/resources/rds_cluster

min_capacity - (Required) Minimum capacity for an Aurora DB cluster in provisioned DB engine mode. The minimum capacity must be lesser than or equal to the maximum capacity. Valid capacity values are in a range of 0 up to 256 in steps of 0.5.

EXPERT
answered 2 months ago
1

This error occurs because you are using an AWS Provider version that predates the release of the "Scale to Zero" feature for Aurora Serverless v2.

AWS introduced the ability to scale to 0 ACUs in November 2024. The validation logic in your current provider version (v5.70.0) still enforces the legacy minimum limit of 0.5.

Recommended Solution

To resolve the validation error, you must upgrade your Hashicorp AWS Provider to v5.81.0 or later, which updated the schema to allow a 0 value for min_capacity.

  1. Update your configuration:
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.81" 
    }
  }
}
  1. Initialize the update: Run terraform init -upgrade in your terminal.

Additional Requirements for Scaling to Zero

Once the provider is updated, ensure your clusters meet these mandatory AWS requirements:

  • Engine Version: For PostgreSQL, you must be on version 13.16, 14.13, 15.8, 16.4, or higher. While your version 15.12 is compatible, ensure any other clusters you are modifying also meet these minimums.
  • Auto-Pause Configuration: When min_capacity is set to 0, the seconds_until_auto_pause attribute is required. Conversely, if min_capacity is 0.5 or greater, this attribute must be removed or it will trigger an API error.
  • Max Capacity: Even when scaling to zero, the max_capacity must be at least 1.0 ACU.

Why some clusters worked: The clusters that "worked" likely had their min_capacity set to 0.5 or were previously managed outside of this specific Terraform workspace. Any cluster explicitly defined with min_capacity = 0 will continue to fail until the provider is upgraded to recognize 0 as a valid input.

answered 2 months ago
-2

The error you're encountering is expected behavior. The ability to set MinCapacity to 0 for Aurora Serverless v2 is only available for Aurora versions that support the Aurora Serverless v2 auto-pause feature.

For Aurora PostgreSQL engine version 15.12, the auto-pause feature may not be supported, which is why you're seeing the validation error requiring a minimum value of 0.5 ACUs instead of 0.

The minimum capacity requirements are:

  • 0 ACUs: Only for Aurora versions that support the Aurora Serverless v2 auto-pause feature
  • 0.5 ACUs: For versions that don't support Aurora Serverless v2 auto-pause (which appears to be your case)

The reason some of your clusters work correctly while others don't is likely due to differences in the specific Aurora engine versions being used across those clusters. Even minor version differences can affect feature availability.

To resolve this issue, you should set your min_capacity to 0.5 instead of 0 for Aurora PostgreSQL 15.12. You can verify whether your specific engine version supports the auto-pause feature by checking the attributes of your engine version or platform version to determine which features are supported.
Sources
ServerlessV2ScalingConfiguration - Amazon Relational Database Service
create_db_cluster - botocore 1.42.51 documentation
create_db_cluster - Boto3 1.42.51 documentation
modify_db_cluster - botocore 1.42.51 documentation

answered 2 months ago
EXPERT
reviewed 2 months ago
  • We are running on 15.12, support became available in 15.7

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.