gopherstack

command module
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 219 Imported by: 0

README

Gopherstack

150+ AWS services. One Go binary. Milliseconds, not minutes.

CI Release codecov CodeFactor OpenSSF Scorecard Go Reference

AWS operations AWS services parity go license

Gopherstack is a lightweight, in-memory AWS cloud stack you can run locally. It emulates 150+ AWS service APIs in a single Go binary — no AWS account, no credentials, no network calls — so you can develop and test against realistic AWS behaviour in milliseconds.

Point any AWS SDK, the AWS CLI, Terraform, or the CDK at http://localhost:8000 and it just works. Beyond simple CRUD mocks, Gopherstack implements real cross-service integration: Event Source Mappings, EventBridge Scheduler, EventBridge Pipes, DynamoDB Streams → Lambda, SNS → SQS fan-out, and container-backed Lambda execution.

[!TIP] Gopherstack is significantly faster and lighter than LocalStack, making it ideal for unit and integration tests where speed is critical.

[!IMPORTANT] This project is vibe coded. 🚀 It's built for speed, performance, and developer experience.


Quick Start

Pull and run the image:

docker run -p 8000:8000 ghcr.io/blackbirdworks/gopherstack:latest

Open the built-in web dashboard:

http://localhost:8000/dashboard

Then point any AWS tooling at the endpoint — no credentials required:

aws dynamodb list-tables --endpoint-url http://localhost:8000
aws s3 mb s3://my-bucket --endpoint-url http://localhost:8000

Installation

Docker

docker pull ghcr.io/blackbirdworks/gopherstack:latest
docker run -p 8000:8000 ghcr.io/blackbirdworks/gopherstack:latest

The API and the dashboard are both served on port 8000.

Docker Compose

services:
  gopherstack:
    image: ghcr.io/blackbirdworks/gopherstack:latest
    ports:
      - "8000:8000"
    environment:
      - LOG_LEVEL=info
docker compose up -d

For Lambda support the container needs access to a container runtime — see docs/docker.md.

Testcontainers (Go)

Gopherstack ships a reusable Testcontainers for Go module so you can spin up the whole stack from any Go test suite:

go get github.com/blackbirdworks/gopherstack/modules/gopherstack
import (
    "context"
    "testing"

    "github.com/aws/aws-sdk-go-v2/aws"
    "github.com/aws/aws-sdk-go-v2/config"
    "github.com/aws/aws-sdk-go-v2/credentials"
    "github.com/aws/aws-sdk-go-v2/service/dynamodb"
    "github.com/testcontainers/testcontainers-go"

    gopherstack "github.com/blackbirdworks/gopherstack/modules/gopherstack"
)

func TestMyService(t *testing.T) {
    ctx := context.Background()

    container, err := gopherstack.Run(ctx, gopherstack.DefaultImage)
    if err != nil {
        t.Fatal(err)
    }
    defer testcontainers.TerminateContainer(container)

    endpoint, err := container.BaseURL(ctx)
    if err != nil {
        t.Fatal(err)
    }

    cfg, _ := config.LoadDefaultConfig(ctx,
        config.WithRegion("us-east-1"),
        config.WithCredentialsProvider(
            credentials.NewStaticCredentialsProvider("test", "test", ""),
        ),
    )

    ddb := dynamodb.NewFromConfig(cfg, func(o *dynamodb.Options) {
        o.BaseEndpoint = aws.String(endpoint)
    })

    // … use ddb in your tests
}

Pass environment variables with gopherstack.WithEnv:

container, err := gopherstack.Run(ctx, gopherstack.DefaultImage,
    gopherstack.WithEnv(map[string]string{
        "LOG_LEVEL": "debug",
        "DEMO":      "true",
    }),
)

As a Go library

Use the in-memory backends directly, without any HTTP server:

import "github.com/blackbirdworks/gopherstack/services/dynamodb"

db := dynamodb.NewInMemoryDB()
// Use db for your application logic…

From source

git clone https://github.com/blackbirdworks/gopherstack.git
cd gopherstack
go run .            # serves on :8000

Features

Web Dashboard

A built-in UI at http://localhost:8000/dashboard for inspecting and managing local state:

  • DynamoDB — list tables, view details (keys, indexes, item count), run Query and Scan, create tables
  • S3 — list buckets, browse files with folder support, upload/download, manage versioning, view object metadata

Configuration

Every setting has a CLI flag and (usually) an equivalent env var; a flag always wins. When --persist is enabled, values loaded from the persisted config file sit between the two: precedence is defaults < persisted config < env vars / CLI flags.

Server
Flag Env var Default Description
--port PORT 8000 HTTP server port.
--region REGION us-east-1 Mock AWS region (also honors AWS_REGION / AWS_DEFAULT_REGION, see below).
--log-level LOG_LEVEL info Log level: debug, info, warn, or error.
--data-dir GOPHERSTACK_DATA_DIR (empty) Directory for persistence data files. Empty resolves to ~/.gopherstack/data, or /data inside a container.
--account-id ACCOUNT_ID 000000000000 Mock AWS account ID used in ARNs.
--persist PERSIST false Enable snapshot-based persistence across restarts.
--demo DEMO false Load demo data on startup.
--enforce-iam GOPHERSTACK_ENFORCE_IAM false Evaluate every request against attached IAM policies.
--tls TLS false Serve over HTTPS (self-signed certificate unless --tls-cert/--tls-key are set).
--tls-cert TLS_CERT (empty) Path to a TLS certificate (PEM). Requires --tls-key.
--tls-key TLS_KEY (empty) Path to a TLS private key (PEM).
--validate-sigv4 VALIDATE_SIGV4 false Cryptographically validate AWS SigV4 request signatures (opt-in).
--sigv4-secret SIGV4_SECRET test Secret access key SigV4 validation signs against (only used with --validate-sigv4).
--dns-addr DNS_ADDR (empty) Address for the embedded DNS server (e.g. :10053). Empty disables it.
--dns-resolve-ip DNS_RESOLVE_IP 127.0.0.1 IP address synthetic hostnames resolve to.
--port-range-start PORT_RANGE_START 10000 Start of the port range used for allocated resource endpoints.
--port-range-end PORT_RANGE_END 10100 End (exclusive) of that port range.
--init-script INIT_SCRIPTS (none) Shell script(s) to run on startup (repeatable flag / comma-separated env var).
--init-timeout INIT_TIMEOUT 30s Per-script timeout for init hooks.
--s3-bucket S3_BUCKETS (none) S3 bucket(s) to create on startup (repeatable flag / comma-separated env var).
--janitor-timeout JANITOR_TIMEOUT 30s Per-task timeout for the global janitor loop (TTL sweeps, cleaners). 0 disables it.
--latency-ms LATENCY_MS 0 Inject random latency [0,N) ms per request. 0 disables it.
--auto-purge-ttl AUTO_PURGE_TTL (disabled) If set, automatically reset all services on a timer (e.g. 10m).
(none) GOPHERSTACK_PPROF_ADDR (empty) Opt-in pprof debug address (e.g. localhost:6060) for local profiling / PGO capture. Off unless set; never enable in shared environments.
AWS credentials & region overrides

Gopherstack's own AWS SDK clients read a few standard AWS environment variables, so tooling that already exports them (e.g. awslocal) works without remapping. These are not flags.

Env var Default Description
AWS_DEFAULT_REGION (unset) Highest-precedence region override — wins over AWS_REGION and --region/REGION.
AWS_REGION (unset) Region override — wins over --region/REGION but loses to AWS_DEFAULT_REGION.
AWS_ACCESS_KEY_ID dummy Used for Gopherstack's own internal AWS SDK clients. Incoming request credentials are never validated.
AWS_SECRET_ACCESS_KEY dummy Paired with AWS_ACCESS_KEY_ID for Gopherstack's internal SDK clients. Incoming request credentials are never validated.
Per-service engine & provider selection
Flag Env var Default Description
--elasticache-engine ELASTICACHE_ENGINE embedded ElastiCache engine mode: embedded (miniredis), stub, or docker.
--opensearch-engine OPENSEARCH_ENGINE stub OpenSearch engine mode: stub (API-only) or docker.
--elasticsearch-engine ELASTICSEARCH_ENGINE stub Elasticsearch engine mode: stub (API-only) or docker.
--ec2-provider EC2_PROVIDER inmemory EC2 compute provider: inmemory (stub) or docker (launches real containers as instances).
--ec2-docker-image EC2_DOCKER_IMAGE amazonlinux:2 Docker image used by the EC2 docker provider.
--ec2-docker-network EC2_DOCKER_NETWORK (empty) Docker network EC2-docker containers attach to. Empty uses the daemon default bridge.
--ec2-docker-ssh-host-ip EC2_DOCKER_SSH_HOST_IP 127.0.0.1 Host IP that mapped EC2-docker SSH ports bind to.
--ec2-docker-ssh-port-min EC2_DOCKER_SSH_PORT_MIN 0 Lower bound of the host port range for EC2-docker SSH mapping (0 = let Docker pick).
--ec2-docker-ssh-port-max EC2_DOCKER_SSH_PORT_MAX 0 Upper bound of that host port range.
Lambda & containers

The core Lambda/container-runtime flags — LAMBDA_DOCKER_HOST, LAMBDA_POOL_SIZE, LAMBDA_IDLE_TIMEOUT, CONTAINER_RUNTIME — are documented in Lambda configuration below. A few more exist:

Flag Env var Default Description
--lambda-max-runtimes LAMBDA_MAX_RUNTIMES 50 Maximum number of simultaneous per-function Lambda runtimes.
--lambda-keep-containers LAMBDA_KEEP_CONTAINERS false If true, keep Lambda containers alive for debugging.
(none) CONTAINER_HOST (empty) Generic container endpoint override (e.g. a Podman socket URL). Takes precedence over runtime auto-detection.
(none) GOPHERSTACK_ECS_RUNTIME (unset = no-op) Set to docker to run ECS tasks as real containers. Unset or any other value is a no-op runner.
(none) GOPHERSTACK_ENABLE_LOCAL_REGISTRY false (set to 1 to enable) Run a real embedded Docker Registry v2 backend for ECR instead of the in-memory stub.
Per-service tuning (janitor intervals & TTLs)

Most services expose a background "janitor" tick interval and TTLs for evicting stale data. These have CLI flags too (run gopherstack serve --help for exact names) but are most commonly set via env var:

Env var Default Description
ATHENA_JANITOR_INTERVAL 1m Athena janitor tick interval.
ATHENA_EXECUTION_TTL 24h TTL for completed Athena query executions.
BACKUP_JANITOR_INTERVAL 1m Backup janitor tick interval.
BACKUP_JOB_TTL 24h TTL for completed Backup jobs.
BATCH_JANITOR_INTERVAL 1m Batch janitor tick interval.
BATCH_INACTIVE_JOB_DEF_TTL 24h TTL for inactive Batch job definitions.
BATCH_COMPLETED_JOB_TTL 24h TTL for completed or failed Batch jobs.
CLOUDWATCHLOGS_JANITOR_INTERVAL 1m CloudWatch Logs janitor tick interval.
CLOUDWATCHLOGS_MAX_RETENTION_DAYS 14 Global max log retention for groups without an explicit policy.
CODEBUILD_JANITOR_INTERVAL 1m CodeBuild janitor tick interval.
CODEBUILD_BUILD_TTL 24h TTL for completed CodeBuild builds.
DYNAMODB_REGION us-east-1 Default region for DynamoDB (independent of --region).
DYNAMODB_JANITOR_INTERVAL 500ms DynamoDB janitor tick interval.
DYNAMODB_TTL_SWEEP_BATCH_SIZE 1000 Max items checked per TTL sweep lock acquisition.
DYNAMODB_CREATE_DELAY 0s Simulated CREATING→ACTIVE delay. 0 disables the lifecycle transition.
DYNAMODB_ENFORCE_THROUGHPUT false Enforce provisioned RCU/WCU limits (token bucket per table).
EC2_JANITOR_INTERVAL 1m EC2 janitor tick interval.
EC2_TERMINATED_TTL 1h TTL for terminated EC2 instances.
EC2_CANCELLED_SPOT_TTL 6h TTL for cancelled EC2 spot requests.
EMR_JANITOR_INTERVAL 1m EMR janitor tick interval.
EMR_TERMINATED_TTL 1h TTL for terminated EMR clusters.
FIS_JANITOR_INTERVAL 1m FIS janitor tick interval.
FIS_EXPERIMENT_TTL 24h TTL for completed FIS experiments.
KINESIS_JANITOR_INTERVAL 1m Kinesis janitor tick interval.
KMS_JANITOR_INTERVAL 1m KMS janitor tick interval.
REDSHIFTDATA_JANITOR_INTERVAL 1m Redshift Data janitor tick interval.
REDSHIFTDATA_STATEMENT_TTL 24h TTL for completed Redshift Data statements.
S3_REGION us-east-1 Default region for S3 (independent of --region).
S3_JANITOR_INTERVAL 500ms S3 janitor tick interval.
S3_COMPRESSION_MIN_BYTES 1024 Minimum object size for gzip compression. 0 compresses everything.
SES_JANITOR_INTERVAL 1m SES janitor tick interval.
SES_EMAIL_TTL 24h TTL for stored sent emails.
SFN_EXECUTION_RETENTION 24h How long Step Functions execution history is retained.
SFN_JANITOR_INTERVAL 1m Step Functions janitor tick interval.
SFN_TASK_TOKEN_TTL 1h Max lifetime of an unreceived Step Functions task token.
SSM_JANITOR_INTERVAL 30s SSM janitor tick interval.
SSM_COMMAND_TTL 1h TTL for SendCommand results (matches AWS's 1h default).
STS_JANITOR_INTERVAL 30s STS janitor tick interval.
XRAY_JANITOR_INTERVAL 1m X-Ray janitor tick interval.
XRAY_TRACE_TTL 30m TTL for stored X-Ray traces.

DynamoDB

  • In-memory storage — blazing fast tables and items
  • Secondary indexes — full Global (GSI) and Local (LSI) secondary index support
  • Rich querying — sort-key conditions, pagination (Limit, ExclusiveStartKey), ordering
  • Efficient scanning — filtering and projection with DynamoDB expressions
  • Expression support — expression attribute values and names
  • Streams — change capture that can drive Lambda via Event Source Mappings

S3

  • Bucket management — full lifecycle for versioned and unversioned buckets
  • Object operations — Get, Put, Head, List, multipart uploads
  • Versioning & tagging — first-class object versioning and metadata tagging
  • Data integrity — automatic checksums (CRC32, CRC32C, SHA1, SHA256)
  • Compression — integrated gzip compression for efficient memory usage

Lambda (Zip and Image packaging)

Gopherstack runs real Lambda functions in containers, supporting both Zip (PackageType: Zip) and container image (PackageType: Image) packaging.

  • Zip functions — the archive is extracted and run on the matching AWS runtime base image, so standard managed runtimes work unmodified: python3.9python3.13, nodejs18.x/20.x/22.x, java11/17/21, dotnet8/dotnet9, ruby3.2/3.3, and provided.al2/provided.al2023
  • Image functions — provide an ImageUri (an AWS base image or your own)
  • Lambda Runtime API — full implementation, so standard AWS base images work as-is
  • Invocation modesRequestResponse (sync) and Event (async / fire-and-forget)
  • Warm container pool — configurable per-function pool to cut cold starts
  • Reserved concurrency — enforced for both sync and async calls
  • Async realism — AWS-realistic retry semantics and dead-letter queues (via SNS/SQS)
  • Environment variables — passed straight through to the container

[!IMPORTANT] Both packaging modes require a running Docker (or Podman) daemon to execute invocations. S3-based code delivery and direct Go binary execution on the host are not supported. All other Gopherstack services work without Docker.

# Create an image-based Lambda function
aws lambda create-function \
    --endpoint-url http://localhost:8000 \
    --function-name my-function \
    --package-type Image \
    --code ImageUri=public.ecr.aws/lambda/python:3.12 \
    --role arn:aws:iam::000000000000:role/my-role

# Invoke synchronously
aws lambda invoke \
    --endpoint-url http://localhost:8000 \
    --function-name my-function \
    --payload '{"key":"value"}' \
    response.json

# List functions
aws lambda list-functions --endpoint-url http://localhost:8000
Lambda configuration
Flag Env var Default Description
--lambda-docker-host LAMBDA_DOCKER_HOST 172.17.0.1 Host/IP that Lambda containers use to reach Gopherstack's Runtime API
--lambda-pool-size LAMBDA_POOL_SIZE 3 Maximum warm containers per function
--lambda-idle-timeout LAMBDA_IDLE_TIMEOUT 10m Idle container lifetime before reaping
--lambda-container-runtime CONTAINER_RUNTIME docker Container runtime: docker, podman, or auto
Using Podman

Podman works as a drop-in replacement for Docker via its Docker-compatible API socket.

# Enable the Podman socket for your user (rootless, Linux)
systemctl --user enable --now podman.socket

# Point Gopherstack at Podman
export CONTAINER_RUNTIME=podman

# Optional: override the socket path
export CONTAINER_HOST=unix://${XDG_RUNTIME_DIR}/podman/podman.sock

Rootless networking note: in rootless Podman the Docker bridge (172.17.0.1) is not available — use the host's routable IP or host.containers.internal:

export LAMBDA_DOCKER_HOST=host.containers.internal

Set CONTAINER_RUNTIME=auto to probe Docker first, then Podman, and use whichever socket is reachable.

Event Source Mappings (ESM)

Automatically trigger Lambda functions from DynamoDB Streams — Gopherstack manages the polling and invocation for you once an ESM exists. Respects batch size, starting position (TRIM_HORIZON, LATEST), and enable/disable state.

EventBridge Scheduler & Pipes

  • Scheduler — recurring or one-time scheduled tasks that trigger AWS targets (Lambda, SQS, SNS, and more)
  • Pipes — point-to-point integrations from sources (SQS) to targets (Lambda, Step Functions) with optional filtering and enrichment

Performance & Scalability

  • O(1) ARN indexing — tagging and resource lookup use a centralized ARN index, so operations stay fast with thousands of resources
  • Memory optimization — struct field alignment and efficient data structures keep the footprint small
  • Profile-guided optimization — the binary ships with a PGO profile captured from real workloads (see PGO)

Examples

Complete, runnable examples live in examples/ — each ships a docker-compose.yml and a demo.sh so you can run it end to end.

Example What it demonstrates Requires
apigw-websocket-chat Real-time chat over API Gateway WebSockets with a Node.js Lambda backend OpenTofu, Node.js (wscat)
cognito-api-auth Securing API Gateway with a Cognito User Pool authorizer and JWTs OpenTofu, Bash
ddb-lambda-chain 3-table event pipeline where DynamoDB Streams trigger a Go Lambda Go, Bash
ec2-docker Provisioning EC2 instances and running SSH commands against them Bash (ssh, dig)
elasticache-valkey ElastiCache Valkey cluster reachable via embedded DNS Bash (valkey-cli/redis-cli)
eventbridge-sqs Routing custom EventBridge events to an SQS queue OpenTofu
kinesis-lambda-aggregator Kinesis stream invoking a Node.js Lambda that aggregates into DynamoDB OpenTofu, Bash
s3-access-logs Configuring S3 server access logging OpenTofu
s3-lambda-processor S3 uploads triggering a Go Lambda to process the object OpenTofu, Go, Bash
sns-sqs-fanout Pub/sub fan-out from SNS to multiple SQS queues OpenTofu
stepfunctions-order-workflow Order-processing state machine orchestrated by Step Functions OpenTofu, Bash

Running one:

cd examples/kinesis-lambda-aggregator
docker compose up -d
./demo.sh

See examples/README.md for prerequisites and teardown.

Services

Every service links to its own page with a coverage breakdown — audited operations, known gaps, deferred items and resource-leak status — generated from that service's PARITY.md audit.

Parity is the overall grade recorded by that service's most recent audit. Operations is the number of API operations audited; a dash means the service is tracked by feature family instead. Run make docs to refresh this table.

Compute

Service Parity Operations Notes
App Runner A 37 4 gaps; 1 deferred
Auto Scaling A 66 7 gaps; 2 deferred
Batch A 25 4 gaps; 4 deferred
EC2 A 6 families; 1 gap; 2 deferred
Elastic Beanstalk A 48 5 gaps; 3 deferred
Lambda B 6 families; 3 deferred

Containers

Service Parity Operations Notes
ECR B 58 3 gaps; 2 deferred
ECS A 65 7 gaps; 3 deferred
EKS A 65 5 gaps; 2 deferred

Storage

Service Parity Operations Notes
Backup A 17 4 gaps; 4 deferred
Data Lifecycle Manager A 8 4 gaps
EFS A 31 4 gaps; 2 deferred
FSx A 13 families; 3 gaps
S3 B 3 2 gaps
S3 Control A 34 4 gaps; 3 deferred
S3 Glacier A 33 2 gaps; 2 deferred
S3 Tables A 49 1 gap; 1 deferred

Database

Service Parity Operations Notes
DAX A 22 3 gaps; 1 deferred
DocumentDB A 55 4 gaps; 1 deferred
DynamoDB A 7 families; 3 deferred
DynamoDB Streams B 4 2 gaps; 1 deferred
ElastiCache B 75 2 gaps; 2 deferred
MemoryDB A 46 3 gaps; 3 deferred
Neptune A 12 families; 6 gaps; 2 deferred
QLDB Removed removed service
QLDB Session Removed removed service
RDS B+ 45 5 gaps; 2 deferred
RDS Data A 6 4 gaps; 2 deferred
Redshift A 5 2 gaps; 17 deferred
Redshift Data A 11 4 gaps; 1 deferred
Timestream Query A 12 3 gaps; 1 deferred
Timestream Write A 19 4 gaps

Networking & Content Delivery

Service Parity Operations Notes
API Gateway A 123 5 gaps; 3 deferred
API Gateway Management API A 3 4 gaps
API Gateway v2 A 77 3 gaps; 2 deferred
App Mesh A 38 4 gaps; 1 deferred
Cloud Map A 30 3 gaps; 2 deferred
CloudFront A 30 3 gaps; 3 deferred
CloudWatch Network Monitor A 12 2 gaps; 1 deferred
ELB (Classic) A 29 3 gaps; 1 deferred
ELBv2 A 51 4 gaps; 2 deferred
Route 53 A 67 2 gaps; 4 deferred
Route 53 Resolver A 68 2 gaps; 1 deferred
VPC Lattice A 52 5 gaps; 1 deferred

Messaging & Integration

Service Parity Operations Notes
Amazon MQ A 24 4 gaps; 1 deferred
AppSync A 75 2 gaps; 2 deferred
EventBridge A 59 2 gaps; 3 deferred
EventBridge Pipes B 10 3 gaps
EventBridge Scheduler A 12 3 gaps
Pinpoint A 16 3 gaps; 3 deferred
SES A 71 4 gaps; 1 deferred
SES v2 A 110 clean
SNS B 27 3 gaps; 2 deferred
SQS A 18 3 gaps; 2 deferred
SWF A 39 4 gaps; 1 deferred
Step Functions A 35 7 gaps; 3 deferred
WorkMail A 92 6 gaps; 1 deferred

Analytics

Service Parity Operations Notes
Athena A 15 4 gaps; 1 deferred
Clean Rooms A 14 families; 2 gaps; 1 deferred
EMR A 61 clean
EMR Serverless A 22 3 gaps; 1 deferred
Elasticsearch A 51 2 gaps; 1 deferred
Glue A 52 7 gaps; 10 deferred
Glue DataBrew A 45 5 gaps; 1 deferred
Kinesis A 39 5 gaps; 2 deferred
Kinesis Analytics A 20 4 gaps
Kinesis Analytics v2 A 33 5 gaps; 1 deferred
Kinesis Data Firehose A 12 3 gaps; 3 deferred
Lake Formation A 61 3 gaps; 1 deferred
Managed Streaming for Kafka A 59 5 gaps; 2 deferred
Managed Workflows for Apache Airflow A 13 4 gaps; 1 deferred
OpenSearch A 13 1 gap; 8 deferred
QuickSight A 65 5 gaps; 19 deferred

Security

Service Parity Operations Notes
ACM A 16 3 gaps; 2 deferred
ACM PCA A 23 8 gaps; 2 deferred
Detective A 29 4 gaps; 1 deferred
GuardDuty A 51 4 gaps; 3 deferred
Inspector A 13 4 gaps; 1 deferred
KMS A 54 5 gaps; 2 deferred
Macie A 82 5 gaps; 2 deferred
Secrets Manager A 24 3 gaps; 2 deferred
Security Hub A 109 5 gaps; 1 deferred
Shield B 37 3 gaps
Verified Permissions A 30 3 gaps; 1 deferred
WAF A 4 2 gaps
WAFv2 A 55 4 gaps

Identity & Access

Service Parity Operations Notes
Cognito Identity A 23 2 gaps; 1 deferred
Cognito Identity Provider A 44 3 gaps; 2 deferred
Directory Service A 80 2 gaps; 3 deferred
IAM A 2 2 gaps
IAM Access Analyzer A 39 4 gaps; 1 deferred
IAM Identity Center (SSO) A 20 1 gap
IAM Roles Anywhere A 30 5 gaps
Identity Store B 19 3 gaps; 1 deferred
STS B 11 1 gap; 2 deferred

Management & Governance

Service Parity Operations Notes
Account A 14 4 gaps; 1 deferred
AppConfig A 45 3 gaps; 1 deferred
AppConfig Data B 2 2 gaps
Application Auto Scaling A 14 3 gaps; 1 deferred
Cloud Control API A 8 3 gaps; 1 deferred
CloudFormation A 51 4 gaps; 6 deferred
CloudTrail A 60 5 gaps; 2 deferred
CloudWatch A 50 1 gap; 3 deferred
CloudWatch Logs A 24 3 gaps; 3 deferred
Config A 97 3 gaps; 1 deferred
Cost Explorer A 23 2 gaps; 2 deferred
Fault Injection Simulator A 26 4 gaps; 2 deferred
OpsWorks A 32 3 gaps; 2 deferred
Organizations A 63 3 gaps; 2 deferred
Resource Access Manager A 37 7 gaps; 1 deferred
Resource Groups A 23 4 gaps
Resource Groups Tagging API A 9 2 gaps; 1 deferred
Systems Manager B 45 4 gaps; 5 deferred

Developer Tools

Service Parity Operations Notes
Amplify A 37 6 gaps; 2 deferred
CodeArtifact A 48 5 gaps; 2 deferred
CodeBuild B 60 4 gaps; 2 deferred
CodeCommit A 79 3 gaps; 2 deferred
CodeConnections A 27 4 gaps; 1 deferred
CodeDeploy A 47 3 gaps; 2 deferred
CodePipeline A 14 4 gaps; 3 deferred
CodeStar Connections A 27 3 gaps; 1 deferred
Serverless Application Repository B 14 2 gaps
X-Ray A 38 3 gaps; 1 deferred

Machine Learning

Service Parity Operations Notes
Bedrock A 58 6 gaps; 4 deferred
Bedrock Agent A 74 2 gaps; 2 deferred
Bedrock Runtime A 10 2 gaps
Comprehend A 11 2 gaps; 2 deferred
Forecast A 8 3 gaps; 3 deferred
Personalize A 74 3 gaps; 3 deferred
Polly A 13 8 gaps; 5 deferred
Rekognition A 50 4 gaps; 1 deferred
SageMaker A 22 3 gaps; 17 deferred
SageMaker Runtime A 3 3 gaps
Textract B 25 2 gaps; 1 deferred
Transcribe A 43 2 gaps; 1 deferred
Translate A 19 2 gaps

Media

Service Parity Operations Notes
MediaConvert A 34 3 gaps; 1 deferred
MediaLive A 6 gaps
MediaPackage A 19 3 gaps; 1 deferred
MediaStore B 21 3 gaps
MediaStore Data B 5 3 gaps; 1 deferred
MediaTailor A 48 4 gaps; 3 deferred

IoT

Service Parity Operations Notes
IoT Analytics A 34 2 gaps; 2 deferred
IoT Core B 30 2 gaps; 6 deferred
IoT Data Plane A 8 3 gaps; 1 deferred
IoT Wireless A 6 4 gaps; 9 deferred

Migration & Transfer

Service Parity Operations Notes
DataSync A 53 5 gaps; 1 deferred
Database Migration Service A 68 4 gaps; 3 deferred
Transfer Family A 15 families; 2 gaps; 2 deferred

Other

Service Parity Operations Notes
AppStream 2.0 A 32 2 deferred
HealthOmics A 25 families; 3 gaps; 2 deferred
Managed Blockchain A 27 4 gaps
Support A 16 1 deferred
WorkSpaces A 27 2 gaps; 3 deferred

Using Gopherstack

AWS CLI

Everything works with the standard AWS CLI — just pass --endpoint-url:

# DynamoDB
aws dynamodb create-table \
    --endpoint-url http://localhost:8000 \
    --table-name Users \
    --attribute-definitions AttributeName=ID,AttributeType=S \
    --key-schema AttributeName=ID,KeyType=HASH \
    --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5

aws dynamodb list-tables --endpoint-url http://localhost:8000

# S3
aws s3 mb s3://my-bucket --endpoint-url http://localhost:8000
aws s3 cp myfile.txt s3://my-bucket/ --endpoint-url http://localhost:8000
aws s3 ls s3://my-bucket/ --endpoint-url http://localhost:8000

Alternatively set AWS_ENDPOINT_URL=http://localhost:8000 once and drop the flag.

Terraform / OpenTofu

Point the AWS provider at Gopherstack by overriding the service endpoints. No real credentials are needed — any non-empty string works.

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }
}

provider "aws" {
  region                      = "us-east-1"
  access_key                  = "test"
  secret_key                  = "test"
  skip_credentials_validation = true
  skip_metadata_api_check     = true
  skip_requesting_account_id  = true

  endpoints {
    dynamodb       = "http://localhost:8000"
    s3             = "http://localhost:8000"
    sqs            = "http://localhost:8000"
    sns            = "http://localhost:8000"
    ssm            = "http://localhost:8000"
    kms            = "http://localhost:8000"
    secretsmanager = "http://localhost:8000"
    iam            = "http://localhost:8000"
    sts            = "http://localhost:8000"
    lambda         = "http://localhost:8000"
    cloudformation = "http://localhost:8000"
    cloudwatch     = "http://localhost:8000"
    cloudwatchlogs = "http://localhost:8000"
    stepfunctions  = "http://localhost:8000"
    eventbridge    = "http://localhost:8000"
    apigateway     = "http://localhost:8000"
  }
}

Terraform uses path-style S3 URLs, so set use_path_style = true on the S3 provider/resource when creating aws_s3_bucket resources.

docker compose up -d   # or: go run .
terraform init
terraform apply

AWS CDK

CDK synthesises CloudFormation locally and deploys it via the AWS SDK, so pointing the SDK at Gopherstack is enough:

export AWS_ENDPOINT_URL=http://localhost:8000
export AWS_ACCESS_KEY_ID=test
export AWS_SECRET_ACCESS_KEY=test
export AWS_DEFAULT_REGION=us-east-1
export CDK_DEFAULT_ACCOUNT=000000000000
export CDK_DEFAULT_REGION=us-east-1

docker compose up -d   # start Gopherstack
cdk bootstrap          # creates the CDKToolkit stack via CloudFormation
cdk deploy

AWS_ENDPOINT_URL is picked up automatically by the AWS SDK v2 used by the CDK CLI.

Documentation

Development

Prerequisites: Go 1.26+, Docker or Podman (only for Lambda invocations), AWS CLI (optional).

make all             # lint + all tests with coverage
make test            # unit tests (short mode)
make total-coverage  # unit + integration + E2E with combined coverage
make lint            # linters
make docs            # regenerate the service docs from each PARITY.md
make pgo             # regenerate the PGO profile

Versioning

Releases are tagged v1.<major>.<minor> — a major bump moves the middle number, a minor bump moves the last one. Releases are cut from the Release workflow, which only offers those two increments.

The leading 1 is deliberate and stays put. The Go module path is github.com/blackbirdworks/gopherstack with no /vN suffix, and Go requires any module at major version 2 or higher to carry that suffix in its path. A tag like v18.0.0 is therefore invisible to the Go module proxy and pkg.go.dev — staying on the v1.x.y line keeps go get working without rewriting every import across the tree on each release.

v1.0.x is reserved and must never be reused. An earlier release line published v1.0.0v1.0.18, and proxy.golang.org caches module versions permanently while sum.golang.org records their checksums — re-tagging one of those numbers would serve the old cached code and break checksum verification for anyone fetching it. Releases therefore start at v1.1.0, which also sorts above the highest cached version. The release workflow enforces both rules and refuses to create a tag that violates them.

Profile-Guided Optimization (PGO)

The repo root ships default.pgo, a CPU profile that Go's Profile-Guided Optimization automatically consumes from the main package directory on every go build — no extra flags. It's captured from a representative workload (heavy DynamoDB GSI/LSI and S3 traffic, plus broad multi-service coverage) so the compiler can optimize the real hot paths.

Regenerate it with:

make pgo

This runs scripts/pgo.sh, which builds the server and the cmd/pgoload load generator, runs the server with pprof enabled, captures CPU profiles while driving load against it, and writes the merged result to default.pgo. It validates the profile with go tool pprof and go build -pgo=auto before finishing. Knobs (capture/load duration, concurrency, …) are environment variables — see the header of scripts/pgo.sh.

Per-PR: if your change measurably shifts the server's hot paths, run make pgo and commit the updated default.pgo alongside it.

CI: a weekly workflow (.github/workflows/pgo.yml) also runs make pgo and opens a pull request with a refreshed profile.

License

Gopherstack is released under the MIT License.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
awsgs command
Package main provides awsgs, a thin wrapper around the aws CLI that automatically injects --endpoint-url so every command targets a running Gopherstack instance.
Package main provides awsgs, a thin wrapper around the aws CLI that automatically injects --endpoint-url so every command targets a running Gopherstack instance.
covmerge command
Command covmerge merges Go coverage profiles (as produced by `go test -covermode=atomic -coverprofile=...`) into a single deduplicated profile.
Command covmerge merges Go coverage profiles (as produced by `go test -covermode=atomic -coverprofile=...`) into a single deduplicated profile.
gendocs command
Command gendocs regenerates per-service documentation from each service's PARITY.md audit manifest under services/.
Command gendocs regenerates per-service documentation from each service's PARITY.md audit manifest under services/.
pgoload command
Command pgoload is a heavy, concurrent load generator for a running Gopherstack server.
Command pgoload is a heavy, concurrent load generator for a running Gopherstack server.
internal
awstest
Package awstest provides shared HTTP test helpers for service handler tests.
Package awstest provides shared HTTP test helpers for service handler tests.
modules
gopherstack
Package gopherstack provides a Testcontainers module for Gopherstack.
Package gopherstack provides a Testcontainers module for Gopherstack.
pkgs
arn
Package arn provides utilities for building AWS ARNs.
Package arn provides utilities for building AWS ARNs.
awserr
Package awserr provides shared sentinel errors for AWS service stubs.
Package awserr provides shared sentinel errors for AWS service stubs.
awsmeta
Package awsmeta defines the Metadata struct that carries AWS request-scoped identity (account, region, partition, request ID) and a helper to populate it from an *http.Request.
Package awsmeta defines the Metadata struct that carries AWS request-scoped identity (account, region, partition, request ID) and a helper to populate it from an *http.Request.
awstime
Package awstime provides helpers for emitting timestamps in the wire format expected by AWS JSON-protocol SDK deserializers.
Package awstime provides helpers for emitting timestamps in the wire format expected by AWS JSON-protocol SDK deserializers.
collections
Package collections provides small, type-safe slice and map helpers that the Go standard library's slices and maps packages do not cover.
Package collections provides small, type-safe slice and map helpers that the Go standard library's slices and maps packages do not cover.
config
Package config provides centralized AWS configuration shared by all Gopherstack services.
Package config provides centralized AWS configuration shared by all Gopherstack services.
container
Package container provides a runtime-agnostic container integration layer for Gopherstack.
Package container provides a runtime-agnostic container integration layer for Gopherstack.
ctxval
Package ctxval is a type-safe wrapper over context.Context values using generics.
Package ctxval is a type-safe wrapper over context.Context values using generics.
dns
Package dns provides an embedded DNS server for Gopherstack that resolves synthetic AWS-style hostnames (e.g.
Package dns provides an embedded DNS server for Gopherstack that resolves synthetic AWS-style hostnames (e.g.
docker
Package docker provides a Docker integration layer for Gopherstack.
Package docker provides a Docker integration layer for Gopherstack.
events
Package events defines the event system for Gopherstack.
Package events defines the event system for Gopherstack.
inithooks
Package inithooks provides support for running user-defined scripts on Gopherstack startup.
Package inithooks provides support for running user-defined scripts on Gopherstack startup.
lockmetrics
Package lockmetrics provides an instrumented sync.RWMutex that emits Prometheus metrics on every lock acquisition and release.
Package lockmetrics provides an instrumented sync.RWMutex that emits Prometheus metrics on every lock acquisition and release.
logger
Package logger is the project-wide slog wrapper.
Package logger is the project-wide slog wrapper.
page
Package page provides a generic paginated list type used across service backends.
Package page provides a generic paginated list type used across service backends.
persistence
Package persistence provides a pluggable persistence layer for Gopherstack services.
Package persistence provides a pluggable persistence layer for Gopherstack services.
portalloc
Package portalloc provides a central port allocator for Gopherstack services.
Package portalloc provides a central port allocator for Gopherstack services.
safemap
Package safemap provides a generic, concurrency-safe map wrapper.
Package safemap provides a generic, concurrency-safe map wrapper.
sdkcheck
Package sdkcheck provides helpers for verifying that gopherstack service handlers cover all operations exposed by the corresponding AWS SDK v2 client.
Package sdkcheck provides helpers for verifying that gopherstack service handlers cover all operations exposed by the corresponding AWS SDK v2 client.
store
Package store provides a generic, type-safe keyed collection (Table[V]) that replaces the per-backend map + Init/Reset/Snapshot/Restore boilerplate that every service.InMemoryBackend hand-rolls today (EC2 alone repeats it for ~180 maps).
Package store provides a generic, type-safe keyed collection (Table[V]) that replaces the per-backend map + Init/Reset/Snapshot/Restore boilerplate that every service.InMemoryBackend hand-rolls today (EC2 alone repeats it for ~180 maps).
tags
Package tags provides a concurrency-safe string tag map for AWS resource annotations.
Package tags provides a concurrency-safe string tag map for AWS resource annotations.
testleak
Package testleak centralises goroutine-leak detection for tests.
Package testleak centralises goroutine-leak detection for tests.
version
Package version holds the build-time version information injected via ldflags.
Package version holds the build-time version information injected via ldflags.
worker
Package worker is the standard primitive for the background work gopherstack services run: periodic "janitor" sweeps, one-shot delayed state transitions, and tracked goroutines.
Package worker is the standard primitive for the background work gopherstack services run: periodic "janitor" sweeps, one-shot delayed state transitions, and tracked goroutines.
services
acm
apigatewaymanagementapi
Package apigatewaymanagementapi provides an in-memory stub for the AWS API Gateway Management API, which is used to send data to connected WebSocket API clients and manage WebSocket connections.
Package apigatewaymanagementapi provides an in-memory stub for the AWS API Gateway Management API, which is used to send data to connected WebSocket API clients and manage WebSocket connections.
appconfig
Package appconfig provides an in-memory stub for the AWS AppConfig service, which manages feature flags and application configuration.
Package appconfig provides an in-memory stub for the AWS AppConfig service, which manages feature flags and application configuration.
appconfigdata
Package appconfigdata provides an in-memory stub for the AWS AppConfigData service, which is used to retrieve deployed configuration data for applications at runtime.
Package appconfigdata provides an in-memory stub for the AWS AppConfigData service, which is used to retrieve deployed configuration data for applications at runtime.
bedrockagent
Package bedrockagent provides a local stub for the Amazon Bedrock Agent service.
Package bedrockagent provides a local stub for the Amazon Bedrock Agent service.
ce
Package ce provides an in-memory implementation of the AWS Cost Explorer (Ce) service.
Package ce provides an in-memory implementation of the AWS Cost Explorer (Ce) service.
cloudcontrol
Package cloudcontrol provides an in-memory implementation of the AWS CloudControl API service.
Package cloudcontrol provides an in-memory implementation of the AWS CloudControl API service.
codedeploy
Package codedeploy provides an in-memory implementation of the AWS CodeDeploy service.
Package codedeploy provides an in-memory implementation of the AWS CodeDeploy service.
codepipeline
Package codepipeline provides an in-memory implementation of the AWS CodePipeline service.
Package codepipeline provides an in-memory implementation of the AWS CodePipeline service.
codestarconnections
Package codestarconnections provides an in-memory implementation of the AWS CodeStar Connections service.
Package codestarconnections provides an in-memory implementation of the AWS CodeStar Connections service.
cognitoidentity
Package cognitoidentity provides a mock implementation of the AWS Cognito Federated Identities service.
Package cognitoidentity provides a mock implementation of the AWS Cognito Federated Identities service.
cognitoidp
Package cognitoidp provides a mock implementation of the AWS Cognito User Pools service.
Package cognitoidp provides a mock implementation of the AWS Cognito User Pools service.
databrew
Package databrew implements an in-memory AWS Glue DataBrew service backend.
Package databrew implements an in-memory AWS Glue DataBrew service backend.
dax
Package dax provides an in-memory simulation of the Amazon DAX (DynamoDB Accelerator) API.
Package dax provides an in-memory simulation of the Amazon DAX (DynamoDB Accelerator) API.
dax/dataplane
Package dataplane implements enough of the Amazon DAX binary wire protocol to serve the core DynamoDB data-plane operations over a raw TCP socket.
Package dataplane implements enough of the Amazon DAX binary wire protocol to serve the core DynamoDB data-plane operations over a raw TCP socket.
dlm
dms
dynamodb
Package dynamodb implements the AWS DynamoDB mock service.
Package dynamodb implements the AWS DynamoDB mock service.
ec2
ecr
ecs
efs
eks
elb
Package elb provides an in-memory implementation of the AWS Classic Elastic Load Balancing (ELB) service.
Package elb provides an in-memory implementation of the AWS Classic Elastic Load Balancing (ELB) service.
emr
fis
Package fis provides an in-memory implementation of the AWS Fault Injection Service (FIS) API.
Package fis provides an in-memory implementation of the AWS Fault Injection Service (FIS) API.
fsx
iam
iot
Package iot provides a mock AWS IoT Core service with an embedded MQTT broker, IoT SQL rules engine, and action dispatch to SQS and Lambda.
Package iot provides a mock AWS IoT Core service with an embedded MQTT broker, IoT SQL rules engine, and action dispatch to SQS and Lambda.
iotdataplane
Package iotdataplane provides the IoT Data Plane HTTP API for publishing messages directly to MQTT topics.
Package iotdataplane provides the IoT Data Plane HTTP API for publishing messages directly to MQTT topics.
kafka
Package kafka provides an in-memory stub of AWS MSK (Managed Streaming for Apache Kafka).
Package kafka provides an in-memory stub of AWS MSK (Managed Streaming for Apache Kafka).
kinesisanalyticsv2
Package kinesisanalyticsv2 provides an in-memory stub of AWS Kinesis Data Analytics v2.
Package kinesisanalyticsv2 provides an in-memory stub of AWS Kinesis Data Analytics v2.
kms
Package kms provides a mock AWS Key Management Service (KMS) implementation.
Package kms provides a mock AWS Key Management Service (KMS) implementation.
lambda
Package lambda provides a mock AWS Lambda service for Gopherstack.
Package lambda provides a mock AWS Lambda service for Gopherstack.
mq
Package mq provides an in-memory stub of Amazon MQ.
Package mq provides an in-memory stub of Amazon MQ.
organizations
Package organizations provides an in-memory stub for the AWS Organizations API.
Package organizations provides an in-memory stub for the AWS Organizations API.
ram
rds
resourcegroupstaggingapi
Package resourcegroupstaggingapi provides a mock implementation of the AWS Resource Groups Tagging API service.
Package resourcegroupstaggingapi provides a mock implementation of the AWS Resource Groups Tagging API service.
s3
secretsmanager
Package secretsmanager provides a mock AWS Secrets Manager implementation.
Package secretsmanager provides a mock AWS Secrets Manager implementation.
ses
sns
sqs
ssm
stepfunctions/asl
Package asl implements an interpreter for the Amazon States Language (ASL) used by AWS Step Functions to define state machine workflows.
Package asl implements an interpreter for the Amazon States Language (ASL) used by AWS Step Functions to define state machine workflows.
sts
swf
waf

Jump to

Keyboard shortcuts

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