Skip to content
cloudemu
Services

Relational Database

Managed relational-database control-plane emulation for RDS/Aurora, Redshift, Azure SQL, PostgreSQL/MySQL Flexible Server, Cloud SQL, and AlloyDB

aws RDSazr Azure SQLgcp Cloud SQL

Emulates the control plane of managed relational databases — the API that provisions, stops, snapshots, and restores an RDS/Cloud SQL/Azure SQL instance. It models the instance lifecycle, Aurora-style clusters and their member instances, and snapshot/restore, but not the SQL surface itself: there's no query engine behind the endpoint. Instances move through realistic states (creating → available → stopped → deleting) so your infra code sees the same transitions it would in production.

Reach for it in tests when your provisioning or IaC code creates a DB instance, waits for it to become available, stops it, or snapshots and restores it — so you can exercise those lifecycle paths without spinning up real (and slow, and billed) instances. For NoSQL stores (DynamoDB, Cosmos DB, Firestore), see Database instead.

ProviderServiceSDK-compatDriver
AWSRDS (+ Aurora clusters, Neptune & DocumentDB engines)✓ Liveaws.RDS
AWSRedshift (cluster + snapshots)✓ Liveaws.Redshift
AzureSQL Database (logical server + databases)✓ Liveazure.SQL
AzurePostgreSQL Flexible Server✓ Liveazure.PostgresFlex
AzureMySQL Flexible Server✓ Liveazure.MySQLFlex
GCPCloud SQL (MySQL / PostgreSQL / SQL Server)✓ Livegcp.CloudSQL
GCPAlloyDB (PostgreSQL-compatible)✓ Livegcp.AlloyDB

Drive it with the real SDK#

The recommended path is to point the real SDK at the SDK-compat server. This provisions a standalone Postgres instance, an Aurora cluster, then stops the instance — the same lifecycle calls your infra code makes, against an in-memory control plane:

import (
    "github.com/aws/aws-sdk-go-v2/service/rds"
    "github.com/aws/aws-sdk-go-v2/service/rds/types"
    "github.com/stackshy/cloudemu/v2"
    awsserver "github.com/stackshy/cloudemu/v2/server/aws"
)

cloud := cloudemu.NewAWS()
ts := httptest.NewServer(awsserver.New(awsserver.Drivers{
    RDS:      cloud.RDS,
    Redshift: cloud.Redshift,
}))

client := rds.NewFromConfig(cfg, func(o *rds.Options) {
    o.BaseEndpoint = aws.String(ts.URL)
})

// Standalone instance
client.CreateDBInstance(ctx, &rds.CreateDBInstanceInput{
    DBInstanceIdentifier: aws.String("app-db"),
    Engine:               aws.String("postgres"),
    DBInstanceClass:      aws.String("db.t3.micro"),
    AllocatedStorage:     aws.Int32(20),
})

// Aurora cluster + member instance
client.CreateDBCluster(ctx, &rds.CreateDBClusterInput{
    DBClusterIdentifier: aws.String("app-cluster"),
    Engine:              aws.String("aurora-postgresql"),
})

client.StopDBInstance(ctx, &rds.StopDBInstanceInput{
    DBInstanceIdentifier: aws.String("app-db"),
})

Azure servers speak ARM (armsql, armpostgresqlflexibleservers, armmysqlflexibleservers); Cloud SQL speaks the Cloud SQL Admin REST API (sqladmin/v1). See the SDK-Compat Server page for the full quick starts.

Call the driver directly#

All six services implement one driver interface, so the same calls work across every provider — handy when a test needs to run the same lifecycle assertions against more than one cloud. This creates an instance, stops it, spins up a cluster, and snapshots the instance:

import rdbdriver "github.com/stackshy/cloudemu/v2/services/relationaldb/driver"

inst, _ := aws.RDS.CreateInstance(ctx, rdbdriver.InstanceConfig{
    ID: "app-db", Engine: "postgres", InstanceClass: "db.t3.micro",
})
aws.RDS.StopInstance(ctx, "app-db")

cluster, _ := aws.RDS.CreateCluster(ctx, rdbdriver.ClusterConfig{
    ID: "app-cluster", Engine: "aurora-postgresql",
})

snap, _ := aws.RDS.CreateSnapshot(ctx, rdbdriver.SnapshotConfig{
    ID: "app-db-snap", InstanceID: "app-db",
})

Restore with RestoreInstanceFromSnapshot (or RestoreClusterFromSnapshot), passing a new ID and the snapshot ID.

Behavior & fidelity#

BehaviorWhat happens
Real state machineInstances and clusters walk creating → available → stopped → deleting; illegal transitions error, so wait-for-state code is exercised for real.
Aurora clusters own membersA cluster tracks its member instances; the aurora-postgresql/aurora-mysql, Neptune, and DocumentDB engines run through the RDS driver with the right ports and namespaces.
Snapshots round-tripInstance and cluster snapshots can be created, listed, deleted, and restored into new instances or clusters.
Cluster support tracks realityCluster-less services (Redshift, Flexible Server, Cloud SQL) error on cluster-snapshot ops; Redshift is cluster-only and errors on instance-level ops.
Lifecycle emits metricsState transitions push CloudWatch / Azure Monitor / Cloud Monitoring values under the correct per-engine namespace.
Provider quirks preservedCloud SQL start/stop is emulated via settings.activationPolicy, and its operations endpoint returns DONE immediately.
AlloyDB reuses the driverGCP AlloyDB maps clusters to Cluster, read-pool/secondary instances to Instance, and backups to ClusterSnapshot.
Optional capabilities are type-assertedExtras stay out of the core interface — each driver answers only for the resources its cloud has, and the rest return InvalidAction.
Discoverable and billedManaged relational servers surface in Resource Discovery and are billed per instance-hour.

RDS-oriented capability families:

FamilyCovers
Subnet groupsDB subnet groups for VPC placement
Parameter & option groupsInstance- and cluster-scoped tuning
Read replicasReplica creation and standalone promotion
Advanced restoreSnapshot copy and point-in-time restore
RDS ProxyConnection proxy with a target group
Event subscriptionsInstance and cluster event feeds
AuroraCluster endpoints, cluster failover, global clusters
Metadata & taggingEngine-version catalogs, ARN-addressed tags

Azure and GCP managed-SQL child resources, cascade-deleted with their parent server:

ServiceChild resources
Flexible servers + Cloud SQLDatabases, firewall rules, server parameters
Azure SQLVNet rules, elastic pools, failover groups, AAD admins, SQL Managed Instances
Cloud SQLUsers, SSL certs, instance clone, replica promotion, tiers/flags catalogs
AlloyDBCross-region secondary clusters, promote, instance failover/restart

SDK-compat — Live#

Real rds, armsql, sqladmin, and related clients drive every service end-to-end:

ProviderCoverage
AWS RDS/Aurora + RedshiftInstances, clusters, snapshots
Azure SQL + Flexible ServerLogical servers, databases, lifecycle
GCP Cloud SQL + AlloyDBInstances, backups, replicas

See SDK-Compat for the full per-operation list.

On this page

On this page