Aurora DSQL is Amazon’s distributed, serverless SQL database. It is not an Aurora RDS cluster variant — it is a separate service built on a different distributed architecture that provides virtually unlimited scalability with active-active multi-region support and strong consistency.
Aurora DSQL is provisioned through the dedicated modules/dsql submodule, not through the main terraform-aws-modules/rds-aurora/aws module. Reference the submodule source as terraform-aws-modules/rds-aurora/aws//modules/dsql when using the Terraform Registry, or ../../modules/dsql from within the repository.
Key characteristics of Aurora DSQL:
- Serverless — no instances to provision or manage; you pay per operation
- Distributed — data is automatically sharded and replicated
- Multi-region active-active — peer clusters across regions with a witness region for quorum
- PostgreSQL-compatible — uses standard PostgreSQL wire protocol
Examples
Single-region
Multi-region
A minimal DSQL cluster in a single region requires only a name. Deletion protection is disabled here for demonstration.module "dsql_single_region" {
source = "terraform-aws-modules/rds-aurora/aws//modules/dsql"
name = "my-dsql-cluster"
# Disable for non-production environments
deletion_protection_enabled = false
tags = {
Environment = "dev"
Terraform = "true"
}
}
Multi-region DSQL clusters are created in pairs (or more). Each cluster references the other via clusters, and both share the same witness_region. The create_cluster_peering = true flag creates the aws_dsql_cluster_peering resource that establishes the cross-region relationship.Note that module.dsql_cluster_2 is passed into module.dsql_cluster_1’s clusters list and vice versa. Terraform resolves this circular reference through its dependency graph since only the ARN (a known-after-apply value) is needed at peering time.provider "aws" {
region = local.region1
}
locals {
name = "ex-dsql"
region1 = "us-east-1"
region2 = "us-east-2"
witness_region = "us-west-2"
tags = {
Environment = "prod"
Terraform = "true"
}
}
module "dsql_cluster_1" {
source = "terraform-aws-modules/rds-aurora/aws//modules/dsql"
name = "${local.name}-1"
deletion_protection_enabled = false
witness_region = local.witness_region
create_cluster_peering = true
clusters = [module.dsql_cluster_2.arn]
timeouts = {
create = "1h"
}
tags = local.tags
}
module "dsql_cluster_2" {
source = "terraform-aws-modules/rds-aurora/aws//modules/dsql"
# Override the region since it differs from the provider default
region = local.region2
name = "${local.name}-2"
deletion_protection_enabled = false
witness_region = local.witness_region
create_cluster_peering = true
clusters = [module.dsql_cluster_1.arn]
tags = merge(local.tags, { Name = local.name })
}
Variables reference
Core variables
| Variable | Type | Default | Description |
|---|
create | bool | true | Toggle creation of all resources in the module |
name | string | "" | Name applied to the cluster and used as the Name tag |
region | string | null | AWS region override. Defaults to the provider’s configured region |
tags | map(string) | {} | Tags to apply to all resources |
Cluster variables
| Variable | Type | Default | Description |
|---|
deletion_protection_enabled | bool | null | Prevent the cluster from being deleted via the AWS console or API |
kms_encryption_key | string | null | ARN of a customer-managed KMS key, or "AWS_OWNED_KMS_KEY" to use the default |
force_destroy | bool | null | Delete the cluster even if deletion_protection_enabled is true |
Multi-region / peering variables
| Variable | Type | Default | Description |
|---|
create_cluster_peering | bool | false | Create the aws_dsql_cluster_peering resource |
clusters | list(string) | null | ARNs of other DSQL clusters to peer with |
witness_region | string | null | The AWS region used as the quorum witness. Setting this makes the cluster multi-region |
timeouts | object({ create }) | null | Timeout override for the cluster peering create operation |
Outputs reference
| Output | Description |
|---|
identifier | The cluster identifier assigned by AWS |
arn | The ARN of the DSQL cluster |
vpc_endpoint_service_name | VPC endpoint service name for private connectivity |
encryption_details | Encryption configuration details for the cluster |
multi_region_properties | Multi-region configuration details (populated for multi-region clusters) |
Using outputs
output "dsql_cluster_1_arn" {
description = "ARN of the cluster"
value = module.dsql_cluster_1.arn
}
output "dsql_cluster_1_identifier" {
description = "Cluster identifier"
value = module.dsql_cluster_1.identifier
}
output "dsql_cluster_1_vpc_endpoint_service_name" {
description = "The DSQL cluster's VPC endpoint service name"
value = module.dsql_cluster_1.vpc_endpoint_service_name
}