aurora-postgresql and supports PostgreSQL-compatible versions.
Complete example
The following is the full working example fromexamples/postgresql/. It creates a three-instance cluster with Aurora I/O Optimized storage, cluster-level enhanced monitoring, per-instance overrides, custom endpoints, a cluster parameter group, a DB parameter group, PostgreSQL log exports, and a KMS-encrypted activity stream.
Instance configuration
Each key in theinstances map creates one aws_rds_cluster_instance. The cluster_instance_class sets the default class; individual instances can override it and set other per-instance attributes.
Homogeneous cluster — every instance uses the same class:
promotion_tier = 15 on instances you want to exclude from failover promotion. Combined with custom endpoints, this lets you route specific workloads to specific readers.
Custom endpoints
Theendpoints map creates additional aws_rds_cluster_endpoint resources. Each endpoint can target a static list of members or exclude specific members.
Key PostgreSQL-specific variables
| Variable | Type | Description |
|---|---|---|
engine | string | Must be "aurora-postgresql" |
engine_version | string | PostgreSQL-compatible version, e.g. "17.5" |
storage_type | string | "aurora" (default) or "aurora-iopt1" for I/O Optimized |
cluster_monitoring_interval | number | Cluster-level enhanced monitoring interval in seconds. Valid values: 0, 1, 5, 10, 15, 30, 60 |
enabled_cloudwatch_logs_exports | list(string) | Use ["postgresql"] for the PostgreSQL log |
engine_lifecycle_support | string | Set to "open-source-rds-extended-support-disabled" to opt out of extended support charges |
cluster_parameter_group | object | Inline cluster parameter group. Use family aurora-postgresql17 for PostgreSQL 17. |
db_parameter_group | object | Inline DB instance parameter group |
endpoints | map(object) | Additional custom cluster endpoints |
PostgreSQL log exports
Aurora PostgreSQL exports a single log type:postgresql. Enable it and let the module manage the CloudWatch log group:
cloudwatch_log_group_retention_in_days (default: 7).
Deployment workflow
Prepare networking
Create a VPC with private subnets and a database subnet group spanning at least two availability zones. The module creates a security group automatically when
create_security_group = true (the default); provide security_group_ingress_rules to allow inbound traffic on the PostgreSQL port (5432).Choose a storage type
For read/write-heavy workloads with unpredictable I/O, set
storage_type = "aurora-iopt1" to use Aurora I/O Optimized storage. For standard workloads, omit this variable or set it to "aurora".Define instances
Add at least one entry to
instances. The first instance Terraform provisions becomes the writer. Use promotion_tier to control failover order and db_parameter_group_name for per-instance parameter tuning.Configure parameter groups
Use
cluster_parameter_group and db_parameter_group to manage parameter groups inline. Match the family to your engine version — aurora-postgresql17 for PostgreSQL 17.
