Sets up a custom Oracle RDS instance with specific configurations and a replica instance.

Terraform Template

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

data "aws_rds_orderable_db_instance" "custom-oracle" {
  engine = "custom-oracle-ee"
  engine_version = "19.c.ee.002"
  license_model = "bring-your-own-license"
  preferred_instance_classes = ["db.r5.xlarge", "db.r5.2xlarge", "db.r5.4xlarge"]
  storage_type = "gp3"
}

resource "aws_db_instance" "default" {
  allocated_storage = 50
  auto_minor_version_upgrade = false
  backup_retention_period = 7
  custom_iam_instance_profile = "AWSRDSCustomInstanceProfile"
  db_subnet_group_name = "local.db_subnet_group_name"
  engine = data.aws_rds_orderable_db_instance.custom-oracle.engine
  engine_version = data.aws_rds_orderable_db_instance.custom-oracle.engine_version
  identifier = "ee-instance-demo"
  instance_class = data.aws_rds_orderable_db_instance.custom-oracle.instance_class
  kms_key_id = data.aws_kms_key.by_id.arn
  license_model = data.aws_rds_orderable_db_instance.custom-oracle.license_model
  multi_az = false
  password = "avoid-plaintext-passwords"
  storage_encrypted = true
  username = "test"
}

resource "aws_db_instance" "test-replica" {
  auto_minor_version_upgrade = false
  backup_retention_period = 7
  custom_iam_instance_profile = "AWSRDSCustomInstanceProfile"
  identifier = "ee-instance-replica"
  instance_class = data.aws_rds_orderable_db_instance.custom-oracle.instance_class
  kms_key_id = data.aws_kms_key.by_id.arn
  multi_az = false
  replica_mode = "mounted"
  replicate_source_db = aws_db_instance.default.identifier
  skip_final_snapshot = true
  storage_encrypted = true
}