This is the manual for running Offstack as part of something else — a test harness, a developer workspace, a CI job, a product that ships it — rather than as a standalone simulator you start by hand.
Offstack is an API, not a library. Its surface is AWS's wire protocol: the moment it is running, any AWS SDK pointed at the right port talks to it with no code change beyond the endpoint. Embedding therefore means launching and supervising a process, and this document is chiefly about that process contract — how to start it, where its ports are, which files it needs, how to know it is up, and how to stop it without orphaning workers.
Status note (v15.0.0): Originally written against the 2026-11-17 tree; updated for v15.0.0 (--unified-port 4566, offstack exec, /healthz + /readyz + /metrics, 96 AWS services, 15 clouds, 12 RDBMS backends, 8 wire bridges, --no-apigw-data-plane, and offstack.cmd nuitka_module installs). Where an original 2026-11-17 measurement is cited, it is labelled by date.
1. What "embedding" means here
There are two things you might mean, and they lead to different instructions:
You want your application's AWS calls to land on Offstack. This is the common case. You do not import anything; you start the process and point the SDK at it. See §2–§5.
You want Offstack inside your own process. There is no supported entry point for that today, and it is not a small gap: every service is its own HTTP server on its own thread, start.py owns their lifecycle, and several of them (RDS, the Lambda worker pool) spawn child processes that must be owned by whoever started them. Attempting it by importing the service modules directly gets you the servers without the lifecycle, which is the part that matters. If you need this, say so — it is a real feature to design, not a wiring exercise.
2. Launching it
From source
python start.py [flags]
From an installed / packaged build
# Installed Enterprise build (Windows VibeInstaller nuitka_module: offstack.cmd launcher)
offstack --unified-port 4566 [flags]
# Standalone packaged binary (historical onefile / Linux release tarball)
offstack.exe [flags] # or /opt/offstack/offstack on Linux
# Zero-code drop-in runner (spawns/connects gateway + sets AWS_ENDPOINT_URL & CA env for child command)
offstack exec -- pytest tests/
The installed / packaged build accepts the same flags and resolves sidecar files relative to OFFSTACK_ROOT / TOOLKIT_APP_ROOT / install dir (§4). Build and verification procedure is in docs/PACKAGING.md.
What "started" means
start.py starts every service, waits for each to accept a TCP connection, and only then prints a banner:
============================================================
Offstack
============================================================
DynamoDB : http://localhost:13000
S3 : http://localhost:13001
...
Mode : cold-lambda | in-memory
============================================================
Press Ctrl+C to stop.
The banner is the readiness signal, and its absence is the failure signal. A service that never became reachable makes start.py exit non-zero before printing anything, so:
- stdout contains the banner → every service is listening.
- process exited non-zero with no banner → at least one failed to bind
(usually a port already in use). The log names which.
This is deliberate and is the contract STARTUP_CONTRACT.md records: before 2026-11-10 the launcher printed a warning and continued to the banner anyway, so a half-boot and a healthy boot were identical bytes on stdout to every consumer keying on it.
Do not wait a fixed number of seconds and assume it is up. Wait for the banner on stdout, or poll the ports. Both are reliable; a sleep is not.
3. Ports and Profiles
In v15.0.0, a full boot starts 96 AWS services (plus optional 14 non-AWS cloud gateways :4671 / :4690–4702 via --cloud and 8 data/SQL wire bridges :4703–4710 via --bridges). For most embedded and CI harnesses:
- Use
--unified-port 4566so every AWS service shares one HTTP port (http://127.0.0.1:4566, plus HTTPS:4567with--tls). - Use
--profile ci-coreor--services dynamodb,s3,sqs,lambdato skip heavyweight brokers/engines you do not need (profiles.py). - Avoid hardcoding
:13000if another app uses it, or pass--no-apigw-data-planewhen using only HTTP/SQL control planes without the API Gateway route proxy.
If you connect directly to per-service ports instead of --unified-port, each service also binds its own port (core defaults below; full 96-service, multi-cloud, and wire-bridge port tables live in docs/USER_MANUAL.md):
| Service | Flag | Default |
|---|---|---|
| DynamoDB | --dynamodb-port | 13160 |
| S3 | --s3-port | 13161 |
| API Gateway (Lambda proxy) | --lambda-port | 13000 |
| STS | --sts-port | 14592 |
| SSM | --ssm-port | 4593 |
| Secrets Manager | --secretsmanager-port | 4594 |
| Lambda API (control plane + Invoke) | --lambda-api-port | 4595 |
| SQS | --sqs-port | 4596 |
| CloudWatch Logs | --logs-port | 4597 |
| CloudWatch metrics | --cloudwatch-port | 4598 |
| Cognito | --cognito-port | 4599 |
| EventBridge | --events-port | 4600 |
| SNS | --sns-port | 4601 |
| IAM | --iam-port | 4602 |
| DynamoDB Streams | --dynamodbstreams-port | 4603 |
| CloudFormation | --cloudformation-port | 4604 |
| Kinesis | --kinesis-port | 4605 |
| Step Functions | --stepfunctions-port | 4606 |
| RDS | --rds-port | 4607 |
| RDS Data | --rds-data-port | 4608 |
| EventBridge Schemas | --schemas-port | 4609 |
| API Gateway control plane | --apigateway-port | 4610 |
| API Gateway v2 control plane | --apigatewayv2-port | 4611 |
| EventBridge Scheduler | --scheduler-port | 4612 |
| EventBridge Pipes | --pipes-port | 4613 |
| SES (v1 query API) | --ses-port | 4614 |
| SESv2 (rest-json) | --sesv2-port | 4615 |
| KMS | --kms-port | 4616 |
| ACM (import path + local CA) | --acm-port | 4617 |
| Cognito Identity | --cognito-identity-port | 4618 |
| X-Ray (intake) | --xray-port | 4619 |
| Timestream write | --timestream-write-port | 4620 |
| Timestream query | --timestream-query-port | 4621 |
| S3 Tables | --s3tables-port | 4622 |
| Route53 (private zones) | --route53-port | 4623 |
| CodeCommit (real git) | --codecommit-port | 4624 |
| ElastiCache (fakeredis data) | --elasticache-port | 4625 |
| MemoryDB (fakeredis data) | --memorydb-port | 4626 |
Two of these defaults — DynamoDB and S3 — are read from a fleet port registry when one is present on the machine, so they may differ from the table. Read the banner, or pass explicit ports; never hard-code 13160/13161 assuming they are universal.
Ephemeral ports
Passing 0 for any port asks the OS for a free one. This is how the test harness runs, and it is what you want in CI or whenever two copies may run at once:
python start.py --dynamodb-port 0 --s3-port 0 ... # etc.
The banner then shows the ports actually bound, not the 0 you passed. A supervisor must parse them from the banner (or from an explicit fixed-port flag it chose); the requested value is not usable from outside.
3a. ACM: issuing against a local CA
RequestCertificate works, but not the way AWS does it. AWS asks a public CA to issue; no client anywhere will trust a certificate minted by a laptop. So Offstack runs a local CA and says so. This is the honest boundary, not a limitation to work around:
RequestCertificatesigns a real certificate with the local CA and returns
Status: ISSUED. There is no DNS/email validation loop — both ends are the same machine, so simulating one would be theatre.
GetCertificatereturns the leaf and the chain; the chain is the CA.GetLocalCaCertificateis an Offstack extension, not an AWS operation.
AWS needs no equivalent because its CA is already in every trust store.
To make TLS actually work, fetch the CA once and point your client at it:
import json, urllib.request
port = 4617 # ACM's port from the startup banner
request = urllib.request.Request(
f"http://127.0.0.1:{port}/",
data=b"{}",
headers={"X-Amz-Target":
"CertificateManager.GetLocalCaCertificate",
"Content-Type": "application/x-amz-json-1.1"},
method="POST")
with urllib.request.urlopen(request) as response:
ca_pem = json.loads(response.read())["CaCertificate"]
open("ca.pem", "w", encoding="ascii").write(ca_pem)
(GetLocalCaCertificate is not in botocore's ACM model — AWS has no such operation — so it goes over raw JSON rather than through boto3.client("acm").)
Then trust it for the process:
export SSL_CERT_FILE=/path/to/ca.pem # POSIX
set SSL_CERT_FILE=C:\path\to\ca.pem # cmd
openssl s_client -connect host:port -CAfile ca.pem verifies against it the same way. A client that trusts only the public roots will reject these certificates — correctly, and by design.
The CA key lives beside the state database (<state dir>/acm-ca/), is unencrypted (an emulator cannot prompt for a passphrase), and must never be installed into a machine-wide trust store. With :memory: state — the test default — the CA is per-process under the OS temp directory, so two runs do not share a signer and no key is written into the source tree. See acm/local_ca.py for the full rationale and for what moto and MiniStack do instead (a twelve-byte fake, and a real certificate with a forged issuer that fails openssl verify).
4. Files it reads
Offstack is started in some directory and reads several files from it. Which one matters for the packaged binary, which resolves them relative to itself.
| Flag | Default | What it is | Read when |
|---|---|---|---|
--s3-data-dir | ./s3_data | Where S3 object bytes live | always (created if absent) |
--lambda-config | <install>/lambda_routes.json | Route table for the API Gateway proxy fallback | at boot, and on change |
--env-file | <install>/env.json | Environment for Lambda handlers | at boot |
--stack-file | ./stacks.json | CloudFormation stack state | at boot |
--state-file | ./offstack_state.db | The shared service database | only with --persist |
| — | ./table_schemas/ | Table schemas, if present | at boot |
Writable working directory. S3 data, the state file and the CloudFormation stack file are written under the current directory by default. A process that runs in a read-only or shared directory will fail, and will do so with a bind or open error rather than a message about the working directory. Give the embedder its own directory, or point --s3-data-dir and --stack-file somewhere writable.
API Gateway data plane & lambda_routes.json
When lambda is enabled, the API Gateway :13000 data plane starts automatically even if lambda_routes.json is absent (serving routes created via the API Gateway v1/v2 control plane --apigateway-port / --apigatewayv2-port). Pass --no-apigw-data-plane if you want to skip binding --lambda-port completely.
--lambda-config (lambda_routes.json) acts as a fallback route table, consulted only when the control plane has no route to deploy. An earlier broken fallback bug from 2026-11-17 is fixed and verified by scripts/verify_packaged_lambda.py. If you rely on file-based fallback routes with no control-plane API calls, verify that case explicitly in your install layout.
env.json
The environment handed to every Lambda handler. A key here reaches the handler as an environment variable. Endpoint variables your handler needs are injected by Offstack already (§5), so env.json is for your configuration only.
5. Pointing your application at it
Option A (Recommended): Unified Gateway (--unified-port 4566) or offstack exec
Start Offstack with --unified-port 4566 (or add --tls for HTTPS on :4567) and set one endpoint variable:
export AWS_ENDPOINT_URL=http://127.0.0.1:4566
export AWS_REGION=us-east-1
export AWS_ACCESS_KEY_ID=local # any non-empty value
export AWS_SECRET_ACCESS_KEY=local
Or wrap your test/app process directly with zero manual env setup:
offstack exec --tls -- pytest tests/
Option B: Direct per-service ports (AWS_ENDPOINT_URL_<SERVICE>)
If you do not use --unified-port and instead talk directly to per-service ports, there is no catch-all across distinct ports: setting AWS_ENDPOINT_URL alone sends every service to whichever single port you named, and every other service answers with a protocol error (measured 2026-11-17 when pointed at DynamoDB's direct port):
dynamodb → OK
s3 → 400 Bad Request
sqs → ValidationException
sns → ResponseParserError
logs → ValidationException
In direct-port mode, each service needs its own variable:
export AWS_REGION=us-east-1
export AWS_ACCESS_KEY_ID=local # any non-empty value
export AWS_SECRET_ACCESS_KEY=local
export AWS_ENDPOINT_URL_DYNAMODB=http://127.0.0.1:13160
export AWS_ENDPOINT_URL_S3=http://127.0.0.1:13161
export AWS_ENDPOINT_URL_SQS=http://127.0.0.1:4596
# ... one per service you use
The variable name is not always the client id. botocore builds it from the service's hyphenized service id, which for most services is the client name but for several is not. The ones that catch people, all verified 2026-11-17 by setting the variable and watching where the call landed:
| Client | Correct variable | Wrong name that silently hits real AWS |
|---|---|---|
boto3.client("events") | AWS_ENDPOINT_URL_EVENTBRIDGE | ..._EVENTS |
boto3.client("logs") | AWS_ENDPOINT_URL_CLOUDWATCH_LOGS | ..._LOGS |
boto3.client("cognito-idp") | AWS_ENDPOINT_URL_COGNITO_IDENTITY_PROVIDER | ..._COGNITO_IDP |
boto3.client("dynamodbstreams") | AWS_ENDPOINT_URL_DYNAMODB_STREAMS | ..._DYNAMODBSTREAMS |
boto3.client("stepfunctions") | AWS_ENDPOINT_URL_SFN | ..._STEPFUNCTIONS |
boto3.client("secretsmanager") | AWS_ENDPOINT_URL_SECRETS_MANAGER | ..._SECRETSMANAGER |
boto3.client("rds-data") | AWS_ENDPOINT_URL_RDS_DATA | ..._RDSDATA |
boto3.client("apigateway") | AWS_ENDPOINT_URL_API_GATEWAY | ..._APIGATEWAY |
A wrong name is not an error — the client goes to real AWS with the credentials in your environment. Measured directly: with only AWS_ENDPOINT_URL_STEPFUNCTIONS set, list_state_machines answered UnrecognizedClientException (i.e. it reached AWS and was rejected); AWS_ENDPOINT_URL_SFN answered from Offstack. So a typo here does not fail loudly — it silently spends on, and depends on, a real account. If a call suddenly needs credentials for an account you did not expect, check the variable name first.
Inside a Lambda handler running under Offstack these variables are already set for you; a handler needs no endpoint configuration at all.
Or pass the endpoint per client, which avoids the question entirely:
import boto3
kw = dict(endpoint_url="http://127.0.0.1:13160", region_name="us-east-1",
aws_access_key_id="local", aws_secret_access_key="local")
dynamodb = boto3.client("dynamodb", **kw)
6. Lifecycle
Starting
Start the process, wait for the banner or poll the ports (§2). The process runs until told to stop.
Readiness
When running with --unified-port (default 4566), Offstack serves built-in observability endpoints alongside API traffic:
GET /healthz→ JSON liveness (status,version,uptime_s,services_enabled).GET /readyz→ JSON readiness running a live database probe (SELECT 1/FROM DUMMY); returns503while draining or if the backing DB is unreachable.GET /metrics→ Prometheus 0.0.4 exposition.
When polling per-service ports without --unified-port, readiness is "the port accepts a TCP connection" — which is also what start.py waits for before printing the startup banner (Press Ctrl+C to stop.).
Stopping
Send SIGINT or SIGTERM, or Ctrl-C in a terminal. start.py catches both, then shuts every service down in order, including the Lambda invoker, which kills the handler worker processes it owns.
On Windows, do not TerminateProcess the simulator. A worker that is kill()ed rather than shut down is orphaned, and orphaned Node Lambda workers are not free: a single abandoned test session left 52 of them holding 2.2 GB, which then starved later runs. This is why the invoker registers an atexit hook and why the packaged binary is two processes (bootstrapper + payload) — taskkill /T on the bootstrapper does not always reach the payload's workers.
If you must kill it hard, kill the whole process tree by PID, and verify no lambda_cold_worker processes remain.
Persistence
By default every store is in memory: stopping the simulator discards all state. For state that survives a restart:
python start.py --persist # ./offstack_state.db
python start.py --persist --state-file /path/to/state.db
OFFSTACK_DATABASE_URL="postgresql+psycopg://user:pass@host/db" \
python start.py --persist
S3 object bytes are on disk in --s3-data-dir regardless; it is the metadata that persistence covers. DATABASES.md covers the SQL backends.
7. The cost simulator & Inspector UI
Offstack can estimate what the traffic it served would cost at AWS list prices and inspect live resource state through the 24-tab offline /_offstack/ Inspector UI (14 core + 10 enterprise tabs when running --unified-port, plus offstack cost snapshot|diff|compare). Metering is off by default and costs one attribute read per request when off.
OFFSTACK_METERING=1 OFFSTACK_DEBUG=1 python start.py --unified-port 4566 ...
offstack cost snapshot --url http://127.0.0.1:4566 --out baseline.json
offstack cost diff baseline.json head.json --fail-over-usd 25
Raw snapshots are served on /_offstack/api/cost (--unified-port) and debug-gated /_ui/cost on S3 (OFFSTACK_DEBUG=1). Pricing happens in the client/CLI using cached AWS Price List data so live request paths never block on the network.
What it can and cannot price, and why, is in COST_REPORT.md. Two properties worth knowing as an embedder:
- **The total is the sum of priced rows only, and the report says when it is
partial.** An operation it saw but could not price is a visible row, never a silent zero.
- A service that recorded nothing is listed as served-but-unmetered, and
that is not the same as free — it means traffic to it is absent from the total. If you embed Offstack in a long-lived process, this is the line to check before trusting a figure.
Storage (S3 and DynamoDB GB-months) is priced from bytes held right now, as one month's rent at today's occupancy, not as a charge accrued since boot.
8. Known gaps
Honest list (updated for v15.0.0):
- Beta builds are unsigned unless signed via Authenticode. Enterprise builds can be signed with
scripts/sign_windows_release.ps1; unsigned developer/beta builds trigger SmartScreen warnings on first run. - No unified full-simulator Python in-process entry point. See §1 (
DynamoDBServercan be imported for DynamoDB-only isolation as in CES/DF3, while multi-service embedding is process embedding). - Use
--unified-port 4566for catch-all routing. Direct per-service ports still require per-serviceAWS_ENDPOINT_URL_<SERVICE>variables (§5). - A fixed port that is already taken fails the whole boot. There is no "try the next free port". Use
--*-port 0with a banner parse, or checknetstatand pick free ports, if the defaults may collide on a busy machine. - API Gateway
:13000boots wheneverlambdais active unless--no-apigw-data-planeis passed.lambda_routes.jsonis the fallback when no control-plane routes exist (§4). - State is in memory unless
--persist. See §6. - RDS and the Lambda worker pool spawn child processes. The simulator owns them; a hard kill can orphan them. See §6.
9. A worked example
A CI job that runs one test file against a throwaway simulator. This is the script that was run to verify this section; it passes.
#!/usr/bin/env bash
set -euo pipefail
work="$(mktemp -d)"
pid=""
trap '[ -n "$pid" ] && kill -TERM "$pid" 2>/dev/null || true' EXIT
python start.py \
--dynamodb-port 0 --s3-port 0 --sqs-port 0 \
--s3-data-dir "$work/s3_data" \
--stack-file "$work/stacks.json" \
> "$work/sim.log" 2>&1 &
pid=$!
# Wait for the banner, not for a number of seconds.
for _ in $(seq 1 120); do
grep -q "Press Ctrl+C to stop" "$work/sim.log" && break
sleep 0.5
done
grep -q "Press Ctrl+C to stop" "$work/sim.log" || {
echo "simulator did not start:"; cat "$work/sim.log"; exit 1; }
# Take the ports the banner reports (the 0s above became ephemeral ones).
# The banner colours the URL with ANSI escapes, so strip them first. A shell
# variable holding a literal ESC is the portable way; `sed 's/\x1b.../'` is not.
ESC=$(printf '\033')
ddb_port=$(sed "s/${ESC}\[[0-9;]*m//g" "$work/sim.log" \
| sed -n 's/^ DynamoDB *: http:\/\/localhost:\([0-9]*\).*/\1/p' | head -1)
s3_port=$(sed "s/${ESC}\[[0-9;]*m//g" "$work/sim.log" \
| sed -n 's/^ S3 *: http:\/\/localhost:\([0-9]*\).*/\1/p' | head -1)
env AWS_ENDPOINT_URL_DYNAMODB="http://127.0.0.1:$ddb_port" \
AWS_ENDPOINT_URL_S3="http://127.0.0.1:$s3_port" \
AWS_REGION=us-east-1 AWS_ACCESS_KEY_ID=local AWS_SECRET_ACCESS_KEY=local \
pytest tests/your_suite.py
Note the three things this does that a naive wrapper gets wrong: it waits for the banner rather than sleeping, it takes the ports from the banner rather than assuming the 0s it passed were kept, and it strips the banner's ANSI colour codes before parsing — the URL is wrapped in escape sequences, so a plain sed match on : http will not cross them.
Want a live walkthrough or evaluation setup for Offstack? Message George Vranjesevic or reach out at george@developmentsnapshot.com.