Configures a custom SQL Server RDS instance with specified storage, engine, and instance class.

Terraform Template

data "aws_kms_key" "by_id" {
  key_id = "example-ef278353ceba4a5a97de6784565b9f78"
}

data "aws_rds_orderable_db_instance" "custom-sqlserver" {
  engine = "custom-sqlserver-se"
  engine_version = "15.00.4249.2.v1"
  preferred_instance_classes = ["db.r5.xlarge", "db.r5.2xlarge", "db.r5.4xlarge"]
  storage_type = "gp3"
}

resource "aws_db_instance" "example" {
  allocated_storage = 500
  auto_minor_version_upgrade = false
  backup_retention_period = 7
  custom_iam_instance_profile = "AWSRDSCustomSQLServerInstanceProfile"
  db_subnet_group_name = "local.db_subnet_group_name"
  engine = data.aws_rds_orderable_db_instance.custom-sqlserver.engine
  engine_version = data.aws_rds_orderable_db_instance.custom-sqlserver.engine_version
  identifier = "sql-instance-demo"
  instance_class = data.aws_rds_orderable_db_instance.custom-sqlserver.instance_class
  kms_key_id = data.aws_kms_key.by_id.arn
  multi_az = false
  password = "avoid-plaintext-passwords"
  storage_encrypted = true
  username = "test"
}