All posts
LocalStack Now Needs an Account and AWS Has Its Own Emulator: Which One Should You Use?

LocalStack Now Needs an Account and AWS Has Its Own Emulator: Which One Should You Use?

Tuan Phan V. Q.'s avatarTuan Phan V. Q.6 min read
Testing AWS code locally used to mean a real account or LocalStack. LocalStack now needs a token and AWS shipped its own emulator. I tested both.
Table of Contents6 sections

As a developer building on AWS, you want to run and test your code before it touches anything real. Until recently, that left you two options.

Option 1: a real AWS account. It's accurate, because it is AWS. It's also a sandbox account to set up, credentials to manage, resources to clean up, and a bill that grows every time a test forgets to delete what it created. Running tests in CI means handing your pipeline real AWS keys.

Option 2: LocalStack. One docker run, everything local, nothing to pay. For years that was the default answer, and for good reason.

Then the ground moved twice in 2026:

  • March: LocalStack moved to a single image that requires an auth token. No account, no LocalStack. The free plan doesn't include CI credits. Older images still run if you pin them, but they no longer get updates.

  • November: AWS released AWS Emulator, its own local emulator. It's free, needs no AWS account, and its source is released into the public domain. It's also brand new: version 1.0.x, shipped days ago.

So which one should you use now? Instead of comparing feature lists, I took an existing, well-understood design (encrypting PII with AWS KMS) and ran the exact same implementation and test suite on both.

The test subject: PII encryption with AWS KMS

The design is standard field-level envelope encryption for personal data (email, phone, birthday) using AWS KMS and SSM Parameter Store, implemented in a small Laravel app.

It's a good benchmark for an emulator. Encryption is where a "too forgiving" emulator hurts most: if it accepts any key, any context or a tampered blob, broken crypto code passes its tests anyway.

Field-level envelope encryption architecture
Field-level envelope encryption architecture
  • The KMS key never leaves KMS. It only wraps a few versioned data keys (DEKs), created with GenerateDataKeyWithoutPlaintext and bound to an EncryptionContext.

  • The wrapped DEKs live in an SSM SecureString as a map: {"1": "<blob>", "2": "<blob>"}.

  • The app unwraps a DEK once and caches it for a few minutes. KMS stays off the hot path, which avoids throttling and latency far more than it saves money.

  • Every field is encrypted locally with AES-256-GCM. The stored value looks like v2:base64(iv‖ciphertext‖tag): the key version travels with each value, and the GCM AAD is table|column|row id, so a ciphertext copied to another row or column fails to decrypt.

  • An HMAC "blind index" of the normalized value lets you search with WHERE email_index = ? without decrypting anything.

// Eloquent: encrypted virtual attributes, decrypted lazily on read
protected function casts(): array
{
    return [
        'email'    => Encrypted::class . ':index',
        'phone'    => Encrypted::class . ':index',
        'birthday' => Encrypted::class,
    ];
}

Customer::whereBlind('email', '  Ada@Example.COM ')->first();
Key rotation timeline
Key rotation timeline

Because every value carries its own key version, rotation means adding version n+1 and re-encrypting old values in the background. A common mistake is a single dek_version column per row: rotate, update one field, and the row's other fields become unreadable. The suite has a regression test for that case.

One test suite, two emulators

One test suite, two emulators
One test suite, two emulators

The app code is identical on both targets. Only the environment changes:

LocalStack

AWS Emulator

Endpoint

http://127.0.0.1:4566

https://127.0.0.1:9297

Account

LocalStack account + LOCALSTACK_AUTH_TOKEN

none

Credentials

anything

per-run keys written to ~/.aws/emulator/<port>/

TLS

none

its own CA (ca.pem)

Image

localstack/localstack

build it from the Dockerfile in the AWS docs (no prebuilt image yet)

For AWS Emulator in PHP, point the SDK at its CA and its credentials file:

new KmsClient([
    'region'      => 'us-east-1',
    'endpoint'    => env('AWS_ENDPOINT_URL'),              // https://127.0.0.1:9297
    'http'        => ['verify' => env('AWS_CA_BUNDLE')],    // ~/.aws/emulator/9297/ca.pem
    'credentials' => CredentialProvider::ini('default', env('AWS_SHARED_CREDENTIALS_FILE')),
]);

The suite has 16 tests in three groups:

  • Functional:

    • round-trip encrypt and decrypt

    • blind-index lookup

    • rotation and re-encryption

    • "25 writes + 25 reads cost exactly one KMS Decrypt"

  • Tamper resistance: a ciphertext copied to another row or column, or with a flipped bit, must fail.

  • Emulator fidelity: the emulator must behave like real KMS where security depends on it.

    • a wrong or missing EncryptionContext returns InvalidCiphertextException

    • a tampered wrapped key returns InvalidCiphertextException

    • Decrypt pinned to a different key returns IncorrectKeyException

    • an SSM SecureString isn't returned as plaintext without WithDecryption

Results

Comparing the two emulators
Comparing the two emulators
Same PoC, two emulators: results
Same PoC, two emulators: results
  • Both emulators passed all 16 tests, fidelity checks included. Both rejected a wrong context, a tampered blob and the wrong key with the same error codes real KMS returns. For this workload, both are trustworthy.

  • AWS Emulator starts more than 10× faster and uses about half the memory: about 0.6 s to ready versus about 7 s, and 180 MiB idle versus 369 MiB. In CI, start-up time is what you pay on every run.

  • LocalStack ran the test suite about 3× faster (0.7 s vs 2.0 s). AWS Emulator serves HTTPS and verifies request signatures on every call, which probably explains part of the gap.

  • AWS Emulator checks request signatures. Requests signed with made-up keys get AccessDenied. LocalStack accepts any credentials, which is convenient but hides a misconfigured credential chain.

  • Coverage differs at the edges. kms:DescribeCustomKeyStores works on AWS Emulator; LocalStack answers "not currently supported". AWS Emulator generates its services from AWS's published API models and returns 501 NotImplemented for anything it hasn't built yet, rather than faking it.

  • LocalStack has a dashboard; AWS Emulator has none. LocalStack's resource browser shows the KMS keys and the SSM key ring. It even shows the SecureString value decrypted, which nicely demonstrates the design: all anyone sees is wrapped key blobs.

LocalStack resource browser showing the key ring
LocalStack resource browser showing the key ring

Raw terminal output from each run:

AWS Emulator run
AWS Emulator run
LocalStack run
LocalStack run

Gotchas I hit with AWS Emulator

  • Restarting means new keys. Every start writes fresh credentials and a new CA under ~/.aws/emulator/<port>/. Re-read them after a restart, or every call fails.

  • State is in memory. Every restart starts empty, so recreate your KMS key and alias in a bootstrap script.

  • The PHP SDK needs the CA explicitly. Pass it via http.verify; it doesn't pick up the ca_bundle from the emulator's config file, because that path points inside the container.

  • No prebuilt image on macOS or Windows. You build it once from the Dockerfile in the docs; on Apple silicon, use the aarch64 RPM.

What neither emulator tells you

Neither emulator tests permissions. AWS Emulator doesn't evaluate IAM or resource policies, and a request signed with its own keys is never denied. A green run says nothing about whether your role can actually call kms:Decrypt. With LocalStack, policy enforcement depends on your plan and configuration. A wrong key policy or grant will only show up on real AWS.

So which one should you use?

Your situation

Use

New project, or CI that needs common services (KMS, SSM, S3, SQS, DynamoDB…)

AWS Emulator: no account, no token, fast start, low memory

Your team already relies on LocalStack tooling (dashboard, Cloud Pods, IaC workflows)

Stay on LocalStack: it's mature, and there's no reason to rush a migration

You need a service or operation AWS Emulator doesn't support yet (501)

LocalStack for that part, and re-check AWS Emulator's next releases

You don't want to sign up for anything

AWS Emulator (a pinned old LocalStack works too, but gets no updates)

IAM, key policies, real permissions

Neither: a real AWS sandbox account

Final check before production

Real AWS: one short smoke test against a real KMS key