AWS

AWS Emulator on Linux: Install, Test with AWS CLI and OpenTofu

You can test S3, DynamoDB, SQS and Lambda code on a Linux machine with AWS Emulator, and you need no AWS account while it runs. It is a single binary that serves the AWS APIs over HTTPS on 127.0.0.1:9297 and keeps every resource in memory.

Original content from computingforgeeks.com - post 193126

In this guide you install it on Ubuntu 26.04 and Rocky Linux 10, point the AWS CLI at it, and apply and destroy an OpenTofu config. You also see what failed in testing, from 501 stubs and hard caps to IAM denials the docs say should not happen. I last ran it in November 2026 on both distributions with AWS Emulator 1.0.553, AWS CLI 2.42.1 and OpenTofu 1.13.9.

Know what AWS Emulator covers

AWS Emulator is a local program that answers AWS API calls, released by AWS under the CC0 licence with its source in the aws/aws-emulator repository. It has no console and no daemon. You start it in a shell, it prints an endpoint, and your CLI, SDK or Terraform provider sends requests there instead of to AWS. The table lists what you get on a default start, taken from the package metadata and the lab runs.

PropertyWhat you get
EndpointHTTPS on 127.0.0.1:9297; -p changes the port and -p 0 picks a free one
IdentityAccount 000000000000, default user emulator, a new EMULATOR access key on every start
StateIn memory only; stopping the process deletes every resource
PackagesRPM and Debian packages for x86_64 and aarch64; on macOS and Windows you build a Docker image
Disk193 MB RPM or 209 MB deb download, 1.1 GB installed under /opt/aws-emulator
TelemetryOn by default; a flag, an environment variable or config.toml switches it off
Not built forProduction, security testing, multi-Region or cross-account tests, load tests

You should read the last row before anything else. The AWS docs say the emulator is verified against AWS in us-west-2 only, accepts any Region but does not keep Regions apart, and has not been tested for long-running use. Treat it as a fast, throwaway test target for CI jobs and local development. If you are learning the services for an AWS exam, it also gives you a free place to practise CLI syntax alongside the AWS certification books, but every security behaviour still needs a real account to confirm.

Before you begin

The lab used two cloud VMs with 2 vCPUs and 4 GB of RAM each, named app-node-1 (Ubuntu) and app-node-2 (Rocky). Treat that as a floor for running the emulator plus the CLI tools, not as a sizing target. You need the following:

  • An x86_64 or aarch64 host running Ubuntu 26.04 or Rocky Linux 10, prepared as in the Ubuntu 26.04 server checklist or the Rocky Linux 10 install guide.
  • About 1.5 GB of free disk for the package and the AWS CLI.
  • A regular user with sudo. The emulator runs as that user and writes its files under ~/.aws/emulator.
  • A shell with no real AWS credentials exported. If AWS_ENDPOINT_URL is ever missing, the CLI falls back to real AWS with whatever keys it finds.

OpenTofu is only needed for the infrastructure as code section, so you can install it when you get there.

Install AWS Emulator on Ubuntu and Rocky Linux

AWS publishes the packages at a fixed “latest” URL, and the official getting started on Linux page lists the aarch64 variants. On Ubuntu 26.04, download the Debian package and install it with apt so the dependency check runs:

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

On Rocky Linux 10, dnf installs the RPM straight from the URL. The transaction shows a 193 MB download that expands to 1.1 GB on disk, so check free space on small root volumes first.

sudo dnf install -y https://downloads.aws.com/aws-emulator/packages/aws-emulator/LTS/latest/aws-emulator-x86_64.rpm

Confirm the install with aws-emulator -v. The version, release date and commit come back the same on both distributions, because both packages are cut from one build:

dnf installing the aws-emulator RPM on Rocky Linux 10 and aws-emulator -v printing version, release date and commit

The release date matched the day of the lab run, because the “latest” URL always serves the newest build. If you need repeatable CI results, keep a copy of the package you tested and install that file instead of the URL.

Verify the package signature

To confirm the package came from AWS, check its detached signature. Ideally you run this before the install command above, since a failed check means you should delete the file. Download the signature file and the AWS publishing key, then print the key fingerprint:

curl -fsSLo aws-emulator_amd64.deb.sig https://downloads.aws.com/aws-emulator/packages/aws-emulator/LTS/latest/aws-emulator_amd64.deb.sig
curl -fsSLo aws-publishing.asc https://downloads.aws.com/keys/gpg/current.asc
gpg --import aws-publishing.asc
gpg --fingerprint [email protected]

The fingerprint must read 98BC F336 A3BE 53B7 34E9 67C5 2E5B F49B D940 F624. When it matches, verify the downloaded file against the signature. The signature is published for the file name aws-emulator_amd64.deb, so copy the package to that name first:

cp aws-emulator.deb aws-emulator_amd64.deb
gpg --verify aws-emulator_amd64.deb.sig aws-emulator_amd64.deb

Look for Good signature in the result. The warning about an uncertified key is expected, because you checked the fingerprint yourself:

gpg: Signature made Sat Nov 21 06:34:58 2026 UTC
gpg:                using RSA key 98BCF336A3BE53B734E967C52E5BF49BD940F624
gpg: Good signature from "SSM Publishing <[email protected]>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 98BC F336 A3BE 53B7 34E9  67C5 2E5B F49B D940 F624

On Rocky Linux, rpm -qi aws-emulator shows the same key ID, 2e5bf49bd940f624, in its Signature field. That only proves the package carries a signature, not that anything checked it, because dnf skips the GPG check for a package installed from a URL or local file by default. To verify the RPM, download it with its .rpm.sig file and run the same gpg --verify step from the AWS Linux page before you install it.

Install the AWS CLI v2

Ubuntu 26.04 no longer ships an awscli package, so the obvious apt command fails:

E: Package 'awscli' has no installation candidate

Use the official installer on both distributions instead. Install unzip first with sudo apt-get install -y unzip on Ubuntu or sudo dnf install -y unzip on Rocky, then run:

curl -fsSLo awscliv2.zip https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip
unzip -q awscliv2.zip
sudo ./aws/install
aws --version

You should see v2 with its own bundled Python. The installer ships that interpreter with the CLI and links the command to /usr/local/bin/aws, so the host Python version does not matter. A Python upgrade on the host therefore leaves the CLI your tests depend on untouched:

aws-cli/2.42.1 Python/3.14.10 Linux/7.0.0-1017-gcp exe/x86_64.ubuntu.26

You do not run aws configure at any point. The emulator writes its own config and credentials files, and you point the CLI at them in the next step.

Start the emulator and load its endpoint

By default the emulator runs in the foreground. To keep your shell free, start it in the background and send its two output streams to separate files, because stdout carries JSON log lines and stderr carries the telemetry notice:

nohup aws-emulator > ~/emulator.log 2> ~/emulator.err &

Then poll the health route until it answers. The route uses the emulator’s own certificate, so pass its CA file to curl:

curl -s --cacert ~/.aws/emulator/9297/ca.pem https://127.0.0.1:9297/__admin/health; echo

It prints ok. In the lab the health route answered 0.4 to 0.9 seconds after launch across both distributions and restarts, which is quick enough to start a fresh emulator per test job. The screenshot shows the timed start, the telemetry notice and the files it created:

AWS Emulator ready after half a second, the telemetry notice, the files in ~/.aws/emulator/9297 and the listener on 127.0.0.1:9297

Every file in ~/.aws/emulator/9297/ is mode 0600 and belongs to one run on one port. The emulator_credentials file holds this run’s access key, ca.pem is the self-signed CA, truststore.p12 is the same CA for Java clients, and config wires them together. Read the config to see what the CLI will pick up:

cat ~/.aws/emulator/9297/config

You get the Region, the endpoint, the CA bundle and SigV4 signing for S3 in one profile. Because these paths are absolute, the file only works for the user who started the emulator:

[default]
region = us-east-1
endpoint_url = https://127.0.0.1:9297
ca_bundle = /home/maureen/.aws/emulator/9297/ca.pem
s3 =
  signature_version = s3v4

To point every AWS tool in a shell at the emulator, keep the documented variables in one file and source it. Create the file:

vim ~/emulator.env

Add these lines. The last one clears any real credentials, so a typo in the endpoint cannot send your test traffic to a real account:

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
export AWS_DEFAULT_REGION=us-east-1
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN AWS_PROFILE

Load the file and ask STS who you are. This call is the cheapest way to prove which account a shell talks to, so make it the first line of any test script.

source ~/emulator.env
aws sts get-caller-identity

An account of 000000000000 and the user emulator confirm the call stayed local:

{
    "UserId": "AIDAH5I7GEMO7ADXNFAZU",
    "Account": "000000000000",
    "Arn": "arn:aws:iam::000000000000:user/emulator"
}

If you see your real account ID here, stop and fix the environment before you run anything else.

Fix CERTIFICATE_VERIFY_FAILED from the AWS CLI

The CLI needs the emulator’s CA from one of two places: AWS_CA_BUNDLE or the ca_bundle line in the emulator’s config file. With only one of them set, calls still work. With both missing, every call fails like this:

aws: [ERROR]: SSL validation failed for https://127.0.0.1:9297/ [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:1085)

To fix it, source ~/emulator.env again in the shell that runs the test instead of adding --no-verify-ssl. Note that the certificate only names the loopback addresses and localhost, which matters for OpenTofu later. The emulator also empties its port directory when it stops and writes the files again on the next start, so point scripts at ~/.aws/emulator/9297/ instead of copying ca.pem somewhere else.

Call S3, DynamoDB, SQS and Lambda

With the environment loaded, the AWS CLI commands are the ones you already use against a real account. These four services are the ones most test suites touch first.

Create a bucket and copy an object

To check the S3 path end to end, create a bucket, upload a file, list it and read it back to stdout:

aws s3 mb s3://app-artifacts
echo "hello from app-node-1" > hello.txt
aws s3 cp hello.txt s3://app-artifacts/
aws s3 ls s3://app-artifacts/
aws s3 cp s3://app-artifacts/hello.txt -

You should see the bucket, the 22-byte object with its timestamp, and the same text read back. The screenshot also shows the STS check from the previous step, so you can see both calls went to account 000000000000. If mb fails with a credentials error instead, your shell has lost the environment and the CLI is trying real AWS, so source the file again.

aws sts get-caller-identity returning account 000000000000, then creating a bucket, uploading and reading hello.txt

Presigned URLs work as well. aws s3 presign s3://app-artifacts/hello.txt --expires-in 300 returned a URL on https://127.0.0.1:9297/app-artifacts/, and fetching it with curl and the CA file returned the same text. Path-style URLs are the default here, so you do not need bucket DNS names.

Create a DynamoDB table and write items

DynamoDB copies the real service’s table lifecycle, including the CREATING state. Create the table, then wait for it before you write to it:

aws dynamodb create-table --table-name orders --attribute-definitions AttributeName=id,AttributeType=S --key-schema AttributeName=id,KeyType=HASH --billing-mode PAY_PER_REQUEST --query 'TableDescription.TableStatus'
aws dynamodb wait table-exists --table-name orders

The first command returns "CREATING", and the waiter returned after about 3 seconds in every run. Then write and read an item:

aws dynamodb put-item --table-name orders --item '{"id":{"S":"1001"},"customer":{"S":"maureen"},"total":{"N":"42.5"}}'
aws dynamodb get-item --table-name orders --key '{"id":{"S":"1001"}}'

You get the item back with all three attributes and their types. Numbers come back as strings in the N type, exactly as on AWS, so your parsing code needs no special case:

{
    "Item": {
        "id": {
            "S": "1001"
        },
        "total": {
            "N": "42.5"
        },
        "customer": {
            "S": "maureen"
        }
    }
}

Query and scan behaved the same way; scan --select COUNT counted the two items written in the lab.

ResourceNotFoundException right after create-table

A test that creates a table and writes to it on the next line fails, because the table is still CREATING. The emulator returns the same error code as AWS:

aws: [ERROR]: An error occurred (ResourceNotFoundException) when calling the PutItem operation: Requested resource not found

To measure the window, the lab timed create-table, describe-table and put-item retries in two loops on two fresh tables. The table reported ACTIVE at 3688 ms and the first successful write landed at 4057 ms, measured from the create call:

DynamoDB create-table returning CREATING, ACTIVE at 3688 ms, and put-item failing until about 4 seconds on AWS Emulator

Treat this as a useful behaviour, not a bug. Code that skips the waiter breaks on real AWS too, and the emulator catches it in CI. Add aws dynamodb wait table-exists or your SDK’s waiter after every create.

Send and receive SQS messages

Create a queue first and look closely at the URL in the response, because it is not what most people expect from a local endpoint.

aws sqs create-queue --queue-name jobs

Notice that the queue URL names the real SQS host, not the emulator:

{
    "QueueUrl": "https://sqs.us-east-1.amazonaws.com/000000000000/jobs"
}

That URL is safe to use while AWS_ENDPOINT_URL is set, because the CLI sends the request to the endpoint and only uses the URL to name the queue. The lab used both forms. Send a message to the queue through the emulator address and receive it:

aws sqs send-message --queue-url https://127.0.0.1:9297/000000000000/jobs --message-body '{"task":"resize","id":1}'
aws sqs receive-message --queue-url https://127.0.0.1:9297/000000000000/jobs

You receive the body, its MD5 and a receipt handle. Pass that handle to delete-message once your worker finishes, because an undeleted message counts against the queue cap described later:

{
    "Messages": [
        {
            "MessageId": "7d5b44df-8c17-4e5a-8313-c02cf690119e",
            "ReceiptHandle": "ZDBjMjFjYjUtYjZhNC00ZDY4LThiYjYtMDc4YzBmN2I4YTQwIDBhZWE4N2Q4LTg2ZDQtNDkzNC05NjQwLWNiNmRjYWY2MDAxNyBhcm46YXdzOnNxczp1cy1lYXN0LTE6MDAwMDAwMDAwMDAwOmpvYnM=",
            "MD5OfBody": "0314c51637e1879e5d6b759ed196ec48",
            "Body": "{\"task\":\"resize\",\"id\":1}"
        }
    ]
}

FIFO queues worked in the same run. The one trap is a hard cap on queue depth, covered in the failures section below.

Deploy and invoke a Lambda function

Lambda needs a handler, a zip and an execution role, exactly as on AWS. Write a small Python handler that echoes its event, zip it, and create a role the function can name:

printf 'import json\n\ndef lambda_handler(event, context):\n    return {"statusCode": 200, "body": "hello", "echo": event}\n' > lambda_function.py
python3 -m zipfile -c function.zip lambda_function.py
printf '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"lambda.amazonaws.com"},"Action":"sts:AssumeRole"}]}' > trust.json
aws iam create-role --role-name lambda-exec --assume-role-policy-document file://trust.json --query Role.Arn --output text

Create the function with the role ARN the last command printed, then invoke it with a JSON payload:

aws lambda create-function --function-name hello --runtime python3.12 --handler lambda_function.lambda_handler --zip-file fileb://function.zip --role arn:aws:iam::000000000000:role/lambda-exec --query '{State:State,Runtime:Runtime}'
aws lambda get-function --function-name hello --query 'Configuration.State'
aws lambda invoke --function-name hello --payload '{"name":"maureen"}' --cli-binary-format raw-in-base64-out out.json
cat out.json; echo

The function starts as Pending and reads Active on the next call. The invoke returns status 200, and out.json holds the echoed event:

Lambda function created in Pending state, Active on get-function, and invoke returning status 200 with the echoed payload

Invokes took 0.69 to 0.81 seconds of wall time, most of it CLI startup, and the python3.13 runtime behaved the same. A second handler that printed sys.version showed why no host Python is involved: the code runs inside the emulator process on its embedded RustPython interpreter, with sys.executable set to /usr/bin/aws-emulator. That has two consequences you should plan for. C extensions and some standard library corners may not behave like CPython, and the function runs with your user’s permissions on your files, so only deploy code you trust.

Apply an OpenTofu config against the emulator

The hashicorp/aws provider reads AWS_ENDPOINT_URL, AWS_CA_BUNDLE and the shared credentials file, so most resources work with only a Region in the provider block. S3 buckets are the exception. Install OpenTofu from its official repository first (the OpenTofu install guide for Ubuntu covers the apt method; Rocky uses the RPM repository from the same project).

S3 Control ListTagsForResource fails during apply

With a provider block that sets only the Region, tofu plan passes and apply creates the DynamoDB table and the SQS queue. The bucket then fails while the provider reads its tags through S3 Control:

Error: listing tags for S3 (Simple Storage) Bucket (tofu-artifacts): operation error S3 Control: ListTagsForResource, https response error StatusCode: 0, RequestID: , HostID: , request send failed, Get "https://000000000000.127.0.0.1:9297/v20180820/tags/arn%3Aaws%3As3%3A%3A%3Atofu-artifacts": dial tcp: lookup 000000000000.127.0.0.1: no such host

S3 Control always puts the account ID in front of the host name, and AWS_DISABLE_HOST_PREFIX_INJECTION does not stop it: the AWS CLI hit the same 000000000000.127.0.0.1 host in the probe further down. The provider therefore builds a host name that cannot resolve. The working config below gives S3 Control its own endpoint on localhost, which turns the host into 000000000000.localhost. That name is not in the certificate, so the provider also needs insecure = true. Switching off TLS verification is acceptable here only because the endpoint is loopback; never copy that line into a provider that talks to AWS.

Write and apply the config

Create a working directory for the config. Keep it separate from any directory that holds real state, so a stray tofu destroy can only reach the emulator.

mkdir -p ~/tofu-emulator && cd ~/tofu-emulator
vim main.tf

Paste this config. It is the exact file that applied cleanly on both distributions, with a bucket, an object, a table and a queue:

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
    }
  }
}

provider "aws" {
  region   = "us-east-1"
  insecure = true

  endpoints {
    s3control = "https://localhost:9297"
  }
}

resource "aws_s3_bucket" "artifacts" {
  bucket = "tofu-artifacts"
}

resource "aws_s3_object" "hello" {
  bucket  = aws_s3_bucket.artifacts.id
  key     = "hello.txt"
  content = "hello from OpenTofu"
}

resource "aws_dynamodb_table" "orders" {
  name         = "tofu-orders"
  billing_mode = "PAY_PER_REQUEST"
  hash_key     = "id"

  attribute {
    name = "id"
    type = "S"
  }
}

resource "aws_sqs_queue" "jobs" {
  name = "tofu-jobs"
}

output "bucket" {
  value = aws_s3_bucket.artifacts.arn
}

output "queue_url" {
  value = aws_sqs_queue.jobs.url
}

Ubuntu 26.04 resolved 000000000000.localhost to the loopback address with no changes, so the config works there as is. Rocky Linux 10 does not, and apply fails with lookup 000000000000.localhost on 169.254.169.254:53: no such host. On Rocky, add the name to /etc/hosts:

echo '127.0.0.1 000000000000.localhost' | sudo tee -a /etc/hosts

Source the environment in the same shell, initialise the directory and apply. The first init downloads the provider from the OpenTofu registry, which is the only internet access this section needs:

source ~/emulator.env
tofu init
tofu apply -auto-approve

Init installed hashicorp/aws v6.73.0. Apply finished with four resources and both outputs on Rocky Linux and on Ubuntu:

tofu apply creating an S3 object, DynamoDB table and SQS queue on AWS Emulator with 4 resources added

The SQS queue took 25 seconds, against 0 seconds for the bucket and 6 for the table. The emulator itself answers at once, so the delay comes from the provider’s own wait after creating a queue, and it is the same on real AWS. A second tofu plan confirms the state matches what the emulator holds:

tofu plan

You should see all four resources read back with no drift:

aws_dynamodb_table.orders: Refreshing state... [id=tofu-orders]
aws_s3_bucket.artifacts: Refreshing state... [id=tofu-artifacts]
aws_sqs_queue.jobs: Refreshing state... [id=https://sqs.us-east-1.amazonaws.com/000000000000/tofu-jobs]
aws_s3_object.hello: Refreshing state... [id=tofu-artifacts/hello.txt]

No changes. Your infrastructure matches the configuration.

Tear the stack down the same way you would on AWS. Running destroy matters even on a throwaway endpoint, because it proves your config can delete what it created.

tofu destroy -auto-approve

Again the queue sets the pace. The bucket and object went in under a second and the table in 3 seconds, so budget about 45 seconds for a destroy in CI. Most of that time is the provider waiting, not the emulator working:

aws_dynamodb_table.orders: Destroying... [id=tofu-orders]
aws_s3_object.hello: Destruction complete after 0s
aws_s3_bucket.artifacts: Destroying... [id=tofu-artifacts]
aws_s3_bucket.artifacts: Destruction complete after 0s
aws_dynamodb_table.orders: Destruction complete after 3s
aws_sqs_queue.jobs: Still destroying... [id=https://sqs.us-east-1.amazonaws.com/000000000000/tofu-jobs, 10s elapsed]
aws_sqs_queue.jobs: Still destroying... [id=https://sqs.us-east-1.amazonaws.com/000000000000/tofu-jobs, 20s elapsed]
aws_sqs_queue.jobs: Still destroying... [id=https://sqs.us-east-1.amazonaws.com/000000000000/tofu-jobs, 30s elapsed]
aws_sqs_queue.jobs: Still destroying... [id=https://sqs.us-east-1.amazonaws.com/000000000000/tofu-jobs, 40s elapsed]
aws_sqs_queue.jobs: Destruction complete after 42s

Destroy complete! Resources: 4 destroyed.

One habit saves time here. If an apply fails halfway, objects stay in the emulator while your state file does not know about them, and the next apply stops with BucketAlreadyExists or ResourceInUseException. Restart the emulator to get a clean slate instead of importing test resources. For a wider look at driving Terraform-style workflows from an AI agent, the Claude Code and Terraform guide pairs well with a local endpoint like this one.

Review what failed in testing

Every failure below was reproduced on both distributions. Read the table first, then the sections that explain each one:

SymptomCauseWhat to do
NotImplemented, HTTP 501Operation is scaffolded but has no logicMock that call in tests, or test it on AWS
ResourceNotFoundException on a new tableTable is still CREATING for about 3 to 4 secondsUse the table-exists waiter
AccessDenied for the default userA bucket policy with an explicit Deny is enforcedRestart the emulator to clear it
ValidationException on PutObject1000 objects per bucketSpread load tests across buckets
OverLimit on SendMessage1000 messages per queueDelete messages as you consume them
Empty account after restartState lives in memory onlyCreate fixtures in the test setup

Most of these match real AWS behaviour or are documented limits. The IAM row is the surprise, because it contradicts the security page.

NotImplemented (HTTP 501) on scaffolded operations

An operation the emulator knows about but has not implemented returns a clear error instead of fake data. Cost Explorer is a good example:

aws ce get-cost-and-usage --time-period Start=2026-11-01,End=2026-11-20 --granularity DAILY --metrics BlendedCost

You get a readable error from the CLI, and --debug shows the HTTP status and the JSON body your SDK will parse:

aws: [ERROR]: An error occurred (NotImplemented) when calling the GetCostAndUsage operation: operation GetCostAndUsage is scaffolded but not implemented in this emulator

https://127.0.0.1:9297 "POST / HTTP/1.1" 501 116
b'{"__type":"NotImplemented","message":"operation GetCostAndUsage is scaffolded but not implemented in this emulator"}'

A probe of about 100 read calls across services sorted them as follows. Treat it as a snapshot of one build, because the “latest” package changes as AWS fills in operations:

  • Returned 501: ce get-cost-and-usage and get-dimension-values, inspector2 list-findings, lakeformation list-resources, comprehend list-entities-detection-jobs, gamelift list-fleets, ssm-incidents list-response-plans.
  • Answered normally: ec2, ecs, eks, rds, route53, sagemaker, kinesis, glue, athena, sns, kms, secretsmanager, ssm, cloudformation, logs, events, stepfunctions, ecr, elbv2, cognito-idp and bedrock list-foundation-models.
  • Answered with a service error: support and health (SubscriptionRequiredException), organizations (AWSOrganizationsNotInUseException), and the s3control CLI, which tried https://000000000000.127.0.0.1:9297 and could not connect.

Before you move a test suite over, grep your code for the API calls it makes and run each one once against the emulator. A 501 tells you exactly which calls to mock.

IAM and bucket policies are enforced

The security page says the emulator never denies a request signed with its own key and does not check S3 bucket policies or KMS key policies. The lab showed the opposite on this build. To reproduce it, attach a deny-all bucket policy and list the bucket as the default emulator user:

printf '{"Version":"2012-10-17","Statement":[{"Effect":"Deny","Principal":"*","Action":"s3:*","Resource":["arn:aws:s3:::app-artifacts","arn:aws:s3:::app-artifacts/*"]}]}' > deny-all.json
aws s3api put-bucket-policy --bucket app-artifacts --policy file://deny-all.json
aws s3 ls s3://app-artifacts/

Your list call is refused with the same wording AWS uses for a resource-based deny. That rules out a generic error, because the message names the user, the action, the bucket and the policy type. If the docs were right, this call would have listed the object:

aws: [ERROR]: An error occurred (AccessDenied) when calling the ListObjectsV2 operation: User: arn:aws:iam::000000000000:user/emulator is not authorized to perform: s3:ListBucket on resource: "arn:aws:s3:::app-artifacts" with an explicit deny in a resource-based policy

PutObject was denied the same way, so the policy locked the default user out of its own objects. A restart clears it, along with everything else. Identity policies are evaluated for users you create too. A user with an inline Deny s3:* got explicit deny in an identity-based policy, and a user with no policy at all was refused with the implicit-deny message:

aws: [ERROR]: An error occurred (AccessDenied) when calling the ListBuckets operation: User: arn:aws:iam::000000000000:user/dev-nopolicy is not authorized to perform: s3:ListAllMyBuckets because no identity-based policy allows the s3:ListAllMyBuckets action

The other probes in the same run gave consistent results, so this is not one stray check:

  • The no-policy user could still call sts get-caller-identity, but could not create buckets, DynamoDB tables or IAM users.
  • A user allowed only s3:GetObject and s3:ListBucket could read the object, but was refused DeleteObject and CreateBucket.
  • aws iam simulate-principal-policy returned explicitDeny and implicitDeny to match the live calls.
  • KMS refused a deny-all key policy as MalformedPolicyDocumentException until --bypass-policy-lockout-safety-check was added. After that, kms encrypt as the emulator user failed with an explicit deny.

Each of those results matches what AWS itself returns for the same policy, which is why the docs’ statement surprised me.

The practical reading is that the default emulator user skips identity policies but not explicit denies in resource policies, while users you create are evaluated too. That makes the emulator handy for catching an obviously wrong policy in CI. It does not make it a security test: the docs still say evaluation differs from AWS, and the behaviour may change between daily builds. Confirm every permission on a real account before production.

ValidationException and OverLimit caps

The memory test uploaded 2000 small files with aws s3 cp --recursive --quiet. The command finished, yet the bucket held exactly 1000 objects, because --quiet hid the failed uploads. The next single upload showed the reason:

upload failed: ./hello.txt to s3://loadtest/one-more.txt An error occurred (ValidationException) when calling the PutObject operation: the bucket "loadtest" already holds the maximum of 1000 objects this emulator keeps per bucket; delete an object before writing "one-more.txt"

A second bucket accepted new objects, so the cap is per bucket. SQS has the same limit per queue, and the 1001st message fails:

aws: [ERROR]: An error occurred (OverLimit) when calling the SendMessage operation: This emulator holds at most 1000 messages per queue; queue load cannot take 1 more. Delete messages from it first.

DynamoDB showed no such cap in the lab: a table accepted 1001 items and ten tables of 1000 items each loaded without error. If a fixture loader writes more than 1000 objects or messages, split it across buckets or queues, and drop --quiet from test scripts so failures stay visible.

Empty resources after a restart

To check persistence, the lab stopped the emulator with SIGTERM and started it again. The log ends with shutdown signal received; stopping emulator server, the port directory is left empty, and the new run comes up with nothing in it:

aws dynamodb list-tables
aws iam list-users --query 'Users[].UserName'

Buckets, queues and functions were gone as well. Only the built-in user survives, so any users, roles or policies your tests need must be created again after each start.

{
    "TableNames": []
}
[
    "emulator"
]

The access key ID changed as well, so any script that cached the old key must read the new credentials file. For tests this is the behaviour you want, since every run starts clean. For a long-lived dev environment it means your seed data belongs in a script or an OpenTofu config, not in the emulator.

Measure memory and set a limit

The Linux page says the emulator uses about 160 MiB when idle. The lab measured two numbers, because they answer different questions. RSS from /proc/<pid>/status counts file-backed pages of the 1.1 GB binary, so it overstates real pressure. The cgroup charge from a systemd scope is what the kernel enforces against a limit.

StageUbuntu 26.04 RSSRocky Linux 10 RSS
Idle, 30 s after start361 MiB352 MiB
After 1000 S3 objects369 MiB359 MiB
After 10 DynamoDB tables of 1000 items386 MiB374 MiB
After 1000 SQS messages (peak)388 MiB377 MiB
cgroup charge, 4 s after start (Ubuntu scope)190.8 MiB
cgroup peak under load, 250M limit193.3 MiB

The working set grew only about 27 MiB under that load, and total CPU time stayed at 4 to 5 seconds. The cgroup figure of about 191 MiB is the one to compare with the documented 160 MiB, and it is close. If ps, pgrep and grep against /proc are not second nature yet, the Linux Commands Cheat Sheet covers the process and search commands used in this section. To cap memory, start the emulator in a transient systemd user scope:

systemd-run --user --scope -p MemoryMax=2G -p MemorySwapMax=0 aws-emulator

You do not need to enable lingering for this; it worked over a plain SSH session on Ubuntu. The scope status shows the limit and the charge:

systemctl status of the aws-emulator scope showing Memory 190.8M with max 2G and swap max 0B

To find the floor, the lab tried tighter limits. With MemoryMax=150M the kernel killed the emulator during startup, systemd-run exited with 137 and the scope reported Result: oom-kill. With MemoryMax=250M it ran through the full SQS and S3 load at a peak of 193.3 MiB. Keep the documented 2G for normal use. On a busy CI runner, 250M was enough for small suites like this one, but an exit code of 137 means the limit is too low, and the in-memory state is lost with the process.

Turn off telemetry

Telemetry is on by default, and the stderr notice on every start says so. According to the telemetry page, it sends operation counts, outcomes, response times and a peak memory range every five minutes, keeps them for up to 90 days, and never sends request payloads, resource names or credentials. On Linux you can switch it off three ways:

  1. To turn it off for one run, start with aws-emulator -t off.
  2. To turn it off for a shell or a CI job, export EMULATOR_TELEMETRY=off.
  3. To turn it off for your user, put [telemetry] and enabled = false on two lines in ~/.aws/emulator/config.toml.

Each method changes the startup notice. Check that line after you change a setting, because it names the source that turned telemetry off (the -t off flag shows up as “the embedding configuration”).

AWS Emulator telemetry notice reading disabled for the -t off flag, the EMULATOR_TELEMETRY=off variable and config.toml

Off always wins. Starting with -t on while EMULATOR_TELEMETRY=off is set still reported disabled, and an invalid value such as banana failed safe to off with a warning. For CI, the environment variable is the most reliable choice because it travels with the job definition.

Run it in Docker instead

AWS does not publish a prebuilt image. You build one from the Dockerfile in the Docker getting started page, which installs the RPM on Amazon Linux 2023 minimal. Save that file as Dockerfile in an empty directory and run docker build -t aws-emulator . there; it fetches the x86_64 RPM, so swap in the aarch64 package on Arm hosts. On Ubuntu the build took 1 minute 36 seconds and produced a 2.06 GB image. Stop the native emulator first with pkill -TERM -x aws-emulator, or the port mapping fails because 9297 is taken, and create the mount directory as your user with mkdir -p ~/.aws/emulator so Docker does not create it as root. The run below mounts the emulator’s file directory so the CLI on the host can read the credentials and CA, and it publishes the port on loopback only:

PORT=9297
docker run --rm --name aws-emulator --memory=2g --memory-swap=2g --user "$(id -u):$(id -g)" -e EMULATOR_TELEMETRY=off -p 127.0.0.1:$PORT:$PORT -e HOME="$HOME" -v "$HOME/.aws/emulator:$HOME/.aws/emulator" aws-emulator -p $PORT

Inside the container the emulator binds to 0.0.0.0 and logs a warning that other machines could reach it. You keep it private with the -p 127.0.0.1: prefix. Without it, Docker publishes the port on every host interface. With the same ~/emulator.env, the host CLI returned the emulator user and created a bucket. docker stats showed 191.1 MiB against the 2 GiB limit. That is the same charge as the native scope, so the container costs you disk space rather than memory.

Remove AWS Emulator

To remove the emulator and its files, work through these steps in order:

  1. Stop any running emulator with pkill -TERM -x aws-emulator, so it deletes its port directory cleanly.
  2. Remove the package with sudo apt-get remove -y aws-emulator on Ubuntu or sudo dnf remove -y aws-emulator on Rocky. Dnf freed 1.1 GB.
  3. Delete your user files, including the telemetry directory and config.toml, with rm -rf ~/.aws/emulator.
  4. On Rocky, remove the 000000000000.localhost line from /etc/hosts if you added it.

After dnf remove, an empty /opt/aws-emulator/bin directory was left behind. It holds nothing, so you can delete it or ignore it.

Next steps

If your tests need a persistent local stack, a web dashboard or services that return 501 here, look at LocalStack, which runs as a container and keeps a different scope of APIs. Our guide to running a local AWS stack with LocalStack on Linux covers that setup, so you can try both against the same test suite and keep the one that passes more of it.

Keep reading

Patch Java4Shell (CVE-2026-114938) on Amazon Linux 2023 and 2 AWS Patch Java4Shell (CVE-2026-114938) on Amazon Linux 2023 and 2 The Ecosystem Advantage: Building a Future-Ready Enterprise Data Resilience Strategy Backup The Ecosystem Advantage: Building a Future-Ready Enterprise Data Resilience Strategy Install Nextcloud on Ubuntu 26.04 LTS Cloud Install Nextcloud on Ubuntu 26.04 LTS AWS Developer Associate (DVA-C03) Practice Questions with Answers AWS AWS Developer Associate (DVA-C03) Practice Questions with Answers AWS CloudOps Engineer (SOA-C03) Practice Questions with Answers AWS AWS CloudOps Engineer (SOA-C03) Practice Questions with Answers Install Immich on Ubuntu 26.04 LTS Cloud Install Immich on Ubuntu 26.04 LTS

Leave a Comment

Press ESC to close