CloudPosse RDS Cluster AWS Terraform Module

The CloudPosse RDS Cluster AWS Terraform module provides a reusable, opinionated way to provision Amazon Aurora clusters with consistent naming, tagging, networking, and operational guardrails. The module automates creation of the database cluster, parameter group, subnet group, instances, and related supporting resources so teams can deploy Aurora MySQL and Aurora PostgreSQL environments with repeatable configuration. A companion module, cloudposse rds-cluster-instance-group aws, extends the pattern to provision an RDS cluster instance pool with a dedicated endpoint for reader scaling and reporting workloads.

This article covers the core module capabilities, resource footprint, configuration surface, and practical usage patterns drawn from the module documentation and examples.

Overview

The cloudposse rds-cluster aws module provisions an RDS Aurora cluster supporting either MySQL or PostgreSQL databases. It automates deployment and configuration of the cluster, including creation of the database instance, parameter group, and subnet group. The module allows customization of various parameters such as database engine, instance type, and storage settings to meet specific requirements. It also provides options for enabling automated backups, setting backup retention period, and configuring cluster network settings.

Highlights include support for both MySQL and PostgreSQL database engines for the Aurora cluster, customization of various parameters including instance type, storage settings, and backup configurations, automation of creation of database instance, parameter group, and subnet group, options for enabling automated backups and setting backup retention period, and configuration of cluster network settings such as VPC and subnet assignments.

The module is designed for production use with Cloud Posse conventions for naming and labeling, and it recommends pinning to a specific version.

Core Capabilities

The module handles cluster lifecycle with minimal manual steps. Users declare the desired engine, engine mode, cluster family, size, and network placement and the module builds the underlying AWS resources.

Engine support covers Aurora MySQL and Aurora PostgreSQL. Engine mode can be standard or serverless. Serverless mode allows Aurora Serverless deployment with auto pause and capacity scaling.

Cluster sizing is expressed via clustersize, where one writer instance is always present and additional units are readers. Example configurations show 1 writer, 1 reader with clustersize = 2, 1 writer, 3 reader with clustersize = 4, and 1 writer, 5 reader with clustersize = 6.

Network configuration is driven by vpcid, securitygroups, and subnets. The module creates an awsdbsubnet_group.default to place instances in the supplied subnets. Security groups are created and rules are managed for ingress cidr blocks, ingress security groups, egress, egress ipv6, and traffic inside security group.

Backup configuration includes automated backups and backup retention period settings. Storage settings and instance type are user controlled.

Parameter group management is automated via awsdbparametergroup.default and awsrdsclusterparameter_group.default. The module also creates a parameter group for cluster level settings.

Monitoring and operations features include support for enhanced monitoring via awsiamrole.enhancedmonitoring and awsiamrolepolicyattachment.enhancedmonitoring. App autoscaling for replicas is provided via awsappautoscalingpolicy.replicas and awsappautoscalingtarget.replicas.

Reserved capacity can be provisioned with awsrdsreserved_instance.default.

Architecture and Resources

The module creates a set of AWS resources that together form a managed Aurora cluster.

Resources used by the module include:

Resource
awsappautoscalingpolicy.replicas
awsappautoscalingtarget.replicas
awsdbparameter_group.default
awsdbsubnet_group.default
awsiamrole.enhanced_monitoring
awsiamrolepolicyattachment.enhanced_monitoring
awsrdscluster.primary
awsrdscluster.secondary
awsrdsclusteractivitystream.primary
awsrdscluster_instance.default
awsrdsclusterparametergroup.default
awsrdsreserved_instance.default
awssecuritygroup.default
awssecuritygroup_rule.egress
awssecuritygrouprule.egressipv6
awssecuritygrouprule.ingresscidr_blocks
awssecuritygrouprule.ingressipv6cidrblocks
awssecuritygrouprule.ingresssecurity_groups
awssecuritygrouprule.trafficinsidesecuritygroup
random_pet.instance

Data sources used by the module include supporting lookups for labeling and networking.

The module depends on CloudPosse label utilities. The dependency table shows dnsreplicas 0.13.0 cloudposse/route53-cluster-hostname/aws, enhancedmonitoringlabel 0.25.0 cloudposse/label/null, rdsidentifier 0.25.0 cloudposse/label/null, this 0.25.0 cloudposse/label/null.

Configuration Options

Configuration is expressed through Terraform inputs that map to Aurora cluster properties.

Typical inputs include:

  • name
  • namespace
  • stage
  • engine
  • engine_mode
  • cluster_family
  • cluster_size
  • admin_user
  • admin_password
  • db_name
  • db_port
  • instance_type
  • vpc_id
  • security_groups
  • subnets
  • zone_id
  • enablehttpendpoint
  • scaling_configuration

For Aurora PostgreSQL the example uses:

```
module "rdsclusteraurora_postgres" {
source = "cloudposse/rds-cluster/aws"

Cloud Posse recommends pinning every module to a specific version

version = "x.x.x"

name = "postgres"
engine = "aurora-postgresql"
cluster_family = "aurora-postgresql9.6"

1 writer, 1 reader

cluster_size = 2

1 writer, 3 reader

cluster_size = 4

1 writer, 5 reader

cluster_size = 6

namespace = "eg"
stage = "dev"
adminuser = "admin1"
admin
password = "Test123456789"
dbname = "dbname"
db
port = 5432
instancetype = "db.r4.large"
vpc
id = "vpc-xxxxxxxx"
securitygroups = ["sg-xxxxxxxx"]
subnets = ["subnet-xxxxxxxx", "subnet-xxxxxxxx"]
zone
id = "Zxxxxxxxx"
}
```

For Aurora MySQL Serverless the example shows:

```
module "rdsclusterauroramysqlserverless" {
source = "cloudposse/rds-cluster/aws"

Cloud Posse recommends pinning every module to a specific version

version = "x.x.x"

namespace = "eg"
stage = "dev"
name = "db"
engine = "aurora"
enginemode = "serverless"
cluster
family = "aurora5.6"
clustersize = 0
admin
user = "admin1"
adminpassword = "Test123456789"
db
name = "dbname"
dbport = 3306
instance
type = "db.t2.small"
vpcid = "vpc-xxxxxxxx"
security
groups = ["sg-xxxxxxxx"]
subnets = ["subnet-xxxxxxxx", "subnet-xxxxxxxx"]
zoneid = "Zxxxxxxxx"
enable
httpendpoint = true
scaling
configuration = [
{
autopause = true
max
capacity = 256
min_capacity =
```

The scaling_configuration block configures auto pause and capacity bounds for serverless.

RDS Cluster Instance Group Module

The companion module cloudposse rds-cluster-instance-group aws is an open source Terraform module that provisions an RDS cluster instance pool with a dedicated endpoint. This module simplifies setup of a scalable and highly available RDS environment, allowing users to easily manage a cluster of RDS instances. The module handles creation of the RDS cluster, including primary instance and reader instances, as well as setup of a dedicated endpoint for accessing the cluster.

Highlights are:

  • Provisions an RDS cluster instance pool with a dedicated endpoint
  • Manages creation of the RDS cluster, including primary instance and reader instances
  • Supports customization of instance types, storage settings, and backup policies
  • Provides consistent and predictable way to connect to RDS cluster through dedicated endpoint

Usage examples show provisioning replicas and reporting clusters.

Example for replicas:

module "rds_cluster_replicas" { source = "git::https://github.com/cloudposse/terraform-aws-rds-cluster-instance-group.git?ref=master" name = "postgres" namespace = "eg" stage = "dev" attributes = ["replicas"] cluster_identifier = "eg-dev-db" cluster_size = "2" db_port = "5432" instance_type = "db.r4.large" vpc_id = "vpc-xxxxxxxx" security_groups = ["sg-xxxxxxxx"] subnets = ["subnet-xxxxxxxx", "subnet-xxxxxxxx"] zone_id = "Zxxxxxxxx" }

Example for reporting:

module "rds_cluster_reporting" { source = "git::https://github.com/cloudposse/terraform-aws-rds-cluster-instance-group.git?ref=master" cluster_size = "2" namespace = "eg" stage = "dev" name = "db" attributes = ["reporting"] cluster_identifier = "eg-dev-db" instance_type = "db.t2.small" vpc_id = "vpc-xxxxxxx" security_groups = ["sg-xxxxxxxx"] subnets = ["subnet-xxxxxxxx", "subnet-xxxxxxxx"] zone_id = "Zxxxxxxxx" cluster_parameters = [ { name = "character_set_client" value = "utf8" }, { name = "character_set_connection" value = "utf8" }, { name = "character_set_database" value = "utf8" }, { name = "character_set_results" value = "utf8" }, { name = "character_set_server" value = "utf8" }, { name = "collation_connection" value = "uft8_bin" }, { name = "collation_server" value = "uft8_bin" }, { name = "lower_case_table_names" value = "1" apply_method = "pending-reboot" }, { name =

This is useful for creating reporting clusters that don't impact production databases. Supports Amazon Aurora Serverless.

Operational Considerations

The modules integrate with CloudPosse labeling for consistent resource names and tags. Enhanced monitoring IAM role is created when enabled. Security groups are created with egress and ingress rules for CIDR blocks, IPv6 CIDR blocks, and security group references.

Network placement uses DB subnet group. Cluster activity stream can be enabled for audit logging.

Parameter groups allow customization of engine specific parameters. Cluster parameters allow per cluster tuning.

The module does not prescribe specific backup retention values; users configure via module inputs.

Use Cases

The modules are appropriate for:

  • New Aurora MySQL or PostgreSQL deployments with repeatable Terraform
  • Serverless Aurora workloads with auto pause and scaling
  • Reader scaling via instance pools with dedicated endpoints
  • Reporting replicas isolated from production traffic
  • Environments requiring standardized naming, tagging, and security group rules

The GitHub repository description is used to populate the short description of the module. This should be a simple one sentence description of the module.

Conclusion

The cloudposse rds-cluster aws module and the cloudposse rds-cluster-instance-group aws module provide a structured approach to provisioning Aurora clusters on AWS with Terraform. The rds-cluster module automates creation of Aurora clusters for MySQL and PostgreSQL, including instances, parameter groups, subnet groups, security groups, monitoring roles, and autoscaling targets. It supports standard and serverless engine modes, configurable cluster size, backup and retention options, and network placement. The instance group module adds dedicated endpoint provisioning for reader pools and reporting workloads with customizable instance types, storage settings, and backup policies. Together they enable consistent, scalable, and highly available RDS environments with reduced manual error and standardized operational configuration.

Sources

  1. https://get.alternative.to/cloudposse-rds-cluster-instance-group-aws/overview
  2. https://get.alternative.to/cloudposse-rds-cluster-aws/overview
  3. https://stackshare.io/terraform-registry-cloudposse-rds-cluster-instance-group-aws
  4. https://docs.cloudposse.com/modules/library/aws/rds-cluster/
  5. https://github.com/cloudposse/terraform-aws-rds-cluster
  6. https://docs.cloudposse.com/modules/library/aws/rds-cluster-instance-group/
  7. https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-rds-dbcluster.html

Related Posts