What Is AWS Emulator? AWS's Own Local Emulator Next to LocalStack, on the Same Terraform Stack

An IAM user with no policy asked for a secret. LocalStack handed it over, AWS's new emulator said AccessDenied. Then Terraform, Lambda and rotation on both.

By Mirac Can Yılmaz 28 min read
What Is AWS Emulator? AWS's Own Local Emulator Next to LocalStack, on the Same Terraform Stack - DevOps yazısının kapak görseli

I created an AWS IAM user with no policy at all and asked it to read a secret. One local emulator handed the secret over. The other one answered the way AWS does: AccessDeniedException, with the full "no identity-based policy allows" sentence. The one that refused is a week old. It is AWS Emulator, the local emulator AWS itself published on 11 November. The one that handed the secret over is LocalStack Community, the one I used in the earlier labs on this blog. So I put the two next to each other and ran the same Terraform stack and the same AWS CLI calls against both. The IAM answer was not the only surprise. Terraform applied cleanly on the new emulator and stopped half-way on LocalStack. A custom-runtime Lambda and a secret rotation worked on LocalStack and not on the new one. Neither of them is "the better one". They are wrong in different places, and this post is a map of those places.

What is AWS Emulator?

AWS Emulator is a program you run on your own machine that answers the AWS APIs. You point the AWS CLI, an SDK or Terraform at it with a few environment variables, and your requests go to it and never reach AWS. No account, no bill. AWS announced it on the AWS News Blog on 11 November 2026 as generally available.

The parts that matter before you try it:

  • One binary, written in Rust, source on GitHub (aws/aws-emulator) under CC0. AWS says agents build and maintain it from the public AWS API models, and releases land several times a day.
  • Linux packages only. There is an RPM and a Debian package for x86_64 and aarch64. On macOS and Windows you run it in Docker, and there is no published image: you build one from a short Dockerfile in the user guide.
  • HTTPS and signed requests. It serves one endpoint, https://127.0.0.1:9297 by default, with a certificate it generates at start, and it only accepts requests signed with the keys it generated for that run.
  • Everything in memory. One account, 000000000000. Stop it and the resources are gone.
  • Honest about gaps. An operation it does not implement answers HTTP 501 NotImplemented instead of pretending. AWS publishes how many of its own fidelity tests pass per service with every release.

LocalStack is the emulator most of us already know: a container that answers the AWS APIs on port 4566 over plain HTTP, with any credentials. The Community image is free. The latest tag on Docker Hub is now the paid image and exits without an auth token (License activation failed), so the free line that still starts without an account is localstack/localstack:4.9. That is the one in this lab, and the one in the earlier labs.

The problem, and why it matters

Infrastructure code and the code that calls a cloud API are hard to test without the cloud. The honest test is a real account, and a real account costs money, needs credentials on every laptop and every CI runner, is slow to give an answer, and is shared: two people running the same test at the same time step on each other's bucket names. So teams stop testing the cloud-facing part, or they test it once a day in a sandbox and find out late.

A local emulator fixes the loop. The test runs on the laptop, the answer comes back before you lose your train of thought, and nobody needs a key. The cost is that an emulator is somebody's reading of AWS, and the reading is wrong somewhere. If you do not know where, a green local run teaches you nothing: the same code can fail on the first real deploy, and the worst version of that is a permission that the emulator never checked.

Until this month there was one obvious free choice, so "where is it wrong" had one answer you learned over time. Now there are two, one of them from AWS, and they are wrong in different places. Picking one without looking means picking a set of blind spots without looking.

What a local emulator gives you, and what it costs

In practice What the lab showed
No account, no key every laptop and CI job can run the test both ran with nothing from ~/.aws; the lab refuses to start otherwise
A fast loop for Terraform apply, look, change, apply again clean on AWS Emulator; on LocalStack 4.9 the newest provider stopped at the DynamoDB table
The same API from CLI, SDK, Terraform no test-only code paths every identical CLI check passed on both
Permission checks catching a missing Allow before production AWS Emulator refused a user with no policy; LocalStack Community let it read the secret
Lambda running the function your stack wires up LocalStack ran three kinds; AWS Emulator ran Python, refused the custom runtime and never ran the rotation
The bill none the price is setup friction on one side and missing behaviour on the other, in different places

How the two differ: one stack, two endpoints

Diagram: one Terraform stack and the AWS CLI at the top (S3 bucket with versioning, DynamoDB lock table, SQS queue with a dead-letter queue, SNS topic and subscription, a Secrets Manager secret, two SSM parameters, a KMS key, an IAM role, policy and user), with three values coming from the environment: endpoint, credentials file, CA bundle. Below, two columns. LocalStack 4.9 Community: plain HTTP on 127.0.0.1:4620, any keys, terraform apply stops at the DynamoDB table, a user with no policy reads the secret, Lambda runs in a container per function. AWS Emulator 1.0.514: built locally, HTTPS on 127.0.0.1:9320 with its own CA and EMULATOR keys, terraform apply completes with no changes on the second plan, the user with no policy gets AccessDeniedException, the custom runtime is refused and rotation stays at AWSPENDING.

Two things about the model that the feature lists do not say:

  • LocalStack trusts everyone, AWS Emulator trusts only itself. LocalStack accepts any access key, which is why every tutorial uses test/test. AWS Emulator generates a key pair at start, writes it to a file, and rejects everything else, including the real keys you forgot to unset. That is a safety feature first: a request signed with your production key gets refused locally instead of being quietly accepted.
  • LocalStack borrows Docker for compute, AWS Emulator does not. When you invoke a Lambda function on LocalStack it starts a real Lambda base image through the Docker socket. AWS Emulator runs the function itself, inside its own process tree, with its own interpreter. That one design choice explains most of step 7.

The lab

One Docker daemon (Colima on an Apple silicon laptop), two containers, one Terraform directory. The stack is what a platform team hands a new service, and most of it is familiar from the depends_on, Terragrunt and External Secrets labs: an S3 bucket with versioning and a DynamoDB table for state and locking, an SQS queue with a dead-letter queue behind an SNS topic, a Secrets Manager secret, an SSM String and a SecureString, a KMS key, and an IAM role with a policy that may read exactly those. Eighteen resources. The stack does not know which emulator it is talking to; the endpoint is a variable, and the variable's validation only accepts the two loopback addresses.

1. Getting both running: a pull and a build

LocalStack is docker run. AWS Emulator is a build first, because AWS ships packages, not an image. The Dockerfile is theirs, eight lines:

FROM public.ecr.aws/amazonlinux/amazonlinux:2023-minimal
ADD https://downloads.aws.com/aws-emulator/packages/aws-emulator/LTS/latest/aws-emulator-aarch64.rpm /tmp/aws-emulator.rpm
RUN rpm -i /tmp/aws-emulator.rpm && rm /tmp/aws-emulator.rpm \
    && mkdir -p /home/emulator && chown 1000 /home/emulator
USER 1000
ENV HOME=/home/emulator
EXPOSE 9297
ENTRYPOINT ["aws-emulator", "-b", "0.0.0.0"]

The guide's default is the x86_64 package; on Apple silicon it has to be aarch64. The URL says LTS/latest and there is no version in it, so the image you build today is not the image your colleague builds tomorrow. I got 1.0.514.

The run command in the guide mounts ~/.aws/emulator into the container, because that is where the emulator writes its credentials, its config and its certificate. My ~/.aws holds a real login and I did not want a new tool writing next to it. The emulator takes its home from HOME, so I pointed HOME at a folder inside the lab and mounted that folder at the same absolute path in the container. The files land in the lab, and the paths inside the generated config are valid on the host too. I also started it with --telemetry off; usage telemetry is on by default.

Terminal: make up. LocalStack 4.9.2 community starts on 127.0.0.1:4620. AWS Emulator is built for aarch64 and started on 127.0.0.1:9320, version 1.0.514, release date 2026.11.18, health: ok. The files it wrote are listed inside the lab folder: ca.pem, config, emulator_credentials, truststore.p12, all mode 600. The credentials file shows an access key id starting with EMULATOR and the config shows endpoint_url https://127.0.0.1:9320 and a ca_bundle path. Two containers: p23-aws-emulator and p23-localstack.

2. Who answers, and what it wants first

The same aws sts get-caller-identity on both. LocalStack says I am root of account 000000000000, over plain HTTP, and says the same when I sign with a made-up key. AWS Emulator says I am user/emulator of the same account, and only after three conditions are met: HTTPS, its certificate in AWS_CA_BUNDLE, and its own keys.

Terminal: phase 01. LocalStack returns arn:aws:iam::000000000000:root with the test keys and again with an invented key. AWS Emulator returns arn:aws:iam::000000000000:user/emulator. Signed with LocalStack's test keys, STS answers InvalidClientTokenId "The security token included in the request is invalid" and S3 answers AccessDenied "Sign the request with the emulator credentials". Without the CA bundle: SSL validation failed, CERTIFICATE_VERIFY_FAILED, self-signed certificate. Plain http on the https port: http_code=000. The health route over https answers ok.

Each miss has its own error, and they are in "Where it broke". The useful one is the middle one. If a real access key is still in your environment, AWS Emulator answers Sign the request with the emulator credentials and stops. LocalStack would have accepted the request and you would not have known which key you were using.

3. Terraform on both, and the first surprise

AWS's documentation for the emulator talks about the CLI and the SDKs. The only mention of Terraform I found is one sentence on the fidelity page, saying that support for infrastructure as code tools "varies by service". So the question I cared about most had no documented answer: does terraform apply with the current AWS provider work against it at all?

It does, for this stack. The provider block needs nothing emulator-specific: the usual skip_credentials_validation, skip_requesting_account_id, s3_use_path_style and an endpoints block, exactly what LocalStack needs. The certificate comes from AWS_CA_BUNDLE, which the provider reads, and the keys from the credentials file. Eighteen resources created, and the second plan says No changes.

The surprise was the other column. The same stack, the same provider (hashicorp/aws 6.72.0), against LocalStack 4.9: seventeen resources finish, the DynamoDB table keeps saying Still creating..., and then the apply fails.

Terminal: phase 02. AWS Emulator: terraform apply lists 18 "Creation complete" lines and ends with Apply complete! Resources: 18 added, exit 0; terraform plan right after says No changes, exit 0. LocalStack: the same apply lists 17 "Creation complete" lines and then Error: waiting for update AWS DynamoDB Table (p23-tf-lock): couldn't find resource (21 retries), exit 1; the plan right after says aws_dynamodb_table.lock is tainted, so must be replaced, Plan: 1 to add, 0 to change, 1 to destroy, exit 2. Below, describe-table on both: the emulator returns ACTIVE ACTIVE for table status and warm throughput status, LocalStack returns ACTIVE None.

The table exists on LocalStack and is ACTIVE; I could read and write it. What is missing is one field. The 6.x provider waits for the table's warm throughput to report a status. It expects that block from AWS, AWS Emulator returns it, and LocalStack 4.9 does not. The provider retries, gives up, and marks the table tainted, so every later plan wants to destroy and recreate it. With provider 5.100.0 the same table goes through on LocalStack without the wait.

This is not a LocalStack bug in the usual sense. It is what happens when the free image stands still and the provider keeps moving. The emulator that is rebuilt from the API models every day had the field.

4. Using what Terraform built

Before looking for differences, the boring part: does the stack work? I ran the same checks on both. Bucket versioning is on and a key written twice has two versions. A conditional PutItem works as a lock: the first writer gets in, the second gets ConditionalCheckFailedException. A message published to the SNS topic arrives raw in the SQS queue. The secret reads back. GetParametersByPath with decryption returns the String and the SecureString. KMS encrypts and decrypts. The policy is attached to the role.

Every check passed on both. For the plain "create it and use it" path, on these services, I could not tell them apart from the outside. That is worth saying before the next three steps, which are all about where they part.

5. An IAM user with no policy

The stack creates one more thing: an IAM user, p23-nobody, with nothing attached. I made an access key for it on each side and signed the same calls with that key. On AWS, every one of these is refused.

Terminal: phase 04. LocalStack: the user p23-nobody has 0 attached policies, get-caller-identity returns user/p23-nobody, then get-secret-value returns the secret JSON with the password, get-parameter with decryption returns local-only-token, list-buckets returns p23-tfstate. AWS Emulator: the same user gets AccessDeniedException on GetSecretValue "is not authorized to perform: secretsmanager:GetSecretValue on resource: p23/app/db because no identity-based policy allows the secretsmanager:GetSecretValue action", the same for ssm:GetParameter and s3:ListAllMyBuckets; sqs list-queues returns 2 on both. After attaching p23-app-read, the secret is readable on both and list-buckets is still denied on the emulator. iam simulate-principal-policy for the role: allowed and explicitDeny on LocalStack, allowed and implicitDeny on the emulator. Last line: with the emulator's own key, list-buckets returns p23-tfstate.

LocalStack Community answered all of them. The policy-less user read the secret, decrypted the SecureString and listed the buckets. This is documented behaviour: policy enforcement is a feature of LocalStack's paid plans and is off by default even there.

AWS Emulator refused, in AWS's own words. Then I attached the stack's read policy to the user and asked again: the secret came back, and listing buckets, which the policy does not allow, was still denied. So it is not a blanket "deny users"; it is reading the policy. A side note from the same run: iam simulate-principal-policy for the stack's role answered allowed for reading the secret on both, and for deleting it implicitDeny on the emulator and explicitDeny on LocalStack, where no policy denies anything explicitly.

Two limits before anyone builds a security test on this. First, it is not complete: the same policy-less user could list the SQS queues on the emulator, and AWS would refuse that. Second, AWS says it in plain words in the security page: do not use the emulator to test whether your permissions are correct. It does not check bucket policies or KMS key policies, and a request signed with the emulator's own key is never denied. What I take from this step is narrower and still useful: a missing Allow in an identity policy is the kind of mistake that now has a chance of failing on a laptop.

6. Error text, encrypted values and a queue URL

Tests assert on details without noticing. Three of them differ.

Terminal: phase 05. DynamoDB create-table with the name ab. LocalStack: ValidationException "Invalid table/index name. Table/index names must be between 3 and 255 characters long...". AWS Emulator: ValidationException "1 validation error detected: Value 'ab' at 'tableName' failed to satisfy constraint: Member must have length greater than or equal to 3". SSM get-parameter on the SecureString without decryption: LocalStack returns kms:<key id>:local-only-token, the emulator returns a base64 blob. KMS decrypt of garbage: both InvalidCiphertextException, LocalStack with its own message mentioning LocalStack. get-queue-url: LocalStack returns http://sqs.us-east-1.localhost.localstack.cloud:4566/..., the emulator returns https://sqs.us-east-1.amazonaws.com/000000000000/p23-orders. ec2 get-launch-template-data: LocalStack says the ec2 service is not enabled, the emulator says NotImplemented, operation GetLaunchTemplateData is scaffolded but not implemented in this emulator.

  • Error text. A DynamoDB table named ab is refused by both with ValidationException. The message on AWS Emulator is the sentence AWS returns. LocalStack's is a different, older sentence. The code matches, the text does not, and a test that matches on the text passes on one and fails on the other.
  • A SecureString read without decryption. LocalStack returns kms:<key-id>: followed by the plaintext. The emulator returns an opaque blob. A script that forgot --with-decryption looks fine on LocalStack.
  • The queue URL. LocalStack's queue URL points at a LocalStack host name. AWS Emulator returns https://sqs.us-east-1.amazonaws.com/000000000000/p23-orders, the real AWS host. The AWS CLI and Terraform ignore the host and use the configured endpoint, so everything in the lab stayed local. Code that takes the queue URL and sends an HTTP request to it would leave the machine and knock on real SQS.

And the fourth: an operation that is not there. On the emulator, ec2 get-launch-template-data answers NotImplemented, "scaffolded but not implemented in this emulator". I like this more than a fake success. The test fails at the call that is not supported, with the name of the call.

7. Lambda: Python, a custom runtime and a rotation

Three functions, created the same way on both sides. A Python one that reads an SSM parameter with boto3 and reports what it ran on. A custom runtime on provided.al2023, a few lines of shell that speak the Lambda Runtime API with curl. And a rotation function wired to a Secrets Manager secret, the mechanism from the previous post.

Terminal: phase 06. LocalStack python3.12: status 200, the function reports asked_for AWS_Lambda_python3.12, ran_on cpython 3.12.16, boto3 1.43.127, param_from_ssm https://app.internal.example. LocalStack provided.al2023: status 200, the response echoes the event. LocalStack rotation: the secret now reads password rotated-..., stages AWSPREVIOUS AWSPENDING AWSCURRENT. AWS Emulator python3.12: status 200, asked_for AWS_Lambda_python3.12, ran_on rustpython 3.14.0.alpha, boto3 "(module has no __version__)", param_from_ssm https://app.internal.example. AWS Emulator provided.al2023: InvalidRuntimeException, "The runtime provided.al2023 is not supported by this emulator, which runs the Python and node runtimes." AWS Emulator rotation: the secret still reads password before-rotation, stages AWSCURRENT AWSPENDING.

On LocalStack all three behave like Lambda, because they are Lambda's own base images in containers: CPython 3.12, the real boto3, the shell bootstrap answering, the rotation function called four times and the secret carrying a new password.

On AWS Emulator the Python function also returns 200 and also reads the parameter. Look at what it ran on, though. I asked for python3.12 and the code ran on RustPython, reporting 3.14.0.alpha, with a boto3 module that is a stand-in. For a handler that reads a parameter and returns JSON that is fine. For a function that imports a compiled wheel, I would not expect it to load, and I did not test that.

The custom runtime is refused outright: InvalidRuntimeException, and the message says it "runs the Python and node runtimes". Creating the function succeeds; invoking it is what fails. So Go, Rust, Java and .NET functions can be declared and wired, and not run.

The rotation is the quiet one. rotate-secret returns success on both. On the emulator the function is never invoked: the secret keeps before-rotation, with an empty AWSPENDING version next to it. No error anywhere. If the last post's lab had been built on AWS Emulator, the pod would have waited for a new password that never came.

8. Restart both

Last step: docker restart on both containers and look again.

Terminal: phase 07. Before the restart both list the bucket p23-tfstate. After docker restart of p23-localstack and p23-aws-emulator both report 0 buckets. The emulator's access key before and after the restart are two different EMULATOR... ids. terraform plan with the old state files says Plan: 18 to add, 0 to change, 0 to destroy on both.

Both come back empty. Neither keeps state in the free form; LocalStack sells persistence in its paid plans, and AWS Emulator says it deletes everything when it stops and offers no route to save or reset state. The emulator also comes back with a new key pair and a new certificate, in the same files. Terraform with the old state finds nothing and plans all eighteen again. On AWS Emulator that plan took visibly longer to appear: the provider kept asking SQS for the attributes of queues that were gone before it accepted the answer. I do not know why the same refresh went straight through on LocalStack. For a test run that is what you want: every run starts clean. For a demo environment you keep open all afternoon, it means the laptop going to sleep is not the risk, the container restarting is.

How close is AWS Emulator to AWS? The published counts

AWS publishes a file with every release, scores.json, with the result of every fidelity test: a small program that runs a workflow against real AWS, records the answers, and then checks whether the emulator gives the same ones. These are AWS's tests and AWS's results, not mine. For release v1.0.514, the build I ran, counting the tests that touch only one service:

Service Tests that pass, of total (AWS's own, v1.0.514)
S3 1,168 of 1,295
DynamoDB 1,648 of 2,100
SQS 320 of 359
SNS 281 of 296
Secrets Manager 212 of 236
KMS 305 of 335
IAM 637 of 727
SSM 298 of 489
Lambda 500 of 810
EC2 1,113 of 1,816
CloudFormation 489 of 2,639

Across all services the file has 46,026 tests and 33,317 pass. Read the table by shape: the storage, queue and key services my stack uses are near the top, Lambda and SSM are in the middle, and anything that deploys other things (CloudFormation, and with it CDK) is where the gaps are. That matches what the lab found without me planning it. LocalStack does not publish a comparable file, so there is no second column.

Limits and rules you only learn by hitting them

  • The package is not pinned. LTS/latest is whatever was released that day, and the GitHub releases page shows a dozen on the day I built. Build the image once, tag it with the version it prints, and share that tag. Otherwise "works on my machine" comes back through the side door.
  • Ports must match in three places. The emulator writes its port into the files it generates, so the host port, the container port and -p all have to be the same number. Map 9320:9297 and the generated config carries a port that is not the one on your host.
  • AWS_CONFIG_FILE replaces your config for that shell. Retry settings, S3 options and profiles from your own config stop applying. The generated file is rewritten on every start, so copy it if you need to add to it.
  • Keep 127.0.0.1, not localhost. With localhost some SDKs put the bucket name in the host name, and the emulator does not accept that.
  • One region, one account per emulator. It accepts any region in a request and does not keep resources apart by region. To test two regions, run two emulators on two ports.
  • Unset real credentials, on both. On AWS Emulator a real key is refused, which is the safe failure. On LocalStack it is accepted, and the real danger is the day AWS_ENDPOINT_URL is not set in that shell: the same command goes to AWS with a real key.
  • The emulator runs function code as you. Lambda code is not isolated; in a container that is the container's user, on a Linux host it is your user. Only invoke code you would run in your own shell.
  • LocalStack needs the Docker socket for Lambda. That is why its functions are real, and it is also a root-equivalent mount in CI. Decide that on purpose.
  • Community LocalStack is a fixed point. 4.9 will not learn new fields. Every provider upgrade is a chance to find the next one, like the DynamoDB wait in step 3.
  • A 501 is information. When AWS Emulator answers NotImplemented, the operation name is in the message. Collect those from a test run and you have the list of what your project needs that is not there yet.

Moving a fleet, not a lab

One laptop is a lab. Twenty services and a CI system is a decision about where each kind of test runs. The order I would do it in:

  1. Write down what each test is for. "Does the Terraform apply and is the plan stable", "does the code handle this error", "is this permission enough", "does the function run". These four want different things from an emulator, and step 3 to 7 show that no single one answers all of them.
  2. Build the emulator image in one place. One pipeline builds the AWS Emulator image, tags it with the version the binary prints, and pushes it to the internal registry. Everyone else pulls a tag. This puts back the pin that LTS/latest takes away, and gives you a place to see when a new version changes a result.
  3. One contract for pointing at an endpoint. The same variables everywhere: endpoint, credentials file, CA bundle, region. A script that sets them and refuses to continue unless the endpoint is loopback. The guard in this lab is a few lines, and it exists because of a real mistake of mine (number 7 in "Where it broke").
  4. Run the Terraform stack against both in CI for a while. It costs one more job. In this lab it would have caught the provider upgrade that breaks the DynamoDB table on LocalStack on the day of the upgrade, and it would show the first service where AWS Emulator is the one that fails. A reusable workflow keeps that to one file.
  5. Keep Lambda where Lambda runs. Functions on runtimes other than Python and Node, and anything with native dependencies, stay on LocalStack or go to a real account. Declare them on AWS Emulator if the stack needs them to exist, and do not assert on invoking them.
  6. Keep a real account for what neither can say. Permissions as a whole, cross-account access, quotas, the network. A nightly run in a sandbox account is still the only test of those. The emulators shorten the day; they do not replace the night.
  7. Give every run its own emulator. Both are single-account and in-memory. Two jobs sharing one endpoint will collide on names exactly like two people in a sandbox. Start one per job, with --idle-timeout on AWS Emulator so a forgotten one stops by itself.

What this does not solve: a team that wants one answer. "Which emulator do we use" has become "which emulator for which question", and that is more work than it was a month ago.

Frequently asked

Is AWS Emulator free? Yes. AWS says it has no additional service fee, the source is CC0, and it does not need an AWS account. Usage telemetry is on by default and can be turned off with --telemetry off.

Does AWS Emulator work with Terraform? For the stack in this post, yes: eighteen resources across S3, DynamoDB, SQS, SNS, Secrets Manager, SSM, KMS and IAM applied with hashicorp/aws 6.72.0 and the next plan was empty. AWS does not promise it; the documentation says infrastructure as code support varies by service. Test your own stack before you rely on it.

Does AWS Emulator replace LocalStack? Not for everything. It did not run a custom-runtime Lambda or a secret rotation in this lab, and LocalStack did. It did apply the Terraform stack with the newest provider and refuse a user with no policy, and LocalStack Community did not.

Can I test IAM policies with AWS Emulator? You can catch some missing permissions for IAM users and roles you create inside it. AWS's own guidance is not to use it to test security: resource policies and KMS key policies are not checked, and some calls that AWS would refuse still go through.

Does AWS Emulator run on macOS? Only in Docker, from an image you build yourself with the Dockerfile in the user guide. On Apple silicon change the package in the ADD line to aarch64.

Does AWS Emulator keep data between restarts? No. Everything is in memory, and a restart also changes its access keys and certificate. LocalStack Community does not keep data either; persistence is in LocalStack's paid plans.

Which Lambda runtimes does AWS Emulator run? Python and Node.js, by its own error message. A provided.al2023 function can be created and its invocation is refused with InvalidRuntimeException. The Python I got was RustPython, not the CPython version I asked for.

How do I find out which operations AWS Emulator implements? Call them. An unimplemented operation answers HTTP 501 NotImplemented with the operation's name. The per-service test results are in scores.json on each GitHub release, and known gaps are listed in the repository's issues/things-that-do-not-work/ folder.

Where it broke

1. waiting for update AWS DynamoDB Table (p23-tf-lock): couldn't find resource (21 retries)

LocalStack 4.9 with hashicorp/aws 6.72.0. The table is created and ACTIVE, DescribeTable has no WarmThroughput, the provider waits for it and gives up, and the resource stays tainted. Options I can stand behind: pin the provider to a 5.x release for local runs (5.100.0 created the table), or take the table out of the local stack. A newer LocalStack means the paid image.

2. SSL validation failed for https://127.0.0.1:9320/ [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate

AWS Emulator serves HTTPS with a certificate it makes at every start. AWS_CA_BUNDLE pointing at its ca.pem fixes the CLI, boto3, the Go SDK and with it Terraform. Node needs NODE_EXTRA_CA_CERTS, Java a trust store the emulator also writes. Plain http:// on the same port gets no answer at all.

3. AccessDenied ... Sign the request with the emulator credentials

A request signed with any other key, in my case LocalStack's test/test. From STS the same mistake reads InvalidClientTokenId: The security token included in the request is invalid. Point AWS_SHARED_CREDENTIALS_FILE at the generated emulator_credentials and unset the key variables.

4. The runtime provided.al2023 is not supported by this emulator, which runs the Python and node runtimes.

InvalidRuntimeException on Invoke, not on CreateFunction. The stack applies, the function exists, and the first call fails. Nothing to fix on my side; it is where the emulator is today.

5. A rotation that returns success and never runs

Not an error, which is the problem. rotate-secret answers with the secret's name on AWS Emulator, the function is never called, and the value does not change. On LocalStack the same call ran all four steps. If your test only checks that rotate-secret returned, it is green on both.

6. operation GetLaunchTemplateData is scaffolded but not implemented in this emulator

HTTP 501 from AWS Emulator. The same call on my LocalStack answered Service 'ec2' is not enabled, which was my own SERVICES list, not a gap. Different reasons, both clear.

7. scripts/env.sh:5: BASH_SOURCE[0]: parameter not set

Mine. I sourced the lab's environment file from zsh. The path variable came out empty, the config and endpoint were never set, and the next aws dynamodb describe-table went out with no endpoint at all. It stopped at Unable to locate credentials, only because the line that unsets the real profile had already run. The file now refuses to load outside bash, and the guard checks the endpoint before every call. This is the mistake the "unset real credentials" rule is about.

8. no boto3: AttributeError

Also mine. My first handler printed boto3.__version__, and on AWS Emulator that attribute does not exist, so my own error handling reported "no boto3". There is a boto3 module, and get_parameter through it works. I had the wrong sentence in my notes for a while because of one attribute.

The trade-off, side by side

Only the first two columns were run in this lab. The other three are there because they are the real alternatives; what I say about them comes from their documentation and from using them elsewhere, not from this lab.

AWS Emulator 1.0.514 LocalStack Community 4.9 LocalStack paid plans A sandbox AWS account terraform test with mock_provider
Cost none none paid subscription pay for what runs, plus the account's upkeep none
License CC0 source, no pull requests accepted open source image, frozen at this version without a token commercial n/a part of Terraform
Where fidelity comes from tests recorded against real AWS, counts published per release community and vendor implementation, no published score same engine, more services and features it is AWS none: values are made up by the mock
State after a restart gone, keys and certificate too gone can persist stays until you delete it nothing exists
IAM identity policies checked for users you create, incompletely; resource policies not not checked enforcement available, off by default the real thing not involved
Lambda Python and Node on its own interpreter; other runtimes refused real base images in containers, needs the Docker socket same, plus more integrations the real thing not involved
Setup on macOS build an image, HTTPS, CA bundle, generated keys one docker run one docker run plus a token credentials and an account per person or per team nothing to run
CI fit single binary, no socket, unpinned package needs the socket for Lambda; stable because it does not change token as a CI secret slow, shared, needs cleanup fastest, proves the least
Where it fits Terraform and API-shape tests on current providers, catching a missing identity permission early Lambda on any runtime, rotation, anything event-driven teams that need persistence or enforcement locally and will pay permissions, quotas, network, the final word module logic and variable validation

No column is the right answer. In this lab I would run the Terraform stack and the error-handling tests against AWS Emulator, keep the Lambda and rotation tests on LocalStack, and still not call a permission tested until it has run in a real account.

When to use which

  • Terraform with a current AWS provider, on the plain storage and messaging services: AWS Emulator. It had the field the provider waits for.
  • A function on Go, Rust, Java or .NET, or Python with native wheels: LocalStack, or a real account.
  • Anything where one service calls your function (rotation, event source mappings): LocalStack, and assert on the effect, not on the API call returning.
  • "Is this policy enough": a real account. Use AWS Emulator's refusal as an early hint, never as the proof.
  • Tests that match on error messages: AWS Emulator, whose text is AWS's.
  • A machine with no Docker socket to give away: AWS Emulator; it is one process.
  • A demo that must survive a restart: neither in the free form.

Your call

For the next lab I am keeping both: AWS Emulator for the Terraform apply and the permission hints, LocalStack for whatever has to run a function. That is for a laptop and a blog; on a team I would first ask which of the four questions in the fleet section your tests are really asking. Two things I would like to hear from people who run these in real pipelines:

  • When a local test was green and the real deploy failed, what was it: a permission, a missing field, or a function that never ran?
  • If you had to keep only one, AWS Emulator or LocalStack, which one, and what would you stop testing locally?

I am not after who is right. I want the pluses and minuses of the columns above to be visible to everyone who reads this, in words from real pipelines, and the comments are where that happens: https://www.linkedin.com/in/mirac-can-yilmaz

Summary

  • AWS Emulator is AWS's own local emulator: one Rust binary, CC0 source, HTTPS with a generated certificate, requests signed with keys it generates per run, everything in memory. On macOS you build the Docker image yourself.
  • The same eighteen-resource Terraform stack applied cleanly on AWS Emulator with hashicorp/aws 6.72.0. On LocalStack Community 4.9 it stopped at the DynamoDB table, because DescribeTable there has no warm throughput block.
  • An IAM user with no policy read a secret on LocalStack Community and got AccessDeniedException on AWS Emulator. The emulator's check is partial and AWS says not to test security with it.
  • LocalStack ran a Python function, a custom runtime and a secret rotation. AWS Emulator ran the Python on RustPython, refused provided.al2023, and reported a rotation as started that never ran.
  • Neither keeps state across a restart. Unimplemented operations on AWS Emulator answer 501 with the operation's name.
  • They are wrong in different places. Pick per question, and keep a real account for permissions.

Next in the series

This is post 9b of Core Skills, a side step after External Secrets Operator with AWS Secrets Manager, which ran on LocalStack and is the reason I wanted to know what the new emulator does with the same services. Next: What Is an AWS VPC?, designing an AWS VPC with Terraform and testing it locally, and what a local emulator cannot tell you about packets.

The code for this lab (the Terraform stack, the Dockerfile and run scripts for both emulators, the guard that keeps every call on loopback, the three Lambda functions and the assertions for each phase) is shared with Lab Access members on Buy Me a Coffee; the repo invite comes by email after you join: https://buymeacoffee.com/miraccanyilmaz/membership

About the author

Mirac Can Yılmaz

Mirac Can Yılmaz DevOps & Platform Engineer

I work as a DevOps and platform engineer with Kubernetes, GitOps (Argo CD), CI/CD and Terraform. Every post here was tried and measured in my own lab, on kind and Talos clusters: the commands, the errors and the numbers as they happened. The lab code is shared with Lab Access members on Buy Me a Coffee.

Hayatta en hakiki mürşit ilimdir.
Mustafa Kemal Atatürk