Defines a Serverless v2 RDS cluster using Aurora PostgreSQL with scaling configurations and an associated cluster instance.

Terraform Template

resource "aws_rds_cluster" "example" {
  cluster_identifier = "example"
  database_name = "test"
  engine = "aurora-postgresql"
  engine_mode = "provisioned"
  engine_version = "13.6"
  master_password = "must_be_eight_characters"
  master_username = "test"

  serverlessv2_scaling_configuration {
    max_capacity = 1
    min_capacity = 0.5
  }
  storage_encrypted = true
}

resource "aws_rds_cluster_instance" "example" {
  cluster_identifier = aws_rds_cluster.example.id
  engine = aws_rds_cluster.example.engine
  engine_version = aws_rds_cluster.example.engine_version
  instance_class = "db.serverless"
}