Skip to content

Configuration

CloudMock is configured via a YAML file (default: cloudmock.yml in the working directory) with environment variable overrides applied on top.

# AWS region to emulate
region: us-east-1
# Simulated AWS account ID (12 digits)
account_id: "000000000000"
# Service profile: minimal | standard | full | custom
# Controls which AWS services are started. See "Service Profiles" below.
profile: minimal
iam:
# IAM enforcement mode: enforce | authenticate | none
mode: enforce
# Root credentials accepted by all modes except "none"
root_access_key: test
root_secret_key: test
# Optional path to a JSON file for seeding IAM users, roles, and policies
# seed_file: /etc/cloudmock/iam-seed.json
persistence:
# Persist in-memory state to disk on shutdown and restore on startup
enabled: false
# Directory for state snapshots (created if it does not exist)
# path: /var/lib/cloudmock/data
gateway:
# Port for the main AWS API endpoint
port: 4566
dashboard:
# Web UI for inspecting service state
enabled: true
port: 4500
admin:
# Control-plane REST API (used by the cloudmock CLI and devtools)
port: 4599
logging:
# Log level: debug | info | warn | error
level: info
# Log format: text (human-readable) | json (structured)
format: text
# Per-service overrides -- used with profile: custom, or to change defaults
# for a specific service while using another profile.
#
# services:
# s3:
# enabled: true
# lambda:
# enabled: true
# runtimes:
# - nodejs20.x
# - python3.12
# dynamodb:
# enabled: false # disable one service from a named profile

Profiles control which AWS services start with the gateway. Choose a profile based on how many services your application uses.

Starts the smallest useful set of services (8 services):

iam, sts, s3, dynamodb, sqs, sns, lambda, cloudwatch-logs

Suitable for applications that use only core compute and storage services. This is the default.

Starts all commonly used production services (20 services):

iam, sts, s3, dynamodb, sqs, sns, lambda, cloudwatch-logs,
rds, cloudformation, ec2, ecr, ecs, secretsmanager, ssm,
kinesis, firehose, events, stepfunctions, apigateway

Starts all 98 supported services, including all Tier 2 CRUD stubs. Use this when your application depends on less common services, or when you want full coverage without listing services individually.

Only the services explicitly listed under the services key are started:

profile: custom
services:
s3:
enabled: true
dynamodb:
enabled: true
sqs:
enabled: true

You can also use the CLOUDMOCK_SERVICES environment variable for a quick override without editing the config file:

Terminal window
CLOUDMOCK_SERVICES=s3,dynamodb,sqs cloudmock start

You can override individual services while using a named profile. For example, to use the standard profile but disable EC2:

profile: standard
services:
ec2:
enabled: false

Or to add a service not included in the profile:

profile: minimal
services:
cognito-idp:
enabled: true

CloudMock uses three ports:

PortConfig keyEnv varDescription
4566gateway.portCLOUDMOCK_GATEWAY_PORTMain AWS API endpoint. All AWS SDK/CLI traffic goes here.
4500dashboard.portCLOUDMOCK_DASHBOARD_PORTDevtools web UI. Open in a browser to access the dashboard.
4599admin.portCLOUDMOCK_ADMIN_PORTAdmin/control-plane API. Used by the cloudmock CLI and devtools.

All three ports are configurable. The dashboard can be disabled entirely:

dashboard:
enabled: false

By default, all state is held in memory. It is fast and requires no setup, but all data is lost when the process exits.

When persistence.enabled: true, CloudMock writes a state snapshot to persistence.path on clean shutdown and restores it on startup. The snapshot format is an internal JSON representation of each service’s in-memory store.

persistence:
enabled: true
path: /var/lib/cloudmock/data

State is not automatically synced during operation — only on shutdown. If the process is killed without a clean shutdown, the previous snapshot is loaded.

For durable analytical storage, enable production data plane mode with DuckDB. DuckDB is an embedded columnar database that stores requests, traces, SLO windows, regressions, and incidents in a single file.

dataplane:
mode: production
duckdb_path: cloudmock.duckdb

Or via environment variable:

Terminal window
CLOUDMOCK_DATAPLANE_MODE=production
CLOUDMOCK_DUCKDB_PATH=./data/cloudmock.duckdb

For multi-user and team environments, production mode supports PostgreSQL for configuration and operational data (users, webhooks, saved views, deploy events, preferences, audit log).

dataplane:
mode: production
postgresql_url: postgres://user:pass@localhost:5432/cloudmock

Or via environment variable:

Terminal window
CLOUDMOCK_POSTGRESQL_URL=postgres://user:pass@localhost:5432/cloudmock

For time-series metrics, production mode can read from a Prometheus instance for the metrics timeline API.

Terminal window
CLOUDMOCK_PROMETHEUS_URL=http://localhost:9090

For exporting telemetry, production mode can forward traces, metrics, and logs to an OTel Collector.

Terminal window
CLOUDMOCK_OTEL_ENDPOINT=localhost:4317
BackendStoresRequired
DuckDBRequests, traces, SLO windows, regressions, incidentsNo — falls back to in-memory
PostgreSQLUsers, webhooks, saved views, deploy events, preferences, audit logNo — falls back to in-memory
PrometheusMetrics time seriesNo — metrics computed from traces
OTel CollectorTrace/metric/log exportNo — telemetry stays local

You can enable production mode with any subset of backends. Unconfigured backends fall back to in-memory storage.

Requests must include valid AWS Signature V4 credentials. The IAM engine evaluates every request against attached policies. Requests without an explicit Allow are denied.

This mode is suitable for testing IAM policies and reproducing permission errors locally.

Credentials are validated (the access key must exist in the store) but policy evaluation is skipped. All authenticated requests succeed.

This mode is useful when you want to verify that your application sends valid credentials without dealing with policy configuration.

All authentication and authorization checks are bypassed. Any request is accepted regardless of credentials. Useful for rapid prototyping, but not safe for multi-user environments.

The root_access_key and root_secret_key values define a superuser credential that bypasses all policy checks (in enforce and authenticate modes). The defaults are both test, matching the convention used by other AWS emulators.

If iam.seed_file is set, CloudMock loads users, access keys, and policies from a JSON file at startup:

{
"users": [
{
"name": "ci-user",
"access_key_id": "AKIAIOSFODNN7EXAMPLE",
"secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
"policies": [
{
"name": "AllowS3",
"document": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["s3:*"],
"Resource": "*"
}
]
}
}
]
}
]
}

All environment variables override the corresponding value in cloudmock.yml.

VariableDescriptionDefault
CLOUDMOCK_GATEWAY_PORTGateway HTTP port4566
CLOUDMOCK_ADMIN_PORTAdmin API port4599
CLOUDMOCK_DASHBOARD_PORTDashboard port4500
CLOUDMOCK_DATAPLANE_MODEStorage mode (local / production)local
CLOUDMOCK_DUCKDB_PATHDuckDB file pathcloudmock.duckdb
CLOUDMOCK_POSTGRESQL_URLPostgreSQL connection URL
CLOUDMOCK_PROMETHEUS_URLPrometheus URL
CLOUDMOCK_OTEL_ENDPOINTOTel Collector endpoint
CLOUDMOCK_LOG_FORMATLog format (text / json)text
CLOUDMOCK_LOG_LEVELLog level (debug / info / warn / error)info
CLOUDMOCK_REGIONAWS region to emulateus-east-1
CLOUDMOCK_IAM_MODEIAM mode (enforce / authenticate / none)none
CLOUDMOCK_PERSISTEnable persistence (true / false)false
CLOUDMOCK_PERSIST_PATHDirectory for state snapshots
CLOUDMOCK_SERVICESComma-separated list of services to enable
CLOUDMOCK_PROFILEService profile (overrides config file)
CLOUDMOCK_ADMIN_ADDRAddress the CLI uses to reach the admin APIhttp://localhost:4599
Terminal window
CLOUDMOCK_REGION=eu-west-1 \
CLOUDMOCK_IAM_MODE=none \
CLOUDMOCK_LOG_LEVEL=debug \
./bin/cloudmock start

Human-readable output for terminal use:

2026-03-21 12:00:00 INFO s3 PutObject 200 1ms

Structured output for log aggregation systems:

{"time":"2026-03-21T12:00:00Z","level":"INFO","msg":"request","service":"s3","action":"PutObject","status":200,"duration_ms":1}

Configure with:

logging:
level: debug
format: json

CloudMock looks for cloudmock.yml in the following order:

  1. Path specified by -config flag: cloudmock start -config /etc/cloudmock/prod.yml
  2. cloudmock.yml in the current working directory
  3. Built-in defaults (minimal profile, enforce IAM, ports 4566/4500/4599)