← Offstack All Offstack Docs Topic & How-To Guides v15.0.0 · ~22 KB

Relational Databases & Local Wire Endpoints

Run embedded SQLite and live PostgreSQL, MySQL, SQL Server, Oracle REST, Aurora DSQL, and OCI ADB endpoints locally with optional strict mode.

Offstack serves the RDS control plane and gives each instance a database a real client can connect to. This page is how to run it, what was measured, and where it deliberately differs from AWS.

Running it

1. Default mode: Embedded SQLite + Live Wire Endpoints (v15.0.0)

If you omit --rds-server-url, RDS no longer falls back to a metadata-only stub: each DB instance and cluster gets an isolated embedded SQLite database, plus (in Pro/Enterprise builds, unless --no-rds-embedded-endpoints is passed) a live protocol wire endpoint listening on Endpoint.Port and backed by the SQL bridge over that instance's SQLite file:

Clients and rds-data (ExecuteStatement) read and write the same rows, endpoints close on stop/delete and reopen on restart (--persist, reopen_embedded_endpoints()). Aurora DSQL (dsql) clusters likewise expose a live PgWire endpoint, and OCI Autonomous Databases expose a per-ADB ORDS endpoint (ADMIN Basic auth). In Free builds, embedded wire listeners are disabled while the SQLite backing and rds-data continue to work.

2. External backing server (--rds-server-url)

python start.py --rds-port 4607 --rds-data-port 4608 \
    --rds-server-url postgresql+psycopg://user:pass@127.0.0.1:5432/offstack

When --rds-server-url is provided, Offstack provisions real databases on that PostgreSQL or MySQL server and opens forwarding TCP listeners per instance. Pass --strict-rds (or --rds-require-backing) to forbid embedded SQLite fallback when an external server is required.

What the master user needs

ServerRequirementWhy
PostgreSQLCREATEDB (or superuser)CREATE DATABASE per instance
MySQLglobal CREATE (GRANT CREATE ON *.*)a per-database grant cannot create a database

can_provision() checks the privilege, not connectivity, and says so at boot. A role that can connect but not create answered "yes" to the first version of that check and failed on every instance.

Using it

import boto3, pymysql

rds = boto3.client("rds", endpoint_url="http://127.0.0.1:4607", ...)
inst = rds.create_db_instance(
    DBInstanceIdentifier="my-db", DBInstanceClass="db.t3.micro",
    Engine="postgres", MasterUsername="admin", MasterUserPassword="pw")["DBInstance"]

ep = inst["Endpoint"]
conn = psycopg.connect(host="127.0.0.1", port=ep["Port"],
                       user="admin", password="pw", dbname="postgres")

Endpoint.Port is the port that actually listens. The host in Address is the documented AWS form and does not resolve; pass 127.0.0.1 as the host and the reported port.

Or over HTTP, with no driver:

data = boto3.client("rds-data", endpoint_url="http://127.0.0.1:4608", ...)
data.execute_statement(resourceArn=inst["DBInstanceArn"], secretArn="any",
                       sql="CREATE TABLE t (id INTEGER)")
data.execute_statement(resourceArn=inst["DBInstanceArn"], secretArn="any",
                       sql="INSERT INTO t VALUES (:v)",
                       parameters=[{"name": "v", "value": {"longValue": 7}}])
print(data.execute_statement(resourceArn=inst["DBInstanceArn"],
                             secretArn="any", sql="SELECT id FROM t")["records"])
# [[{'longValue': 7}]]

How an instance is three things

  1. A row (rds_instances) describing it.
  2. A database on the backing server, isolated from Offstack's own state

and owned by the master user. A user's DROP TABLE cannot reach the simulator's DynamoDB items.

  1. A listening port that forwards to that database. The startup packet is

rewritten per port, so a caller never has to name the instance's database.

Anything less answers every boto3 call correctly and fails the first real application.

Coverage

163 of 163 operations answer (2026-11-14). They split three ways, and the split is the point -- a count that merged them would hide which kind of answer a caller gets:

KindCountWhat the caller gets
Implemented with real state142a stored row, and a describe that returns what was written
Refused with a reason21UnsupportedOperation naming the constraint
Unanswered0--

The 21 refusals are grouped by why, not by service. Each message names the constraint so a developer can tell a gap that will close from a fact that will not change:

GroupExamplesWhy
A different physical factSwitchoverReadReplica, SwitchoverGlobalCluster, ModifyCurrentDBClusterCapacityone backing server; a status that flips would report a failover that did not happen
Bytes that are not hereDownloadDBLogFilePortionno log capture to download
A second environmentblue/green, shard groups, custom engine versionsOffstack runs one environment, one host, no partner service
A billing or cross-region productPurchaseReservedDBInstancesOffering, automated-backup replicationa purchase or a second region, neither of which exists here

Sixteen of the 39 used to be in this table and are not any more, because the refusal was about the code rather than the capability (recount 2026-11-19): RestoreDB*ToPointInTime clones the live database behind the retention-gated chain, BacktrackDBCluster records the applied rewind, the five tenant operations hold the definitions plus a schema on the instance's database, DescribeDBClusterBacktracks lists the applied log, DescribeIntegrations answers [], and ModifyDBRecommendation names the absent recommendation. The earlier four: DescribeReservedDBInstances and its offerings are a static catalogue (empty list and published prices), DescribeCertificates is RDS's published CA bundle, and StartExportTask writes a real object to the S3 simulator. A refusal has to name something Offstack cannot do, not something nobody had written yet.

A count of "163/163" is therefore not "all of RDS works". It is "no operation fails to answer", and tests/test_rds_tier_a.py pins both halves: every operation has a handler, and every refusal carries a non-empty reason.

Aurora: one database, many members

An Aurora cluster is one database with instances attached to it. This is the property that defines the engine: a reader is not a copy streaming from a writer, it reads the same volume. So:

writer endpoint.

its own port onto that same database.

That is asserted by connecting for real, because no in-process oracle can show it.

Reporting a member with no endpoint at all would have been simpler and less honest: on AWS a member's endpoint accepts connections and returns the cluster's data.

Failover is implemented. FailoverDBCluster promotes a reader to writer -- which is all it is on AWS too, because every member already reads the same storage. The cluster endpoint stays on its port and serves the promoted writer's data; tests/test_rds_aurora.py proves a row written before failover is readable after it.

Still refused: SwitchoverGlobalCluster and FailoverGlobalCluster. Those are global clusters -- two regions with real replication -- and there is no second region to switch to. The distinction matters: refusing cluster failover was wrong, and conflating it with global-database failover is what caused the error.

Global databases: the roster, now reachable both ways

A global database is a roster: the member cluster identifiers, the first of which is the writer. Replication between regions is not simulated and never claimed. Two paths add a member, and both are wired:

cluster as the writer.

documentation leads with. Joining a global cluster that does not exist is refused with GlobalClusterNotFoundFault (pinned against AWS; moto accepts the join silently, which is moto's leniency, not a competing answer).

DescribeGlobalClusters reports the topology honestly: the writer's Readers names every other member's ARN, readers carry an empty list, and a member's own DescribeDBClusters shape carries its GlobalClusterIdentifier. Deleting a member removes it from every roster, so the roster never names a cluster that no longer exists.

Found by probing all three oracles with the same sequence (2026-11-15): before this, the CreateDBCluster join path was a silent no-op -- the call answered 200 and DescribeGlobalClusters kept reporting an empty member list -- and EngineVersion echoed the MySQL default (8.4.13) for aurora-mysql engines, a version that family never had. Aurora engines now default to a real Aurora version (5.7.mysql_aurora.2.11.2) and echo the caller's requested version. moto and MiniStack implement both behaviours; fakecloud omits GlobalClusterMembers entirely, which is its known plausible-empty shape rather than an answer.

Aurora Serverless v2: the ceiling, not the meter

A Serverless v2 cluster carries a scaling configuration -- a minimum and maximum ACU range. Offstack stores it and echoes it on create, modify, restore and describe. That is reporting stored state: it is what the caller asked for.

What it does not do is measure ACUs. There is no capacity model, so ModifyCurrentDBClusterCapacity stays refused, and a cluster's actual utilisation is a number Offstack cannot produce. The line is the same one the endpoint path draws: a port that listens is real, a status that flips is not.

This was a defect, not a gap. CreateDBCluster accepted ServerlessV2ScalingConfiguration and EnableHttpEndpoint and discarded them: the call answered 200 and the describe reported None. A caller had to compare the response against the request to notice, and nothing downstream behaved differently. tests/test_rds_serverless.py now pins the round trip through create, modify, restore and describe.

Two constraints come with it:

ceiling unchanged -- an omitted field is not "clear it", and treating absence as unset silently resets configuration.

configuration, which is the rule AWS enforces. On a plain cluster it answers InvalidParameterValue.

EnableHttpEndpoint was dropped the same way and is now stored, so the flag and the EnableHttpEndpoint/DisableHttpEndpoint operations agree with each other.

Snapshots carry data

CreateDBSnapshot and CreateDBClusterSnapshot copy the source database (CREATE DATABASE ... TEMPLATE on PostgreSQL, a table-by-table copy on MySQL), so the restore operations have something to restore:

OperationStatus
RestoreDBInstanceFromDBSnapshotimplemented -- clones the captured database
RestoreDBClusterFromSnapshotimplemented -- same, at cluster scope
RestoreDB*FromS3implemented -- reads a SQL dump from the S3 simulator
StartExportTaskimplemented -- writes the snapshot's rows to S3 as SQL
RestoreDBInstanceToPointInTimeimplemented -- retention-gated, clones the source's live database, records source and time
RestoreDBClusterToPointInTimeimplemented -- same, at cluster scope
BacktrackDBClusterimplemented -- records the applied rewind; describe lists the log

These were refused while snapshots held metadata only, and that refusal was correct: restoring from a metadata-only snapshot yields an empty database that reports available. The fix was to make the snapshot hold data, not to keep refusing.

If a capture or restore fails, the instance/cluster reports storage-full rather than available -- the same rule the endpoint path follows.

The export artifact has to load

StartExportTask writes CREATE TABLE (...), INSERT statements and a type map to <prefix>/<task-id>.sql. It is SQL rather than AWS's Parquet, because SQL is what RestoreDBInstanceFromS3 consumes -- an exported object can be fed straight back in, and tests/test_rds_dump_roundtrip.py proves that on both engines.

Three defects lived here and all three looked like success: the dump filtered information_schema.tables on the database name (PostgreSQL keys on public, so every dump was empty), the artifact was CREATE TABLE t AS SELECT * FROM t (parses, copies nothing), and TotalExtractedDataInGB was emitted as a float where the shape is integer (so botocore failed to parse any completed task). The last is invisible without a backing server, which is why the suite runs against one.

Point-in-time restore, backtrack, tenants

AWS replays the automated-backup chain up to the requested time; there is no second copy to replay from here, so the restore clones the source's live database -- which is what the chain holds when nothing has been lost. That is why UseLatestRestorableTime and an explicit timestamp take the same path: the chain's head is now. The gate is the retention window, not the clock: with BackupRetentionPeriod 0 the source keeps no chain at all, and the restore answers PointInTimeRestoreNotEnabledFault rather than inventing one. The target records its source and time (SourceIdentifier, RestoreTime), so a restored instance that forgot its origin would read as created from nothing. tests/test_rds_point_in_time.py pins the gate, the origin, and the latest-spelling at the store level.

BacktrackDBCluster records the applied rewind; DescribeDBClusterBacktracks lists the log ([] when nothing was ever backtracked, not-found for a cluster that does not exist). Offstack keeps no storage-engine change log, so "applied" is what the store does -- the entry is recorded against the cluster.

Tenant databases are the definitions Oracle multitenant containers would hold: which instance, which name, whose password -- plus a schema on the instance's own database (PostgreSQL schema, MySQL database). The backing server is not an Oracle CDB and never claims to be; the lifecycle is the ordinary create/describe/modify/delete with presence first and duplicates conflicting, and a snapshot's tenant list is the same table filtered.

Read replicas: shared storage, severed on promotion

A read replica is an instance row that shares its source's database -- the same precedent as Aurora members sharing cluster storage: on one machine there is no replication to simulate, and a reader that saw different rows from its writer would be less faithful than the truth, which is that they read the same volume.

The control plane is the AWS contract, probed on all three oracles (2026-11-15): CreateDBInstanceReadReplica inherits engine, class and credentials from the source and gets its own address and endpoint port, proxying the source's database. The replica's shape carries ReadReplicaSourceDBInstanceIdentifier; the source's shape lists ReadReplicaDBInstanceIdentifiers. A replica of a source that does not exist is DBInstanceNotFound -- unanimous across moto, MiniStack and fakecloud, and the one answer fakecloud gives that its own state does not contradict two calls later.

PromoteReadReplica severs the link and clones the database: the replica's rows are dumped out of the shared database and restored into one of its own, so writes after promotion diverge, which is the entire point of promotion on AWS. moto gets this wrong -- it keeps ReadReplicaSourceDBInstanceIdentifier after promoting -- so promotion is pinned against AWS's documented behaviour rather than any oracle. The source stops listing the replica. SwitchoverReadReplica stays refused: it names a multi-region topology this machine cannot have.

One deliberate divergence, stated rather than hidden: AWS refuses writes against a replica. Offstack's replica endpoint proxies the shared database and accepts any statement -- enforcing read-only would mean parsing SQL on the wire, and pretending to enforce it would be worse than admitting it. Cascading replicas (replica of a replica) are not offered in this first cut; AWS allows them to depth three.

Measured behaviour

Verified 2026-11-14 on PostgreSQL 16.15 and MySQL 8.4.13:

FactConsequence in the code
DROP DATABASE fails with ObjectInUse while a client is connectedteardown disposes the pool and terminates backends before dropping
str(sqlalchemy_url) renders the password as ***render_as_string(hide_password=False) when building an engine URL
PostgreSQL sends SSLRequest before the startup messagethe proxy answers the TLS probe, then rewrites the real one
MySQL advertises CLIENT_SSL, so clients encrypt the loginthe greeting is relayed with that bit cleared
A rewritten MySQL login must keep the client's sequence numberincrementing it yields "Packet sequence number wrong"
An RDS identifier may contain a hyphen; a database name may notidentifiers are folded to a safe name
ExecuteStatement.records is a list of bare Field lists{"values": ...} is the ExecuteSql shape, not this one

Divergences from AWS, deliberate

by hostname and uses the engine default for all of them; against one local host the port is the only discriminator.

not a fixed default.

is set with an unreachable --rds-server-url) report storage-full, not available. Under the default Pro/Enterprise embedded SQLite + wire-bridge mode, postgres*, mysql/mariadb/aurora, sqlserver-*, and oracle-* engines expose live endpoints and transition to available. available on an endpoint nothing serves would be a silent failure.

empty list. DBSnapshots: [] would tell a caller it has no snapshots, which is a different claim. The reason is in the message, so a refusal is distinguishable from a gap in dispatch.

available. AWS's proxy pools connections and fails over; nothing in Offstack sits between the endpoint and the database, so available would describe a layer that does not exist. moto reports available for these, which is the more confident and less accurate answer.

*NotFound / *NotFoundFault code comes back 404 from AWS, while validation, conflicts and refusals stay 400. The status rides on the RdsError, not on a per-handler mapping, so a new not-found raise gets the right status by passing status=_NOT_FOUND_STATUS.

integration id, or ARN draws InvalidParameterValue from AWS -- never the not-found code -- so the handlers check the shape first and the presence behind it. DeleteIntegration/ModifyIntegration are the exception that proves the order matters: AWS answers "Invalid integration identifier" for any unknown id, so there is no IntegrationNotFoundFault path at all. tests/test_rds_error_codes.py pins all twenty exchanges.

Tests

FileOracleNeeds a server
tests/test_rds_control_plane.pydifferential vs motono
tests/test_rds_tier_a.pydifferential vs moto; status fields pinnedno
tests/test_rds_error_codes.pysingle-oracle: unified AWS cassette, 20 error exchangesno
tests/test_rds_aurora.pymembership vs moto; shared storage Offstack-onlypartly
tests/test_rds_snapshot_restore.pyshape vs moto; snapshot data and export Offstack-onlypartly
tests/test_rds_dump_roundtrip.pysingle-oracle, both enginesyes
tests/test_rds_endpoint.pysingle-oracleyes
tests/test_rds_data_api.pysingle-oracleyes

The last three verify behaviour no in-process oracle can: moto fabricates a dead endpoint address and answers every ExecuteStatement with a canned {"records": []}. fakecloud does run real database containers for RDS and rds-data — an earlier version of the adjudication record claimed it had no RDS surface, which was wrong; see the correction entry there. It is not wired in as a peer yet, so these suites assert state round trips rather than comparing two implementations, and skip unless the variable below is set:

export OFFSTACK_TEST_RDS_SERVER_URL="postgresql+psycopg://admin:pw@127.0.0.1:55432/postgres"
export OFFSTACK_TEST_RDS_MYSQL_SERVER_URL="mysql+pymysql://root@127.0.0.1:33307/offstack"
# NOTE: MySQL's fixture has NO root password (empty), despite `root:pw`
# appearing in older drafts of this section.

# The fixtures do not survive a reboot. Start them first (tracked script;
# the binaries stay host-local under the install root, see its header):
#   powershell -ExecutionPolicy Bypass -File tools\start-db-fixtures.ps1
# PostgreSQL answers FATAL "the database system is starting up" for 10+
# minutes after an unclean shutdown while it replays WAL; the script probes a
# live query rather than grepping start.log (whose "ready" line may be from
# the previous boot), and exits non-zero when a server never answers.
python -m pytest tests/test_rds_endpoint.py tests/test_rds_data_api.py \
                 tests/test_rds_dump_roundtrip.py

A skip there is not a green: without the variables, endpoint, Data API and dump/restore behaviour is unverified. The MySQL variable is not optional when the dump path is in play — the two engines disagree on what information_schema's schema column means, and only one engine being present is how that disagreement stayed hidden.

--strict-rds turns those skips into failures.


Want a live walkthrough or evaluation setup for Offstack? Message George Vranjesevic or reach out at george@developmentsnapshot.com.