日本語

How to Tell an AWS Emulator 501 Error from Your Own Bug and Check Operation Support

​​AWS Emulator​AWS CLI,Python,Testing

AWS Emulator returns HTTP 501 with the error code NotImplemented when an operation that has not been built yet is called. If a local integration test or a CI job that calls AWS APIs fails with this error, you can skip the search for a bug in your own code once you recognize it. This article also covers how to read the fidelity score file published with each release, to check whether the operations you use behave the same as on AWS.

Note

The test environment was Ubuntu 24.04 (x86_64), AWS Emulator 1.0.352 (Debian package), AWS CLI 2.40.3, Python 3.11, and boto3 1.44.3. I did not use an AWS account. All requests went to the AWS Emulator running locally (127.0.0.1:9297). I did not connect to real AWS, so the behavior on real AWS is based on the official documentation and the records in the score files that AWS publishes. I did not try running the evaluation suite runner (fidelity_tests_runner), starting the emulator with Docker, or SDKs other than Python.

The error for an operation that is not supported

I installed AWS Emulator from the Debian package, following the official guide for Linux. I started it in the first terminal. -t off turns off sending usage data (telemetry). AWS Emulator keeps running in this terminal until it is stopped.

bash
aws-emulator -t off

In a second terminal, I set the environment variables following the official guide on pointing the SDK at AWS Emulator. The last line, AWS_PAGER, is my own addition for this test. It makes the AWS CLI print output directly instead of opening it in a pager.

bash
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
export AWS_PAGER=""

In this state, I called DescribeOpsItems, which searches OpsItems in Systems Manager (SSM), and got the following error.

console
$ aws ssm describe-ops-items

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

I added --debug to see the HTTP response. The status was 501.

console
$ aws ssm describe-ops-items --debug 2>&1 | grep -E 'HTTP/1.1" [0-9]+|^b'
2026-11-14 02:22:16,178 - MainThread - urllib3.connectionpool - DEBUG - https://127.0.0.1:9297 "POST / HTTP/1.1" 501 117
b'{"__type":"NotImplemented","message":"operation DescribeOpsItems is scaffolded but not implemented in this emulator"}'
botocore.exceptions.ClientError: An error occurred (NotImplemented) when calling the DescribeOpsItems operation: operation DescribeOpsItems is scaffolded but not implemented in this emulator

The official guide's explanation of fidelity also says that operations not built yet return HTTP 501 with the error code NotImplemented. A TestTransformer call to CloudWatch Logs returned a message of the same form.

console
$ aws logs test-transformer --transformer-config '[{"parseJSON":{}}]' --log-event-messages '{"a":1}'

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

The AWS CLI did not retry the 501 response. I counted the 501 responses in the --debug output, and there was only one.

How this differs from an error on a supported operation

For comparison, I used SSM Parameter Store, which AWS Emulator supports. Saving and reading values succeeded.

console
$ aws ssm put-parameter --name /demo/greeting --value hello --type String
{
    "Version": 1,
    "Tier": "Standard"
}
$ aws ssm get-parameter --name /demo/greeting --query Parameter.Value --output text
hello

When I read a name that does not exist, I got a ParameterNotFound error. The status was 400. According to the official guide's explanation of fidelity, for operations that are built, AWS Emulator aims to return the same errors as AWS for invalid calls.

console
$ aws ssm get-parameter --name /demo/missing

aws: [ERROR]: An error occurred (ParameterNotFound) when calling the GetParameter operation:
console
$ aws ssm get-parameter --name /demo/missing --debug 2>&1 | grep -E 'HTTP/1.1" [0-9]+|^b'
2026-11-14 02:22:15,433 - MainThread - urllib3.connectionpool - DEBUG - https://127.0.0.1:9297 "POST / HTTP/1.1" 400 30
b'{"__type":"ParameterNotFound"}'
b'{"__type":"ParameterNotFound"}'
botocore.errorfactory.ParameterNotFound: An error occurred (ParameterNotFound) when calling the GetParameter operation: 

The differences are summarized below.

Operation called HTTP status Error code Message AWS CLI exit code
GetParameter (name does not exist) 400 ParameterNotFound none 254
DescribeOpsItems (not supported) 501 NotImplemented … is scaffolded but not implemented in this emulator 254

Both cases gave AWS CLI exit code 254. The AWS CLI return codes page says that 254 means the request was sent and the service returned an error. Because the exit code cannot tell these apart, a shell script has to look at the error text.

S3 RenameObject is recorded as returning 501 on AWS too

A NotImplemented error does not always mean a gap in AWS Emulator. When I called Amazon S3 RenameObject on a general purpose bucket (a regular S3 bucket), the message was different.

console
$ aws s3api rename-object --bucket demo-bucket-501 --key b.txt --rename-source a.txt

aws: [ERROR]: An error occurred (NotImplemented) when calling the RenameObject operation: A query parameter you provided implies functionality that is not implemented

With --debug on the same command, the status was 501, and the body was XML in the S3 format (I omitted RequestId and HostId).

text
<Error><Code>NotImplemented</Code><Message>A query parameter you provided implies functionality that is not implemented</Message><QueryParameter>renameObject</QueryParameter>…</Error>

According to the S3 RenameObject API reference, only directory buckets in S3 Express One Zone can use this operation. The list of S3 error codes also lists NotImplemented (501 Not Implemented) as an error that S3 itself returns. Furthermore, the score file I read later contains a record that can be read as showing AWS also returning 501 NotImplemented for RenameObject on a general purpose bucket.

Point

When you get NotImplemented, read the message. If it is … is scaffolded but not implemented in this emulator, the operation is a gap in AWS Emulator. For any other message, the same error may occur on real AWS too, so confirm it in the service documentation or the score file.

Telling them apart in test code (Python and boto3)

With boto3, errors are raised as ClientError. I wrote a function that checks the HTTP status, the error code, and the message, and tried it on the three operations above.

python
import boto3
from botocore.exceptions import ClientError

def not_implemented_in_emulator(err: ClientError) -> bool:
    status = err.response["ResponseMetadata"]["HTTPStatusCode"]
    code = err.response["Error"]["Code"]
    message = err.response["Error"].get("Message", "")
    return status == 501 and code == "NotImplemented" and "not implemented in this emulator" in message

ssm = boto3.client("ssm")
s3 = boto3.client("s3")
calls = {
    "ssm.get_parameter": lambda: ssm.get_parameter(Name="/demo/missing"),
    "ssm.describe_ops_items": lambda: ssm.describe_ops_items(),
    "s3.rename_object": lambda: s3.rename_object(Bucket="demo-bucket-501", Key="b.txt", RenameSource="a.txt"),
}
for name, call in calls.items():
    try:
        call()
        print(name, "ok")
    except ClientError as err:
        print(name,
              err.response["ResponseMetadata"]["HTTPStatusCode"],
              err.response["Error"]["Code"],
              "emulator-gap" if not_implemented_in_emulator(err) else "service-error")
console
ssm.get_parameter 400 ParameterNotFound service-error
ssm.describe_ops_items 501 NotImplemented emulator-gap
s3.rename_object 501 NotImplemented service-error

Only DescribeOpsItems was classified as an emulator gap. S3 RenameObject returned 501 but was not classified as a gap.

The official guide's page on versions and compatibility lists what stays the same within a major version, but error messages are not in that list. When you upgrade, check that the message text has not changed.

Checking support with the fidelity score files

You can check whether an operation behaves the same as on AWS by using the fidelity scores that AWS publishes. According to the official guide's explanation of fidelity, a fidelity test is a short program that runs a sequence of operations with the AWS SDK and checks whether the results and errors match AWS. The score for each service is "fidelity tests passed / total fidelity tests for that service." Scores are published with each release on the AWS Emulator releases page. The official guide says that scores should only be compared between fidelity tests from the same version.

Get the score file and the test list

First, check the version and commit you are using.

console
$ aws-emulator -v
Version: 1.0.352
Release date: 2026.11.13
Commit: c479b9c7e416e3201fdeba8fafd9c65b0eed8c74

The v1.0.352 release included a file named scores.json.gz. I downloaded it into the same folder as the evaluation suite repository, which contains the test list (manifest.jsonl).

bash
curl -fsSLO https://github.com/aws/aws-emulator/releases/download/v1.0.352/scores.json.gz
git clone -q --depth 1 https://github.com/aws/aws-emulator-evaluation-suite.git

manifest.jsonl has one test per line. The operations the test calls are in operations, and the test types are in labels (the example below omits part of operations).

json
{"check_id": "accessanalyzer.access-preview-detects-public-s3-bucket-policy", "deployments": [], "key": "accessanalyzer/access-preview-detects-public-s3-bucket-policy", "labels": ["axis:happy-path", "plane:control"], "operations": ["accessanalyzer:CreateAccessPreview", "accessanalyzer:CreateAnalyzer", …], "path": "behavioral/accessanalyzer/check_access_preview_detects_public_s3_bucket_policy.py", "service": "accessanalyzer"}

A script to read the score file

I could not find any document describing the format of scores.json.gz, either in the official guide or in the evaluation suite README. So I looked at the contents and counted with the script below. The meaning of each field is my reading of the field names and their contents.

python
import gzip, json, collections

scores = json.load(gzip.open("scores.json.gz"))
units = scores["units"]
manifest = [json.loads(l) for l in open("aws-emulator-evaluation-suite/manifest.jsonl")]

print("[1] トップレベルのキー:", list(scores))
print("    commit:", scores["commit"], " scoredAt:", scores["scoredAt"])
print("    units:", len(units), collections.Counter(u["kind"] for u in units))
print("    outcome:", collections.Counter(u["outcome"] for u in units))

tests = [u for u in units if u["kind"] == "behavioral"]
ids = {m["check_id"] for m in manifest}
print("[2] behavioral の unitId のうち manifest.jsonl の check_id と一致:",
      sum(u["unitId"] in ids for u in tests), "/", len(tests))
missing = [u["unitId"] for u in tests if u["unitId"] not in ids]
print("    manifest.jsonl にない unitId:", len(missing), " うち _smoke. で始まるもの:", sum(i.startswith("_smoke.") for i in missing))

print("[3] サービスごとの fidelity テストの結果(kind=behavioral、サービス名に __ が入らないテスト)")
by = collections.defaultdict(collections.Counter)
for u in tests:
    svc = u["unitId"].split(".")[0]
    if "__" not in svc and not svc.startswith("_"):
        by[svc][u["outcome"]] += 1
for svc in ["dynamodb", "s3", "sqs", "ssm", "logs"]:
    c = by[svc]
    print(f"    {svc:9} pass {c['pass']:4} / 全体 {sum(c.values()):4}(fail {c['fail']}, skipped {c['skipped']})")

print("[4] ssm:DescribeOpsItems を呼ぶ fidelity テスト(manifest.jsonl)と結果")
result = {u["unitId"]: u["outcome"] for u in tests}
for m in manifest:
    if "ssm:DescribeOpsItems" in m["operations"]:
        print("   ", m["check_id"], m["labels"], "->", result.get(m["check_id"]))

print("[5] wire の記録(expected と actual)")
byid = {u["unitId"]: u for u in units}
for uid in ("ssm-ops-item-lifecycle-and-query", "s3-mvb-rename-object-general-purpose"):
    u = byid[uid]; d = u["detail"]
    print("   ", uid, u["kind"], u["outcome"], d["operation"],
          "expected", d["expected"], "actual", d["actual"], "mismatch", d["mismatch"])

print("[6] actual が 501 の記録の数と、そのうち expected も 501 の記録")
a501 = [u for u in units if u["detail"].get("actual", {}).get("status") == 501]
print("    actual 501:", len(a501), collections.Counter(u["kind"] for u in a501))
for u in a501:
    if u["detail"].get("expected", {}).get("status") == 501:
        print("    expected も 501:", u["unitId"], u["detail"]["operation"])

I read the results in the order of the output numbers.

The whole file, and how it matches the test list

text
[1] トップレベルのキー: ['commit', 'schemaVersion', 'scoredAt', 'units']
    commit: c479b9c7e416e3201fdeba8fafd9c65b0eed8c74  scoredAt: 2026-11-13T23:52:50.952383+00:00
    units: 43548 Counter({'behavioral': 32839, 'wire': 10709})
    outcome: Counter({'pass': 27430, 'fail': 16035, 'skipped': 83})
[2] behavioral の unitId のうち manifest.jsonl の check_id と一致: 29676 / 32839
    manifest.jsonl にない unitId: 3163  うち _smoke. で始まるもの: 17

The commit matched the commit shown by aws-emulator -v. Each entry in units is one record. kind had two values, behavioral and wire, and outcome had three values, pass, fail, and skipped.

The evaluation suite README says that check_id is the ID used in run results and published scores. Of the 32,839 behavioral entries, 29,676 had a unitId that matched a check_id in the manifest.jsonl I downloaded (the commit dated 2026-11-11, 29,676 lines). The other 3,163 did not match any entry in manifest.jsonl (this includes 17 that start with _smoke.).

Results by service

text
[3] サービスごとの fidelity テストの結果(kind=behavioral、サービス名に __ が入らないテスト)
    dynamodb  pass  844 / 全体 1073(fail 229, skipped 0)
    s3        pass  826 / 全体  930(fail 104, skipped 0)
    sqs       pass  288 / 全体  306(fail 18, skipped 0)
    ssm       pass   86 / 全体  282(fail 196, skipped 0)
    logs      pass  396 / 全体  460(fail 64, skipped 0)

The evaluation suite README says that tests spanning multiple services write the service name in the form a__b. So I counted only the tests whose service name at the start of unitId does not contain __. The explanation does not say whether this matches the "per-service score" in the official guide, so I cannot be sure. In this version, only 86 of the 282 SSM tests passed.

Finding tests for the operations you use

text
[4] ssm:DescribeOpsItems を呼ぶ fidelity テスト(manifest.jsonl)と結果
    cloudwatch__ssm.xsvc-cloudwatch-3-alarm-ssm-opsitem-action-creates-opsitem-and-disabled-twin-blocked ['axis:negative-delivery', 'dp:api', 'plane:data'] -> fail
    ssm.ops-item-delete-and-events-list ['axis:happy-path', 'plane:control'] -> fail

Two tests have ssm:DescribeOpsItems in operations, and both are fail. The meanings of the labels are described in the evaluation suite's docs/TAXONOMY.md.

Label Meaning
plane:control Checks configuration operations such as creating, getting, updating, and deleting resources
plane:data Checks operations that use resources, such as writing and reading data or sending messages
dp:api The signed AWS API itself is the path that carries the data
axis:happy-path Checks that an operation succeeds and that its result matches AWS
axis:negative-delivery Checks that something that must not be delivered does not reach its destination

The official guide's explanation of fidelity says that AWS Emulator currently comes closest to AWS for control plane APIs, and that data plane behavior varies by service.

Looking inside the failed tests

text
[5] wire の記録(expected と actual)
    ssm-ops-item-lifecycle-and-query wire fail DescribeOpsItems expected {'status': 200} actual {'errorCode': 'NotImplemented', 'status': 501} mismatch status
    s3-mvb-rename-object-general-purpose wire fail RenameObject expected {'errorCode': 'NotImplemented', 'status': 501} actual {'errorCode': 'NotImplemented', 'status': 501} mismatch body
[6] actual が 501 の記録の数と、そのうち expected も 501 の記録
    actual 501: 1059 Counter({'wire': 1059})
    expected も 501: s3-mvb-rename-object-general-purpose RenameObject

Each wire record holds the operation and the point where the response differed. The official guide says that fidelity tests check behavior against AWS. From this and the field names, I read expected as the response recorded from AWS and actual as the response from AWS Emulator.

Read this way, for DescribeOpsItems AWS returns 200, while AWS Emulator returns 501. For RenameObject on a general purpose bucket, AWS also returns 501 NotImplemented, so the status and error code match, and the test fails only because the body differs. There are 1,059 records where AWS Emulator returned 501. Of these, only one, this RenameObject record, also had 501 as the expected response from AWS.

For operations with no matching test, the official guide's steps for checking whether a project runs on AWS Emulator suggest running the project against both AWS Emulator and AWS and comparing the results. The guide also says that having no test only means the behavior has not been verified yet, and that the operation may still work correctly. If AWS Emulator behaves differently from AWS, you can report it in the aws-emulator repository Issues, with the request you sent, the response you got, and the result you expected.

​Posted by 86