
AWS Emulator: run AWS CLI and SDK tests locally
AWS Emulator serves the AWS APIs on localhost: same CLI and SDK calls, keys it generates, memory-only state, no account, no fee. Setup, CI tips, caveats.
Somewhere in every AWS shop sits a test account full of orphaned DynamoDB tables, half-finished fixtures, and one bucket nobody remembers creating. Mine has all three, plus a cleanup cron that conveniently only runs on days the tests don't. The tax on a real-AWS test never changes: credentials in a real Region, state to clean up, and latency that teaches developers to test against mocks instead.
On November 11, AWS announced AWS Emulator , a local emulator of the AWS APIs that changes that trade. The AWS CLI, the AWS SDKs, and your coding agents make the same calls they make against the real cloud; the endpoint is a process on your laptop. Unimplemented operations return HTTP 501 (Not Implemented) instead of quietly improvising, so a failing test fails for the right reason.
What you get
The emulator is written in Rust to stay light on CPU and memory. It supports the APIs of services that have an API model in the public AWS API models repository, the same models the SDKs are built from, so requests and error shapes match AWS. State lives in memory: stop the process and it's gone, so every test has to create what it needs. Each run generates its own credentials, which start with
EMULATOR under account 000000000000 , and the emulator rejects anything signed with real keys.The announcement's best section explains how it got built: agents made this. One group finds gaps by comparing emulator responses against real AWS and statically checking code against the published Smithy models, then files an issue per gap; another writes tests, implements behavior, and reviews changes; an independent security agent reviews each change adversarially in the fix and again at release. The machinery runs on Amazon Bedrock AgentCore Runtime Instances, CodePipeline, and CodeCommit. I usually want numbers before trusting a marketing claim, and these exist: the fidelity tests are public in the aws-emulator-evaluation-suite repository, failures included. My favorite detail: the repository does not take pull requests.
Setup: one binary, seven exports
I installed the RPM on Amazon Linux 2023, as in the announcement:
PKG=https://downloads.aws.com/aws-emulator/packages/aws-emulator/LTS/latestsudo dnf install -y $PKG/aws-emulator-x86_64.rpmaws-emulator -vmacOS and Windows build a Docker image from the short Dockerfile in the documentation ; AWS publishes no ready-made image.
aws-emulator then serves HTTPS on 127.0.0.1:9297 , reachable only from your own machine, and logs JSON lines with the address, config file, and certificate path.Point your shell at it as the announcement does, unsets included:
export AWS_ENDPOINT_URL=https://127.0.0.1:9297export AWS_SHARED_CREDENTIALS_FILE=~/.aws/emulator/9297/emulator_credentialsexport AWS_CONFIG_FILE=~/.aws/emulator/9297/configexport AWS_EC2_METADATA_DISABLED=trueexport AWS_DISABLE_HOST_PREFIX_INJECTION=trueexport AWS_REGION=us-east-1export AWS_DEFAULT_REGION=us-east-1unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN AWS_PROFILEApplication code stays untouched. The announcement checks the wiring with
aws sts get-caller-identity , then runs an ordinary CLI tour:$ aws s3 mb s3://local-getting-startedmake_bucket: local-getting-started$ echo "hello from the emulator" > hello.txt$ aws s3 cp hello.txt s3://local-getting-started/upload: ./hello.txt to s3://local-getting-started/hello.txt$ aws s3 ls s3://local-getting-started/For coding agents, the announcement feeds the same demo to Kiro as a prompt and shows what it ran:
$ aws dynamodb create-table --table-name kiro-demo \--attribute-definitions AttributeName=id,AttributeType=S \--key-schema AttributeName=id,KeyType=HASH \--billing-mode PAY_PER_REQUEST$ aws dynamodb put-item --table-name kiro-demo \--item '{"id": {"S": "item-1"}, "msg": {"S": "hello from kiro"}}'$ aws dynamodb get-item --table-name kiro-demo --key '{"id": {"S": "item-1"}}'Same commands, new endpoint, answers in milliseconds. The repository's README also shows a one-liner for handing the emulator to a coding agent:
aws agent-toolkit add-skill --skill-name aws-emulator --region us-east-1 , which needs AWS CLI 2.35.0 or later.Embedded mode compiles the emulator into your Rust test process: add the
aws-emulator-embedded crate from GitHub to [dev-dependencies] , instantiate it, and pass its HTTP client to the SDK. Each instance keeps its own state, so parallel tests don't share buckets, tables, or queues, and there's no port or certificate plumbing. Rust SDK only; the announcement walks through a full create-table/put-item/get-item test in process.Tips worth more than the setup guide
Treat the export block as part of the test. The emulator rejects real credentials; the dangerous direction points the other way: if
AWS_ENDPOINT_URL isn't set in the shell running the tests, your code calls AWS with whichever credentials it finds. The documentation says set the variables in the script that runs the tests and keep real credentials out of test-job environments; AWS_EC2_METADATA_DISABLED=true even stops an SDK from grabbing an instance role on EC2. I'd make the unset the first thing every CI job does.Wait for readiness instead of sleeping:
/__admin/health returns HTTP 200 with the body ok , and the documentation's loop checks once a second:for i in $(seq 30); do curl -sf --cacert ~/.aws/emulator/9297/ca.pem https://127.0.0.1:9297/__admin/health && break sleep 1doneLocal requests need Signature Version 4, the same as AWS, which is what keeps a stray browser tab or another local process from talking to your emulator. The docs'
--auth off switch serves unsigned requests; on a process holding your test data in memory, I leave it off.Read the scoreboard before betting on a service. A fidelity test passes only when the status code, body, error code and message, and created resources all match AWS. Scores are snapshots: adding tests can drop a score even while the emulator improves. Known gaps live in the repository's
issues/things-that-do-not-work/ directory, fixed ones move to things-that-now-work , and differences from AWS go to GitHub issues.Costs and the security review
Costs per the announcement: no additional service fee, you pay only for AWS resources when you deploy to AWS, and the source is CC0 1.0.
For the security review, the announcement is direct about the ceiling. The emulator doesn't evaluate IAM policies and resource-based policies the way AWS does, so "a request that AWS denies might succeed in the emulator," and AWS says don't use it to test whether your application is secure, and to test security settings and the whole application on AWS before production. Each emulator acts as a single account with no cross-account or cross-Region behavior; the docs suggest one emulator per Region if you need several. It listens on localhost only, and it sends anonymous usage and error telemetry by default; AWS says records never include request or response contents, code, credentials, or personal data. Turn it off with
aws-emulator --telemetry off , EMULATOR_TELEMETRY=off , or telemetry enabled false in ~/.aws/emulator/config.toml if your organization treats data leaving the box by default the way mine does.My real integration suite still gets a real account, as AWS advises. But the loop most of us live in all day, create the table, put the item, read it back, fix the code, now runs on my laptop for no marginal charge. The cleanup cron gets another week of pretending to work.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article