AWS Emulator: Test Your AWS Code Locally Without an Account
Most AWS teams know the routine: to test code that talks to S3, DynamoDB or Step Functions, you either deploy it to a sandbox account or mock the SDK calls. Deploys are slow and cost money, and mocks only check what you already assumed. AWS now offers a third option: AWS Emulator, a local copy of the AWS APIs that runs on your laptop or in a CI job, with no AWS account involved.
In this guide we look at what AWS Emulator is, how to run it, how to point your tools at it, and where it fits (and doesn't) in a delivery pipeline.
What is AWS Emulator?
AWS Emulator is a single binary that answers AWS API calls locally. Your SDK, the AWS CLI or your test code sends requests to the emulator's endpoint instead of to AWS, and gets back AWS-shaped responses, including the same error codes. Ask it to create a DynamoDB table with an invalid name, for example, and you get the same ValidationException you would get from the real service.
A few properties make it different from hand-written mocks:
- It behaves like one AWS account. Every emulator instance is account
000000000000, and services can call each other, so cross-service flows can be tested end to end. - It needs no AWS account and has no extra fee. You only pay for real AWS resources you deploy elsewhere.
- It is headless. There is no console; you drive it with the CLI, SDKs and your tests.
- State lives in memory. Stop the emulator and everything is gone, which is exactly what you want for repeatable tests.
AWS lists three main uses: local development, integration tests in CI/CD, and safe prototyping with AI coding agents that need an AWS-like target to work against.
Ways to run it
There are four ways to get the emulator running:
- Linux package (RPM or Deb) for x86_64 and Arm, the most direct option.
- Docker, for macOS, Windows or CI runners. AWS doesn't publish an image; you build one from a short Dockerfile.
- An AI coding agent skill, which installs, starts and connects the emulator for the agent.
- Embedded mode for Rust tests, which gives every test its own isolated state.
On Linux
On Fedora or Amazon Linux:
sudo dnf install -y https://downloads.aws.com/aws-emulator/packages/aws-emulator/LTS/latest/aws-emulator-x86_64.rpmOn Debian or Ubuntu:
curl -fsSLo aws-emulator.deb https://downloads.aws.com/aws-emulator/packages/aws-emulator/LTS/latest/aws-emulator_amd64.deb
sudo apt-get install -y ./aws-emulator.debThen start it:
aws-emulatorBy default it listens on HTTPS at 127.0.0.1:9297. It idles at around 160 MiB of memory, so it is light enough to keep running during development.
With Docker
Since there is no official image, build a small one on Amazon Linux that installs the RPM and runs aws-emulator as the entrypoint, with EMULATOR_BIND_ADDRESS=0.0.0.0 so it is reachable from outside the container. Then run it with the emulator's working folder mounted, so your host can read the credentials and certificate it generates:
PORT=9297
docker run --rm --memory=2g --memory-swap=2g \
-p 127.0.0.1:$PORT:$PORT \
-e HOME="$HOME" \
-v "$HOME/.aws/emulator:$HOME/.aws/emulator" \
aws-emulator -p $PORTKeep an eye on the 2 GiB memory limit: if the container exceeds it, it exits with code 137 and every resource in it is lost.
Pointing your tools at the emulator
This is the part that needs the most care. On startup the emulator writes everything your tools need into ~/.aws/emulator/<port>/: a credentials file, a config file, and a CA certificate for its HTTPS endpoint. Fresh keys and a fresh certificate are generated on every start.
Set these variables in the shell that runs your code or tests:
export AWS_ENDPOINT_URL=https://127.0.0.1:9297
export AWS_SHARED_CREDENTIALS_FILE=~/.aws/emulator/9297/emulator_credentials
export AWS_CONFIG_FILE=~/.aws/emulator/9297/config
export AWS_CA_BUNDLE=~/.aws/emulator/9297/ca.pem
export AWS_EC2_METADATA_DISABLED=true
export AWS_DISABLE_HOST_PREFIX_INJECTION=true
export AWS_REGION=us-east-1 AWS_DEFAULT_REGION=us-east-1
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN AWS_PROFILEThe last line matters: if real credentials are still in the environment, requests get signed with them and the emulator rejects them. Check that you are talking to the emulator:
aws sts get-caller-identityThe answer should show account 000000000000. From there, normal commands work:
aws s3api create-bucket --bucket demo-bucket
aws s3api list-bucketsSDK-specific details
- AWS CLI v2, Boto3 and the Go SDK read
AWS_CA_BUNDLE, so the variables above are enough. - JavaScript SDK v3 needs
NODE_EXTRA_CA_CERTSpointing atca.pem. - Java needs the generated
truststore.p12passed throughJAVA_TOOL_OPTIONS. This replaces the default trust store, so keep it to the test process. - Rust and .NET use
SSL_CERT_FILE. - S3 must use path-style addressing with
127.0.0.1, notlocalhostand not bucket names in the host name.
AWS_DISABLE_HOST_PREFIX_INJECTION exists because the emulator serves every service on one endpoint. Some operations normally add a prefix such as data- to the host name, which would not resolve locally. Only set it in emulator shells; against real AWS some calls fail with it on.
Using it in CI
The emulator suits CI well: it starts fast, needs no cloud account, and resets on restart. A few habits make it reliable:
- Start it per test run and stop it afterwards. A restart is the only way to clear state; there is no reset endpoint.
- Wait for readiness. Poll
GET /__admin/healthuntil it returnsokbefore running tests. - Use
--idle-timeoutso a forgotten emulator shuts itself down. - Set the environment variables in the same script that runs the tests, and keep real AWS credentials out of that job entirely. That way a misconfigured test cannot reach a real account.
- Pin the emulator version by package URL if a new release changes test results.
A minimal job step looks like this:
aws-emulator --idle-timeout 900 &
for i in $(seq 1 30); do
curl -sk https://127.0.0.1:9297/__admin/health | grep -q ok && break
sleep 1
done
# export the variables shown above, then:
npm testLimits to keep in mind
The emulator is a testing tool, not a stand-in for AWS. Before you rely on it, know where it stops:
- No real security model. IAM and resource policies are not evaluated the way AWS evaluates them, so don't use it to test permissions or for security testing.
- One account and one Region per instance. Requests for other Regions are accepted but not kept apart. Run one emulator per Region on separate ports if you need several.
- Coverage varies by service. Operations that aren't implemented return HTTP 501
NotImplemented. AWS publishes a fidelity score per service with every release, and support for CloudFormation, CDK and Terraform also varies by service. - Not for long runs or load tests. Everything is in memory and capacity depends on your machine.
- Native runs are Linux only. On macOS and Windows, use Docker.
- Telemetry is on by default. It can be turned off with
--telemetry off.
The source is on GitHub under aws/aws-emulator, and differences from real AWS can be reported there as issues.
Where it fits
We see AWS Emulator as a strong default for the inner loop and for integration tests: fast feedback, no shared sandbox accounts to clean up, and no cloud bill for test runs. It doesn't replace a deployment to a real AWS environment before release. Permissions, quotas, networking and service limits still need to be checked against AWS itself.
A practical split:
- Unit tests: keep mocking where it is simpler.
- Integration tests: run against AWS Emulator on every commit.
- Staging: deploy to a real AWS account before production, with real IAM policies.
If you are planning how to bring local AWS testing into your delivery pipeline, our DevOps team can help you set it up.
