cloudmock

module
v1.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2026 License: MIT

README

CloudMock

AWS Compatibility Compat Tests CI

ko-fi

Local AWS emulation with built-in observability.

100 AWS services + distributed tracing + error tracking + alerting — in one binary. Language-agnostic via OpenTelemetry.

Quick Start

npx cloudmock
# or
brew install viridian-inc/tap/cloudmock
# or
sudo snap install cloudmock
# or
docker run -p 4566:4566 -p 4500:4500 ghcr.io/viridian-inc/cloudmock:latest

Point your AWS SDK:

export AWS_ENDPOINT_URL=http://localhost:4566

Open DevTools at http://localhost:4500

Why CloudMock?

  • 100 AWS services emulated locally — no AWS account needed
  • Full observability — traces, metrics, logs, and errors in one dashboard
  • Language-agnostic — works with any OpenTelemetry SDK (Go, Python, Java, Node, Rust, ...)
  • Built-in DevTools — topology maps, request tracing, chaos engineering
  • State snapshots — export state to JSON, commit to git, restore on startup — everyone shares the same baseline
  • MIT licensed — free to use, modify, distribute, and embed

Usage

CloudMock is a drop-in replacement for AWS. Point any SDK at localhost:4566:

// Node.js
const client = new S3Client({
  endpoint: "http://localhost:4566",
  region: "us-east-1",
  credentials: { accessKeyId: "test", secretAccessKey: "test" },
  forcePathStyle: true,
});
# Python
s3 = boto3.client("s3", endpoint_url="http://localhost:4566",
    aws_access_key_id="test", aws_secret_access_key="test")
// Go
cfg, _ := config.LoadDefaultConfig(ctx,
    config.WithBaseEndpoint("http://localhost:4566"))

Install

Method Command
npm npx cloudmock
Homebrew brew install viridian-inc/tap/cloudmock
Snap sudo snap install cloudmock
Docker docker run -p 4566:4566 -p 4500:4500 ghcr.io/viridian-inc/cloudmock:latest
apt/deb curl -LO https://github.com/Viridian-Inc/cloudmock/releases/download/v1.5.1/cloudmock_1.5.1_amd64.deb && sudo apt install cloudmock_1.4.0_amd64.deb
Shell curl -fsSL https://cloudmock.app/install.sh | bash

Services

100 AWS services including S3, DynamoDB, SQS, SNS, Lambda, API Gateway, Cognito, EC2, ECS, EKS, EventBridge, IAM, KMS, RDS, Route 53, Step Functions, and many more.

See the full list at cloudmock.app/docs/services.

Performance

CloudMock is the fastest AWS mock available — 249x faster than LocalStack, 143x faster than Moto.

Test Mode

For CI and test suites, test mode strips all observability overhead and uses a Rust-accelerated DynamoDB store. Only the gateway runs — no dashboard, no admin API, no tracing:

CLOUDMOCK_TEST_MODE=true npx cloudmock  # 0.1s startup, 0.009ms per operation
Benchmarks (requests/sec — 200 concurrent, 30s sustained)

Gatling gun tests using hey. All three running on the same machine.

Operation CloudMock Moto LocalStack vs Moto vs LS
DynamoDB GetItem 188,652 849 791 222x 238x
DynamoDB PutItem 178,858 940 742 190x 241x
DynamoDB Query 179,983 721 780 250x 231x
DynamoDB Scan (100 items) 43,395 98 472 442x 92x
SQS SendMessage 186,356 759 1,178 246x 158x
S3 PutObject (1KB) 150,946 806 1,795 187x 84x
S3 GetObject (1KB) 188,223 834 1,240 226x 152x
SNS Publish 177,929 458 1,231 388x 144x
STS GetCallerIdentity 167,015 741 1,229 225x 136x
IAM ListUsers 177,417 717 1,234 247x 144x
EC2 DescribeInstances 176,531 506 1,229 349x 144x
KMS Encrypt 183,387 812 1,168 226x 157x

Geometric mean: CloudMock 163,224 req/s — 250x faster than Moto (654 req/s), 162x faster than LocalStack (1,007 req/s).

In-process mode (Go) — 7,366x faster

Zero network overhead. DynamoDB GetItem at 43ns with zero allocations (frozen JSON cache):

cm := sdk.New()
cfg := cm.Config()
client := dynamodb.NewFromConfig(cfg) // 43ns per GetItem, 0 allocs
Developer Time Saved

How much wait time CloudMock eliminates vs LocalStack (20-25 test runs/day, 6 min saved per run):

Per Day Per Year
1 developer 2.25 hrs saved 562 hrs saved
Team of 10 22.5 hrs 5,625 hrs
Team of 50 112.5 hrs 28,125 hrs

At 0.5ms per operation, tests feel instant. No context switching, no waiting, no tab-switching while your suite runs.

What makes CloudMock fast
  • Frozen JSON cache — items pre-serialized to JSON at write time; reads return cached bytes with zero marshaling (43ns, 0 allocs)
  • Go + fasthttp — native binary, zero-copy request handling, no interpreter overhead
  • Rust-accelerated DynamoDB — hot-path PutItem/GetItem via Rust shared library with serde_json + DashMap
  • Direct partition lookup — O(1) hash key resolution from KeyConditionExpression, limit pushdown to B-tree
  • String-interned keys — sync.Map intern pool eliminates repeat allocations for partition key lookups
  • Pre-serialized XML — all 19 XML services serialize to RawBody at handler level, bypassing gateway marshal
  • goccy/go-json everywhere — 2-3x faster than encoding/json across all 73 JSON services
  • Lock-free SQS — atomic counter UUID/receipt generation, no crypto/rand syscall per message
  • Test mode — fasthttp server, all observability stripped, 100 services pre-resolved into plain map

Full benchmark details and methodology

SDKs

CloudMock provides native SDK adapters for every major language:

Language Package Install
Go github.com/Viridian-Inc/cloudmock/sdk go get (in-process, 20μs/op)
Python cloudmock pip install cloudmock
Node.js @cloudmock/sdk npm install @cloudmock/sdk
Java dev.cloudmock:cloudmock-sdk Maven Central
Kotlin dev.cloudmock:cloudmock-sdk Gradle
Rust cloudmock cargo add cloudmock
C/C++ libcloudmock make (static library)
Ruby cloudmock gem install cloudmock
C#/.NET CloudMock dotnet add package CloudMock
Swift CloudMock Swift Package Manager

Every SDK auto-starts the CloudMock binary, returns pre-configured AWS clients, and cleans up on exit. One line of code to start testing:

# Python
with mock_aws() as cm:
    s3 = cm.boto3_client("s3")
// Node.js
const cm = await mockAWS();
const s3 = new S3Client(cm.clientConfig());
// Java
try (var cm = CloudMock.start()) {
    var s3 = S3Client.builder().endpointOverride(cm.endpoint()).build();
}
// Go (in-process — zero network, 20μs/op)
cm := sdk.New()
s3Client := s3.NewFromConfig(cm.Config())

GitHub Action

One line to add CloudMock to your CI:

- uses: viridian-inc/cloudmock-action@v1

Auto-installs, starts in test mode (135x faster than LocalStack), health-checks, and sets AWS_ENDPOINT_URL for all subsequent steps. Works with Node.js, Python, Go, Java, Rust, and any language with an AWS SDK.

To disable test mode and get full observability in CI:

- uses: viridian-inc/cloudmock-action@v1
  with:
    test-mode: 'false'

Create a Project

npx create-cloudmock-app my-app

Generates a complete project with CloudMock pre-configured for your stack. Supports Node.js, Python, Go, Java, and Rust with S3, DynamoDB, and SQS templates.

Docker Compose Stacks

Eight ready-to-run stacks in docker/stacks/:

Stack What it includes
minimal/ CloudMock only — point any SDK at localhost:4566
serverless/ Express API + DynamoDB + SQS
microservices/ Node.js + Python + Go services via SNS fan-out
data-pipeline/ S3 ingest → SQS → worker → DynamoDB
webapp-postgres/ Node API + Postgres + S3 + SQS
fullstack/ nginx frontend + Node API + DynamoDB
terraform/ CloudMock + Terraform IaC validation
monitoring/ CloudMock + Prometheus + Grafana
cd docker/stacks/minimal
docker compose up

See the Docker Compose guide for quick starts, customization, and how to add your own services.

Switching from LocalStack or Moto?

Traffic Recording & Replay

Record real AWS traffic and replay against CloudMock to validate compatibility:

cloudmock record --output prod-traffic.json    # proxy mode: captures real AWS calls
cloudmock validate --input prod-traffic.json   # replay + compare, exit 0 = all match

CloudTrail Event Replay

Recreate production AWS state from CloudTrail audit logs:

# Export CloudTrail events from AWS
aws cloudtrail lookup-events --start-time 2026-03-01 --output json > trail.json

# Replay write operations against CloudMock
cloudmock cloudtrail replay --input trail.json --endpoint http://localhost:4566

Filter by service, control replay speed, or use the admin API:

cloudmock cloudtrail replay --input trail.json --services dynamodb,s3 --speed 0
curl -X POST http://localhost:4599/api/cloudtrail/replay -d @trail.json

Comparison

Feature CloudMock LocalStack (Free) Moto
AWS services 100 ~25 ~100
Throughput 163,224 req/s 1,007 req/s 654 req/s
Speed multiplier baseline 162x slower 250x slower
Avg latency 1.1ms 170ms 264ms
Test mode (CI) Built-in No No
Distributed tracing Built-in No No
Chaos engineering Built-in Pro only No
DevTools UI Built-in Pro only No
In-process mode Go SDK No Python only
Language Go (single binary) Python Python
License MIT Apache 2.0 Apache 2.0

Documentation

Full docs at cloudmock.app

Community

License

CloudMock is licensed under the MIT License. See LICENSE.

Copyright 2026 Viridian Inc.

Directories

Path Synopsis
benchmarks
cmd/allservices command
allservices benchmarks every registered CloudMock service by sending a simple "list" request to each one and measuring throughput + latency.
allservices benchmarks every registered CloudMock service by sending a simple "list" request to each one and measuring throughput + latency.
cmd/bench command
cmd/guntest command
guntest sends raw HTTP/1.1 requests over TCP or Unix sockets.
guntest sends raw HTTP/1.1 requests over TCP or Unix sockets.
compat/cmd command
cmd
cloudmock command
cmk command
configimport command
gateway command
Package main is the CloudMock service code generator.
Package main is the CloudMock service code generator.
custodian
scanner command
Package main implements the cloudmock-compliance CLI tool.
Package main implements the cloudmock-compliance CLI tool.
npm
pkg
admin
DynamoStore provides DynamoDB-backed persistence for admin API state (dashboards, saved views, deploy events) as an alternative to file-backed persistence via SetPersistDir.
DynamoStore provides DynamoDB-backed persistence for admin API state (dashboards, saved views, deploy events) as an alternative to file-backed persistence via SetPersistDir.
audit/dynamostore
Package dynamostore implements audit.Logger backed by DynamoDB via the generic dynamostore package.
Package dynamostore implements audit.Logger backed by DynamoDB via the generic dynamostore package.
auth/dynamostore
Package dynamostore implements auth.UserStore backed by DynamoDB via the generic dynamostore package.
Package dynamostore implements auth.UserStore backed by DynamoDB via the generic dynamostore package.
awsendpoints
Package awsendpoints resolves AWS service names to their real public hostnames and extracts service/action identifiers from incoming AWS SDK requests.
Package awsendpoints resolves AWS service names to their real public hostnames and extracts service/action identifiers from incoming AWS SDK requests.
cicd/filestore
Package filestore implements cicd.Store backed by JSON files on disk.
Package filestore implements cicd.Store backed by JSON files on disk.
cloudtrail
Package cloudtrail provides CloudTrail event parsing, conversion, and replay for recreating AWS resource state from audit logs.
Package cloudtrail provides CloudTrail event parsing, conversion, and replay for recreating AWS resource state from audit logs.
dashboard
Package dashboard provides a single-page web dashboard for cloudmock, served on the dashboard port and talking to the admin API.
Package dashboard provides a single-page web dashboard for cloudmock, served on the dashboard port and talking to the admin API.
dns
Package dns provides a minimal UDP DNS server that resolves a configured domain (and any subdomain of it) to 127.0.0.1.
Package dns provides a minimal UDP DNS server that resolves a configured domain (and any subdomain of it) to 127.0.0.1.
dynamostore
Package dynamostore provides a generic single-table DynamoDB store with tenant isolation via partition key prefix.
Package dynamostore provides a generic single-table DynamoDB store with tenant isolation via partition key prefix.
edge
Package edge holds the L7 reverse proxy and TLS-cert plumbing that fronts CloudMock and any local dev services for the iPad / tailnet workflow.
Package edge holds the L7 reverse proxy and TLS-cert plumbing that fronts CloudMock and any local dev services for the iPad / tailnet workflow.
errors/filestore
Package filestore implements errors.ErrorStore backed by JSON files on disk.
Package filestore implements errors.ErrorStore backed by JSON files on disk.
filestore
Package filestore provides a generic JSON file-backed store.
Package filestore provides a generic JSON file-backed store.
iac
Package iac extracts resource definitions from Infrastructure-as-Code sources (Pulumi TypeScript, Terraform HCL) and provisions them in CloudMock.
Package iac extracts resource definitions from Infrastructure-as-Code sources (Pulumi TypeScript, Terraform HCL) and provisions them in CloudMock.
iam
incident/dynamostore
Package dynamostore implements incident.IncidentStore backed by DynamoDB via the generic dynamostore package.
Package dynamostore implements incident.IncidentStore backed by DynamoDB via the generic dynamostore package.
incident/filestore
Package filestore implements incident.IncidentStore backed by JSON files.
Package filestore implements incident.IncidentStore backed by JSON files.
integration
Package integration wires cross-service integrations within cloudmock.
Package integration wires cross-service integrations within cloudmock.
lifecycle
Package lifecycle provides a configurable state machine for AWS resource lifecycle transitions.
Package lifecycle provides a configurable state machine for AWS resource lifecycle transitions.
logstore/filestore
Package filestore implements logstore.LogStore by wrapping the in-memory store with file-backed persistence.
Package filestore implements logstore.LogStore by wrapping the in-memory store with file-backed persistence.
marketplace
Package marketplace provides a plugin marketplace registry for CloudMock.
Package marketplace provides a plugin marketplace registry for CloudMock.
mocklog
Package mocklog provides a shared log writer that services use to write mock execution logs to CloudWatch Logs via the ServiceLocator.
Package mocklog provides a shared log writer that services use to write mock execution logs to CloudWatch Logs via the ServiceLocator.
monitor/dynamostore
Package dynamostore implements monitor.MonitorStore and monitor.AlertStore backed by DynamoDB via the generic dynamostore package.
Package dynamostore implements monitor.MonitorStore and monitor.AlertStore backed by DynamoDB via the generic dynamostore package.
monitor/filestore
Package filestore implements monitor.MonitorStore and monitor.AlertStore backed by JSON files on disk via the generic filestore package.
Package filestore implements monitor.MonitorStore and monitor.AlertStore backed by JSON files on disk via the generic filestore package.
nlq
Package nlq provides natural language query parsing for CloudMock.
Package nlq provides natural language query parsing for CloudMock.
observability
Package observability holds the cross-cutting request-log, stats, and distributed-tracing primitives used by the AWS gateway, the reverse proxy, the admin API, and the dataplane.
Package observability holds the cross-cutting request-log, stats, and distributed-tracing primitives used by the AWS gateway, the reverse proxy, the admin API, and the dataplane.
observability/traceid
Package traceid provides lightweight unique ID generation for distributed tracing.
Package traceid provides lightweight unique ID generation for distributed tracing.
plugin
Package plugin defines the CloudMock plugin system.
Package plugin defines the CloudMock plugin system.
proxy
Package proxy provides a reverse proxy that captures real AWS traffic for later replay against CloudMock.
Package proxy provides a reverse proxy that captures real AWS traffic for later replay against CloudMock.
regression/dynamostore
Package dynamostore implements regression.RegressionStore backed by DynamoDB via the generic dynamostore package.
Package dynamostore implements regression.RegressionStore backed by DynamoDB via the generic dynamostore package.
replay/filestore
Package filestore implements replay.Store backed by JSON files on disk.
Package filestore implements replay.Store backed by JSON files on disk.
rum
rum/dynamostore
Package dynamostore implements rum.RUMStore backed by DynamoDB via the generic dynamostore package.
Package dynamostore implements rum.RUMStore backed by DynamoDB via the generic dynamostore package.
rum/filestore
Package filestore implements rum.RUMStore by wrapping the in-memory store with file-backed persistence.
Package filestore implements rum.RUMStore by wrapping the in-memory store with file-backed persistence.
saas/clerk
Package clerk handles Clerk webhook events and JWT verification for the hosted SaaS tier.
Package clerk handles Clerk webhook events and JWT verification for the hosted SaaS tier.
saas/provisioning
Package provisioning implements Fly Machines and Cloudflare DNS integration for per-tenant cloudmock instance management.
Package provisioning implements Fly Machines and Cloudflare DNS integration for per-tenant cloudmock instance management.
saas/quota
Package quota provides HTTP middleware that enforces per-tenant request quotas for the hosted SaaS tier.
Package quota provides HTTP middleware that enforces per-tenant request quotas for the hosted SaaS tier.
saas/stripe
Package stripe handles Stripe webhook events and usage metering for the hosted SaaS tier.
Package stripe handles Stripe webhook events and usage metering for the hosted SaaS tier.
saas/tenant/dynamostore
Package dynamostore implements tenant.Store backed by DynamoDB via the generic dynamostore package.
Package dynamostore implements tenant.Store backed by DynamoDB via the generic dynamostore package.
scm
security
Package security provides security posture scanning for CloudMock environments.
Package security provides security posture scanning for CloudMock environments.
sqlparse
Package sqlparse provides a lightweight SQL validator for Athena and Redshift.
Package sqlparse provides a lightweight SQL validator for Athena and Redshift.
synthetics
Package synthetics provides synthetic HTTP test execution and assertion evaluation.
Package synthetics provides synthetic HTTP test execution and assertion evaluation.
tenantscope
Package tenantscope provides wrapper implementations of TraceReader and RequestReader that enforce tenant-level visibility boundaries.
Package tenantscope provides wrapper implementations of TraceReader and RequestReader that enforce tenant-level visibility boundaries.
testutil
Package testutil provides shared test utilities for CloudMock service tests.
Package testutil provides shared test utilities for CloudMock service tests.
traffic/dynamostore
Package dynamostore implements traffic.RecordingStore backed by DynamoDB via the generic dynamostore package.
Package dynamostore implements traffic.RecordingStore backed by DynamoDB via the generic dynamostore package.
traffic/filestore
Package filestore persists traffic recordings and replay runs as JSON files on disk.
Package filestore persists traffic recordings and replay runs as JSON files on disk.
uptime/filestore
Package filestore implements uptime.Store backed by JSON files on disk.
Package filestore implements uptime.Store backed by JSON files on disk.
webhook/dynamostore
Package dynamostore implements webhook.Store backed by DynamoDB via the generic dynamostore package.
Package dynamostore implements webhook.Store backed by DynamoDB via the generic dynamostore package.
worker
Package worker provides a background worker pool for services that need periodic or deferred work (health checks, capacity reconciliation, event firing).
Package worker provides a background worker pool for services that need periodic or deferred work (health checks, capacity reconciliation, event firing).
plugins
example/cmd command
Example CloudMock plugin that demonstrates the plugin interface.
Example CloudMock plugin that demonstrates the plugin interface.
providers
crossplane/cmd/provider command
Command provider is the cloudmock Crossplane provider controller-manager.
Command provider is the cloudmock Crossplane provider controller-manager.
crossplane/internal
Package internal implements CRD generation and reconciliation for the native Crossplane provider for cloudmock.
Package internal implements CRD generation and reconciliation for the native Crossplane provider for cloudmock.
pulumi
Package pulumi provides the tfbridge configuration for the cloudmock Pulumi provider.
Package pulumi provides the tfbridge configuration for the cloudmock Pulumi provider.
pulumi/cmd/pulumi-resource-cloudmock command
Package main is the entrypoint for the Pulumi cloudmock resource provider.
Package main is the entrypoint for the Pulumi cloudmock resource provider.
pulumi/internal
Package internal implements a native Pulumi provider for cloudmock using the gRPC resource provider protocol.
Package internal implements a native Pulumi provider for cloudmock using the gRPC resource provider protocol.
terraform command
sdk
Package sdk provides an in-process AWS mock that routes AWS SDK v2 calls directly to CloudMock's gateway handler without any HTTP/TCP overhead.
Package sdk provides an in-process AWS mock that routes AWS SDK v2 calls directly to CloudMock's gateway handler without any HTTP/TCP overhead.
go
Package sdk provides helpers for building CloudMock plugins in Go.
Package sdk provides helpers for building CloudMock plugins in Go.
services
acm
ce
cloud-ingest/internal/ingest
Package ingest provides HTTP handlers for receiving trace spans.
Package ingest provides HTTP handlers for receiving trace spans.
cloud-ingest/internal/query
Package query provides HTTP handlers for reading stored spans and metrics.
Package query provides HTTP handlers for reading stored spans and metrics.
dax
dms
ec2
ecr
ecs
efs
eks
es
fis
iam
iot
kms
mq
ram
rds
s3
s3/cmd command
ses
sns
sqs
ssm
sts
swf
tools
cloudmock-aws command
cloudmock-cdk command
cloudmock-ci command
cloudmock-dns command
cloudmock-sam command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL