Akcatech Blog

DevOps

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:

  1. Linux package (RPM or Deb) for x86_64 and Arm, the most direct option.
  2. Docker, for macOS, Windows or CI runners. AWS doesn't publish an image; you build one from a short Dockerfile.
  3. An AI coding agent skill, which installs, starts and connects the emulator for the agent.
  4. 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.rpm

On 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.deb

Then start it:

aws-emulator

By 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 $PORT

Keep 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_PROFILE

The 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-identity

The answer should show account 000000000000. From there, normal commands work:

aws s3api create-bucket --bucket demo-bucket aws s3api list-buckets

SDK-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_CERTS pointing at ca.pem.
  • Java needs the generated truststore.p12 passed through JAVA_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, not localhost and 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/health until it returns ok before running tests.
  • Use --idle-timeout so 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 test

Limits 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.

AWSAWS EmulatorTestingCI/CDDevOpsLocal Development

Need expert support?

Our team helps companies put these practices into production. Tell us what you are working on.

← Back to all articles

Related articles

Cloud Architecture12 min read

The AWS Well-Architected Framework: A Complete Guide

As more companies pivot towards major providers like AWS in the cloud computing landscape, success isn't merely about using services—it's about using them correctly. This is precisely where the AWS Well-Architected Framework comes into play.

DevOps4 min read

Publish Static Website with S3 + GitHub + CloudFront

A static website is a type of website that consists of fixed content and resources that do not change dynamically. Learn how to deploy your static website using AWS S3, GitHub Actions, and CloudFront CDN for a scalable and cost-effective solution.