Skip to main content
Type: rvn-aurora · Latest version: 0.1.1

Dependencies and consumers

Every dependency input can be specified manually to reference existing external infrastructure rather than a Ravion module.

Readme

Creates and manages an Amazon Aurora cluster. Supports Aurora PostgreSQL and Aurora MySQL with provisioned or Serverless v2 capacity.

Overview

Use this module when an application needs a managed, highly available relational database cluster in AWS. It provisions an Aurora cluster with writer and reader instances, subnet placement, security group access, backups, monitoring, optional reader autoscaling, and optional advanced Aurora features. Aurora PostgreSQL and Aurora MySQL are supported. Choose the engine major version and, when needed, a minor version for exact engine pinning. Choose provisioned instances for predictable capacity or Serverless v2 when the workload needs capacity that scales in Aurora Capacity Units.

Use cases

Networking

Select a VPC network first. Ravion maps the network’s AWS account, region, VPC ID, and private and public subnet IDs into this module. Aurora requires at least two subnets in different Availability Zones, and private subnets are the normal choice for application databases. AWS places cluster instances across the Availability Zones of the selected subnets. Public access is disabled by default, and the DB subnet group uses the private subnet IDs. When Publicly accessible is enabled, the DB subnet group switches to the public subnet IDs because AWS requires public subnets for public database access. Changing this setting after creation replaces the DB subnet group and the cluster. Keep public access disabled for production databases and allow access through security group IDs from application services or controlled CIDR blocks. You can create a module-managed security group or attach an existing one.

Capacity modes

Provisioned capacity uses a fixed DB instance class for the writer and, by default, for readers. Serverless v2 uses Aurora Capacity Units; set the minimum and maximum ACUs to control the scaling range. The module uses db.serverless for cluster instances when Serverless v2 is selected.

Availability and readers

Reader settings live together in the Readers section. Choose the number of reader instances, an optional separate reader instance class, and an optional default failover promotion tier. Readers default to 0; add at least one reader in another Availability Zone for production failover. Reader autoscaling can adjust the number of read replicas based on CPU utilization and, optionally, database connections. Configure min and max reader capacity carefully because autoscaling can increase cost.

Credentials and security

Master password management in AWS Secrets Manager is enabled by default, so AWS creates and stores the master password for the cluster. Provide a Secrets Manager KMS key ARN when you need a customer-managed key for that secret. Storage encryption is enabled by the Terraform module. Provide a storage KMS key ARN when you need a customer-managed key for cluster storage. IAM database authentication and the Aurora Data API HTTP endpoint are optional.

Availability, backups, and maintenance

Aurora creates a writer instance and the configured number of reader instances. Backup retention defaults to 7 days and must be at least 1 day for Aurora. Final snapshots and deletion protection are enabled by default to reduce accidental data loss. Maintenance windows, automatic minor upgrades, major version upgrades, and immediate apply are configurable. Major version upgrades and immediate changes are opt-in because they can affect database availability. Aurora MySQL exposes backtrack and local write forwarding settings. Aurora PostgreSQL exposes global write forwarding according to this module’s Terraform validation.

Observability

Performance Insights is enabled by default with 7 days of retention. Enhanced monitoring can be enabled by setting a monitoring interval. CloudWatch alarms can monitor CPU utilization, freeable memory, and database connections. The freeable memory alarm threshold is entered in MiB in Ravion and converted to bytes for Terraform. CloudWatch log exports offer engine-specific log types: postgresql for Aurora PostgreSQL, or audit, error, general, and slowquery for Aurora MySQL. Each enabled log type is shown on the module Logs tab. The Ravion UI charts Aurora CloudWatch metrics for CPU utilization, freeable memory, database connections, serverless capacity and ACU utilization, storage used, read and write latency, replica lag, buffer cache hit ratio, commit latency, deadlocks, network throughput, and volume IOPS.

Configuration

Advanced configuration

Use cluster parameter groups for cluster-level engine settings and DB parameter groups for instance-level engine settings. The Misc section holds less common cluster features: Database Activity Streams, custom endpoints for reader or any-instance routing, and IAM role associations that attach feature-specific IAM roles for capabilities such as S3 import, S3 export, or Lambda invocation. Use advanced Terraform variables for one-off overrides not represented directly in the UI. Values in advanced Terraform variables override generated variables. Terraform settings let you override the OpenTofu version, Terraform execution environment inherited from the VPC network, and Ravion state backend workspace name.

Design decisions

Aurora clusters are placed in private subnets by default through the VPC network reference. Secrets Manager password management, encryption at rest, Performance Insights, final snapshots, and deletion protection default on because they are safer defaults for long-lived databases. The module keeps primary database, capacity, networking, backup, and monitoring choices visible while placing engine-specific, autoscaling, parameter group, global database, activity stream, custom endpoint, IAM association, and Terraform settings behind focused advanced controls.

Learn more

Inputs reference

All inputs for rvn-aurora version 0.1.1. Use the name shown for each field as the input key in module config.
network
$ref:rvn-aws-network
required
VPC network.
  • Immutable after creation

Database

name
string
required
Name slug. Name of the Aurora cluster and prefix for related resources.
  • Default: <<project.given_id>>-<<environment.given_id>>
  • Immutable after creation
  • Pattern: ^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$ — 1-63 lowercase letters, numbers, and hyphens. Start with a letter and end with a letter or number.
restore_mode
string
required
Create or restore.
  • Default: none
  • Allowed values: none (New empty database), snapshot (Restore from snapshot), point_in_time (Point-in-time restore)
  • Immutable after creation
database_name
string
Database name. Name for an automatically created database on the cluster.
  • Immutable after creation
  • Pattern: ^[A-Za-z][A-Za-z0-9_]{0,63}$ — 1-64 letters, numbers, and underscores. Start with a letter.
  • Shown when: {"restore_mode":"none"}
master_username
string
required
Username.
  • Default: dbadmin
  • Immutable after creation
  • Pattern: ^[A-Za-z][A-Za-z0-9_]{0,62}$ — Invalid Aurora master username. Start with a letter. Letters, numbers, and underscores only.
  • Shown when: {"restore_mode":"none"}
snapshot_identifier
string
required
Snapshot to restore. Snapshot identifier or ARN to restore into this new Aurora cluster.
  • Immutable after creation
  • Shown when: {"restore_mode":"snapshot"}
point_in_time_source_cluster_identifier
string
required
Source cluster identifier. Source Aurora cluster identifier to restore from.
  • Immutable after creation
  • Shown when: {"restore_mode":"point_in_time"}
point_in_time_restore_type
string
required
Restore type.
  • Default: full-copy
  • Allowed values: full-copy (Full copy), copy-on-write (Copy on write)
  • Immutable after creation
  • Shown when: {"restore_mode":"point_in_time"}
point_in_time_use_latest_restorable_time
boolean
Use latest restorable time. Restore to the latest time AWS can recover from the selected source cluster backup.
  • Default: true
  • Immutable after creation
  • Shown when: {"restore_mode":"point_in_time"}
point_in_time_restore_time
string
Restore time. Restore to this UTC timestamp instead of the latest restorable time.
  • Immutable after creation
  • Shown when: {"point_in_time_use_latest_restorable_time":false,"restore_mode":"point_in_time"}

Version

engine
string
required
Engine.
  • Default: aurora-postgresql
  • Allowed values: aurora-postgresql (Aurora PostgreSQL), aurora-mysql (Aurora MySQL)
  • Immutable after creation
engine_major_version
string
required
Engine major version. Examples: 16 for Aurora PostgreSQL or 8.0 for Aurora MySQL.
engine_minor_version
string
Engine minor version. Optional minor engine version appended to the major version. Example: 4 becomes 16.4 for Aurora PostgreSQL; 3.08.0 becomes 8.0.mysql_aurora.3.08.0 for Aurora MySQL.
minor_version_auto_upgrade_enabled
boolean
Auto minor version upgrades. Enable automatic minor engine version upgrades during the configured maintenance window.
  • Default: true

Capacity

capacity_mode
string
required
Capacity mode. Choose fixed DB instances or Aurora Serverless v2 capacity.
  • Default: provisioned
  • Allowed values: provisioned (Provisioned instances), serverless_v2 (Serverless v2)
instance_class
string
required
Instance class. Aurora writer instance size, such as db.t4g.medium or db.r6g.large.
  • Default: db.t4g.medium
  • Shown when: {"capacity_mode":"provisioned"}
serverless_min_capacity
number
required
Min capacity (ACUs). Minimum Aurora Serverless v2 capacity units. Must not exceed max capacity.
  • Default: 1
  • Min: 1
  • Max: 256
  • Shown when: {"capacity_mode":"serverless_v2"}
serverless_max_capacity
number
required
Max capacity (ACUs). Maximum Aurora Serverless v2 capacity units. Must be at least min capacity.
  • Default: 4
  • Min: 1
  • Max: 256
  • Shown when: {"capacity_mode":"serverless_v2"}

Storage & cluster

storage_type
string
Storage type.
  • Default: aurora
  • Allowed values: aurora (Aurora Standard), aurora-iopt1 (Aurora I/O-Optimized)
kms_key_id
string
Storage KMS key ARN.
  • Immutable after creation
ca_certificate_identifier
string
CA certificate identifier.
network_type
string
Network type.
  • Default: IPV4
  • Allowed values: IPV4 (IPv4), DUAL (Dual-stack)

Network access

public_access_enabled
boolean
Publicly accessible. Keep disabled for production databases unless public access is intentional.
  • Default: false
port
number
Port. Leave blank to use the engine default port: 5432 for PostgreSQL or 3306 for MySQL.
  • Min: 1
  • Max: 65535
security_group_creation_enabled
boolean
Security group creation.
  • Default: true
  • Immutable after creation
security_group_id
string
Existing security group ID.
  • Shown when: {"security_group_creation_enabled":false}
allowed_security_group_ids
string_array
Allowed security groups.
  • Shown when: {"security_group_creation_enabled":true}
allowed_cidr_blocks
string_array
Allowed CIDR blocks.
  • Shown when: {"security_group_creation_enabled":true}

Readers

reader_count
number
Reader count. Number of reader instances to create.
  • Default: 0
  • Min: 0
  • Max: 15
reader_instance_class
string
Reader instance class. Reader instance class. Leave blank to use the writer instance class.
  • Shown when: {"capacity_mode":"provisioned"}
promotion_tier
number
Promotion tier. Default failover priority for instances. Lower values have higher priority.
  • Min: 0
  • Max: 15
autoscaling_enabled
boolean
Reader autoscaling.
  • Default: false
autoscaling_min_capacity
number
Min reader capacity. Must not exceed max reader capacity.
  • Default: 1
  • Min: 0
  • Shown when: {"autoscaling_enabled":true}
autoscaling_max_capacity
number
Max reader capacity. Must be at least min reader capacity.
  • Default: 3
  • Min: 1
  • Shown when: {"autoscaling_enabled":true}
autoscaling_target_cpu
number
Target CPU utilization (%).
  • Default: 70
  • Min: 1
  • Max: 100
  • Shown when: {"autoscaling_enabled":true}
autoscaling_target_connections
number
Target connections.
  • Min: 1
  • Shown when: {"autoscaling_enabled":true}
autoscaling_scale_in_cooldown
number
Scale-in cooldown seconds.
  • Default: 300
  • Min: 0
  • Shown when: {"autoscaling_enabled":true}
autoscaling_scale_out_cooldown
number
Scale-out cooldown seconds.
  • Default: 300
  • Min: 0
  • Shown when: {"autoscaling_enabled":true}

Credentials & authentication

master_user_secret_kms_key_id
string
Secrets Manager KMS key ARN.
  • Shown when: {"restore_mode":"none"}
iam_database_authentication_enabled
boolean
IAM database authentication.
  • Default: false
http_endpoint_enabled
boolean
Data API (HTTP endpoint). Enable the Aurora Data API HTTP endpoint.
  • Default: false

MySQL settings

backtrack_window
number
Backtrack window (seconds). Target backtrack window in seconds. Set 0 to disable.
  • Default: 0
  • Min: 0
  • Max: 259200
  • Shown when: {"engine":"aurora-mysql"}
local_write_forwarding_enabled
boolean
Local write forwarding.
  • Default: false
  • Shown when: {"engine":"aurora-mysql"}

Backups

backup_retention_period
number
Backup retention days.
  • Default: 7
  • Min: 1
  • Max: 35
preferred_backup_window
string
Backup window.
snapshot_tag_copying_enabled
boolean
Copy tags to snapshots.
  • Default: true
final_snapshot_creation_enabled
boolean
Create final snapshot.
  • Default: true
final_snapshot_identifier
string
Final snapshot identifier.
  • Shown when: {"final_snapshot_creation_enabled":true}
deletion_protection_enabled
boolean
Deletion protection.
  • Default: true

Maintenance

preferred_maintenance_window
string
Maintenance window.
major_version_upgrade_enabled
boolean
Allow major version upgrades.
  • Default: false
immediate_apply_enabled
boolean
Apply changes immediately.
  • Default: false

Parameter groups

cluster_parameter_group_creation_enabled
boolean
Cluster parameter group creation. Create a cluster parameter group for this database. Disable this only when you want to attach an existing parameter group.
  • Default: true
  • Immutable after creation
cluster_parameter_group_name
string
Existing cluster parameter group name. Name of an existing cluster parameter group to attach when this module is not creating one.
  • Immutable after creation
  • Shown when: {"cluster_parameter_group_creation_enabled":false}
cluster_parameter_group_family
string
Cluster parameter group family. Cluster parameter group family. Leave blank to derive it from the selected engine version.
  • Immutable after creation
  • Shown when: {"cluster_parameter_group_creation_enabled":true}
cluster_parameters
object_array
Cluster parameters. Custom cluster parameters to apply to the created cluster parameter group.
  • Default: []
  • Shown when: {"cluster_parameter_group_creation_enabled":true}
db_parameter_group_creation_enabled
boolean
DB parameter group creation. Create a DB parameter group for cluster instances. Disable this only when you want to attach an existing parameter group.
  • Default: true
  • Immutable after creation
db_parameter_group_name
string
Existing DB parameter group name. Name of an existing DB parameter group to attach when this module is not creating one.
  • Immutable after creation
  • Shown when: {"db_parameter_group_creation_enabled":false}
db_parameter_group_family
string
DB parameter group family. DB parameter group family. Leave blank to derive it from the selected engine version.
  • Immutable after creation
  • Shown when: {"db_parameter_group_creation_enabled":true}
db_parameters
object_array
DB parameters. Custom instance parameters to apply to the created DB parameter group.
  • Default: []
  • Shown when: {"db_parameter_group_creation_enabled":true}

Monitoring

enabled_cloudwatch_logs_exports
string_array
CloudWatch log exports. Engine logs exported to CloudWatch. Each enabled log type is shown on the module Logs tab.
  • Allowed values: postgresql, audit, error, general, slowquery
monitoring_interval
number
Enhanced monitoring interval.
  • Default: 0
  • Allowed values: 0 (0), 1 (1), 5 (5), 10 (10), 15 (15), 30 (30), 60 (60)
monitoring_role_creation_enabled
boolean
Monitoring IAM role creation.
  • Default: true
  • Immutable after creation
  • Shown when: {"monitoring_interval":{"not":0}}
monitoring_role_arn
string
Monitoring IAM role ARN.
  • Shown when: {"monitoring_interval":{"not":0},"monitoring_role_creation_enabled":false}
performance_insights_enabled
boolean
Performance insights.
  • Default: true
performance_insights_retention_period
number
Performance insights retention days. AWS supports 7 days, multiples of 31 days up to 23 months, or 731 days.
  • Default: 7
  • Allowed values: 7 (7 days), 31 (1 month (31 days)), 62 (2 months (62 days)), 93 (3 months (93 days)), 186 (6 months (186 days)), 372 (12 months (372 days)), 731 (24 months (731 days))
  • Shown when: {"performance_insights_enabled":true}
performance_insights_kms_key_id
string
Performance insights KMS key ARN.
  • Shown when: {"performance_insights_enabled":true}

CloudWatch alarms

cloudwatch_alarms_creation_enabled
boolean
Create CloudWatch alarms.
  • Default: true
cloudwatch_alarm_cpu_threshold
number
CPU alarm threshold (%).
  • Default: 80
  • Min: 0
  • Max: 100
  • Shown when: {"cloudwatch_alarms_creation_enabled":true}
cloudwatch_alarm_memory_threshold_mib
number
Freeable memory alarm threshold (MiB). Displayed in MiB. Ravion converts this to bytes for Terraform.
  • Default: 256
  • Min: 1
  • Shown when: {"cloudwatch_alarms_creation_enabled":true}
cloudwatch_alarm_connections_threshold
number
Connections alarm threshold.
  • Default: 100
  • Min: 1
  • Shown when: {"cloudwatch_alarms_creation_enabled":true}
cloudwatch_alarm_evaluation_periods
number
Alarm evaluation periods.
  • Default: 2
  • Min: 1
  • Shown when: {"cloudwatch_alarms_creation_enabled":true}
cloudwatch_alarm_period
number
Alarm period seconds.
  • Default: 300
  • Allowed values: 10 (10), 30 (30), 60 (60), 300 (300), 900 (900), 3600 (3600)
  • Shown when: {"cloudwatch_alarms_creation_enabled":true}
cloudwatch_alarm_actions
string_array
Alarm action ARNs.
  • Shown when: {"cloudwatch_alarms_creation_enabled":true}
cloudwatch_ok_actions
string_array
OK action ARNs.
  • Shown when: {"cloudwatch_alarms_creation_enabled":true}

Global database

global_cluster_creation_enabled
boolean
Global cluster creation.
  • Default: false
  • Immutable after creation
global_cluster_identifier
string
Global cluster identifier. Global cluster identifier. Set this to create a new global cluster or join an existing global cluster.
  • Immutable after creation
source_region
string
Source region. Source region for cross-region replication in a global database.
  • Immutable after creation
global_write_forwarding_enabled
boolean
Global write forwarding.
  • Default: false
  • Shown when: {"engine":"aurora-postgresql"}

Misc

activity_stream_enabled
boolean
Activity stream. Enable Database Activity Streams for the cluster.
  • Default: false
activity_stream_mode
string
Activity stream mode.
  • Default: async
  • Allowed values: async, sync
  • Shown when: {"activity_stream_enabled":true}
activity_stream_kms_key_id
string
required
Activity stream KMS key ARN.
  • Shown when: {"activity_stream_enabled":true}
custom_endpoints
object_map
Custom endpoints. Custom Aurora cluster endpoints for reader or any-instance routing.
  • Default: {}
iam_role_associations
object_map
IAM role associations. IAM roles associated with the Aurora cluster for features such as S3_IMPORT, S3_EXPORT, or LAMBDA_INVOKE.
  • Default: {}
tags
keyvalue
Tags. A map of tags to assign to all resources. Default tags are Owner, ProjectGivenId, EnvironmentGivenId, ModuleGivenId, ModuleId

Terraform settings

opentofu_version
string
OpenTofu version override. Override the environment’s default version for this module
ravion_state_backend_workspace
string
Ravion Terraform workspace name. Override Terraform state backend workspace name. Defaults to project + environment + module given ids.
  • Immutable after creation
advanced_terraform_variables
object
Advanced Terraform variables. Optional raw Terraform variable overrides for advanced module inputs or one-off overrides. Values here override the generated variables above.
  • Default: {}