Using Serverless PostgreSQL with Spacelift v3 Deployment
Last updated: September 15, 2025
When deploying Spacelift v3, you can configure PostgreSQL to use serverless scaling capabilities for better resource management and cost optimization.
Serverless vs Provisioned PostgreSQL
Serverless PostgreSQL provides automatic scaling based on demand, allowing your database to scale up and down as needed. This is particularly useful for environments with variable workloads, as you only pay for the resources you actually use.
Configuration
To configure serverless PostgreSQL with Spacelift v3, use the following configuration:
rds_engine_mode = "provisioned"
rds_instance_configuration = {
"primary" = {
instance_identifier = "primary"
instance_class = "db.serverless"
}
}
rds_serverlessv2_scaling_configuration = {
min_capacity = 0.5
max_capacity = 5.0
}Note: Do not use rds_engine_mode = "serverless" as this may result in an "InvalidParameterValue: The engine mode serverless you requested is currently unavailable" error.
Scaling Configuration
The serverless scaling is controlled by the rds_serverlessv2_scaling_configuration block:
min_capacity: The minimum number of Aurora Capacity Units (ACUs) for the cluster
max_capacity: The maximum number of Aurora Capacity Units (ACUs) for the cluster
The database will automatically scale between these limits based on workload demand. There is no separate db_instance_size parameter needed, as scaling is purely based on the capacity configuration.
Benefits
This configuration provides several advantages:
Automatic scaling based on actual usage
Cost optimization by scaling down during low-demand periods
Same configuration can be used across different environments (staging and production)
No manual intervention required for capacity management