AWS 开源供编程智能体本地测试 200+ 项服务的模拟器
原题AWS Open-Sources Emulator for Local Testing of 200+ Services by Coding Agents
推荐理由AWS Emulator 为编程智能体提供两百多项云服务的本地测试端点。读者可以评估把云资源创建和错误处理纳入离线测试循环的可行性,减少试错时的部署等待与费用。
读前速览
AWS 开源了一款基于 Rust 的本地模拟器,为 200 多项 AWS 服务提供 HTTPS 端点,让编程智能体和开发者无需配置云资源或承担费用即可在本地测试应用。
AWS Emulator 支持在本地测试 200+ 项 AWS 服务,无需配置云资源或支付费用。
开发者可以通过环境变量将 AWS CLI 或 SDK 指向本地模拟器,从而在开发和测试期间创建资源,并遇到与 AWS 实际返回相同的错误。
该模拟器以 Rust 编写,并基于 AWS 自有的 Smithy API 模型生成。
模拟器使用与生成官方 SDK 相同的模型,以确保与实际 AWS API 高度一致;它还支持多种平台,包括 Linux 软件包、macOS 和 Windows 上的 Docker,以及用于 Rust 测试的嵌入式模式。
AI 编程智能体通过由三个团队组成的工作流程编写并测试了整个代码库。
一个团队根据公开 API 模型编写保真度测试,另一个团队重放测试并提交问题,第三个团队负责实现修复。每项变更都必须通过合并门禁,检查编译、编码规范、安全性和保真度回归;整个流程使用 Bedrock AgentCore、CodePipeline 和 CodeCommit。
不同服务的保真度差异显著,其中控制平面 API 最为准确。
AWS 会在每次发布时提供带版本的保真度测试和各服务评分;未实现的操作会返回 HTTP 501 NotImplemented。其局限包括不评估 IAM 策略、每个进程仅使用一个共享账户和区域、状态仅保存在内存中,以及不支持长时间运行的使用场景。
该模拟器并非 LocalStack 等工具的即插即用替代品,尤其不适用于安全和 IaC 工作流。
尽管它提供官方保真度评分并采用公共领域许可,但不支持权限测试;与 LocalStack、Floci 和 moto 等现有模拟器相比,也可能无法覆盖基础设施即代码流水线的所有需求。
完整摘要
AWS 发布了 AWS Emulator,这是一款以 Rust 编写的本地程序,可为 200 多项 AWS 服务提供 HTTPS 端点。开发者和 AI 编程智能体可以借此创建资源,并遇到与 AWS 实际返回相同的错误,无需配置云资源,也无需支付服务费用。用户可以通过 AWS_ENDPOINT_URL 等环境变量,将 AWS CLI 或 SDK 指向模拟器。该模拟器可作为 RPM 或 Debian 软件包安装在 Linux 上;在 macOS 和 Windows 上使用 Docker;也支持在 Rust 测试中以嵌入式模式运行。AWS 表示,智能体通过三个团队编写并测试代码:一个团队根据公开 API 模型编写保真度测试,一个团队重放测试并提交问题,另一个团队负责实现修复。每项变更都必须通过合并门禁检查,包括编译、编码规范、安全性和保真度回归。不同服务的保真度各不相同,其中控制平面 API 最为接近真实服务,而数据平面行为以及对 CloudFormation、Terraform 和 CDK 的支持则各有差异。该模拟器的局限包括不评估 IAM 或基于资源的策略、每个进程仅使用一个共享账户和区域、状态仅保存在内存中,以及不支持长时间运行或负载测试。模拟器基于 400 多个 Smithy API 模型生成,随附官方保真度评分,并依据 CC0 1.0 Universal 许可奉献至公共领域。
AWS 发布了 AWS Emulator,这是一个本地程序,可为 200 多项 AWS 服务的公共 API 提供 HTTPS 端点。借助 AWS Emulator,开发者和编程代理可以创建资源、遇到与 AWS 返回结果相同的错误,并反复迭代,而无需配置云资源,也不会因其模拟的操作产生服务费用。AWS has released AWS Emulator, a local program that serves an HTTPS endpoint for the public APIs of more than 200 AWS services. AWS Emulator lets developers and coding agents create resources, hit the same errors AWS would return, and iterate without provisioning cloud resources or incurring service charges for the operations it emulates.
团队通过 AWS_ENDPOINT_URL 等环境变量将 AWS CLI 或 AWS SDK 指向该模拟器,无需修改应用程序代码。在 Linux 上,它可作为适用于 x86_64 或 aarch64 的 RPM 或 Debian 软件包安装;在 macOS 和 Windows 上,AWS 提供了一份简短的 Dockerfile,但没有发布预构建镜像。Rust 测试可以使用嵌入式模式,在测试进程内运行模拟器,并将其 HTTP 客户端接入 AWS SDK for Rust。aws-emulator 技能可以为编码代理启动模拟器,并根据已发布的保真度测试检查项目。据 Swaminathan Sivasubramanian 介绍,该模拟器以 Rust 编写,由 AWS 为 SDK 发布的 400 多个 Smithy API 模型生成。Teams point the AWS CLI or an AWS SDK at it with environment variables such as AWS_ENDPOINT_URL, leaving application code unchanged. On Linux it installs as an RPM or Debian package for x86_64 or aarch64; on macOS and Windows, AWS documents a short Dockerfile and does not publish a prebuilt image. Rust tests can use an embedded mode that runs the emulator inside the test process and wires its HTTP client into the AWS SDK for Rust. An aws-emulator skill can start the emulator for coding agents and check a project against published fidelity tests. Written in Rust, it is generated from more than 400 Smithy API models AWS publishes for the SDKs, according to Swaminathan Sivasubramanian.
AWS 表示,代码由智能体编写并测试。AWS 高级首席工程师 Matthew Goldberg 介绍了三个团队:一个团队根据公开 API 模型编写保真度测试,并通过真实 AWS 服务验证这些测试;一个团队重放这些测试并提交问题;另一个团队负责实现每项修复。每项更改都必须通过合并门禁检查,包括编译、编码规范、安全性和保真度回归。该工作运行在 Amazon Bedrock AgentCore Runtime Instances、AWS CodePipeline 和 AWS CodeCommit 上。AWS says agents wrote and tested the code. Matthew Goldberg, a senior principal engineer at AWS, describes three teams: one writes fidelity tests from the public API models and verifies them against real AWS, one replays those tests and files issues, and one implements each fix. Every change must pass a merge gate that checks compilation, coding standards, security, and fidelity regressions. The work runs on Amazon Bedrock AgentCore Runtime Instances, AWS CodePipeline, and AWS CodeCommit.
模拟器与 AWS 的匹配程度因服务而异。AWS 会在每次发布时公布带版本号的保真度测试和各服务的评分;只有当每次调用都与 AWS 一致(包括状态码、副作用和精确错误信息)时,测试才算通过。尚未实现的操作会返回 HTTP 501,错误代码为 NotImplemented。AWS 表示,模拟器在控制平面 API 方面的保真度最高,而数据平面行为以及对 CloudFormation、Terraform 和 AWS CDK 的支持则因服务而异。文档中列出的限制包括:不评估 IAM 策略或基于资源的策略,因此不得用于安全测试;每个进程仅共享一个账户和一个 Region;状态保存在内存中,进程停止后便会消失;不适用于长时间运行或负载测试。评估套件中包含模拟器尚未通过的测试。How closely the emulator matches AWS varies by service. AWS publishes versioned fidelity tests and per-service scores with each release; a test passes only when every call matches AWS, including status codes, side effects, and exact errors. Unimplemented operations return HTTP 501 with the error code NotImplemented. AWS says fidelity is closest on control-plane APIs, while data-plane behavior and support for CloudFormation, Terraform, and the AWS CDK vary by service. Documented limits include no evaluation of IAM or resource-based policies, so it must not be used to test security; a single shared account and Region per process; in-memory state that disappears when the process stops; and no testing for long-running use or load. The evaluation suite includes tests the emulator does not yet pass.
开发者已经有多个本地 AWS 替代方案,包括 LocalStack、Floci 和 moto。AWS Emulator 基于 AWS 自身的 API 模型生成,提供官方保真度评分,并已贡献至公有领域;但它无法直接替代这些工具所支持的所有工作流,尤其是在权限测试和基础设施即代码流水线方面。Developers already have several local AWS stand-ins, including LocalStack, Floci, and moto. AWS Emulator is generated from AWS's own API models, ships official fidelity scores, and is dedicated to the public domain, but it is not a drop-in replacement for every workflow those tools cover, especially permission testing and infrastructure-as-code pipelines.
开发者 Josh Builds 写道:Developer Josh Builds wrote:
AWS 刚刚发布了其 API 的免费本地模拟器,专为编程智能体打造,且完全由智能体编写。我统计了它公布的保真度测试结果:S3、DynamoDB 和 SQS 的通过率约为三分之二,CloudFormation 则不到五分之一。AWS just released a free local emulator of its APIs, made for coding agents and written entirely by agents. I counted its published fidelity tests: S3, DynamoDB and SQS pass about 2 in 3. CloudFormation passes under 1 in 5.
Yurii Serhiichuk 将其与现有模拟器进行了比较,并发布了一个容器镜像和一个 GitHub Action,以弥补打包方面的缺口:Yurii Serhiichuk compared it with existing emulators and published a container image and GitHub Action to cover a packaging gap:
AWS 今天发布了 AWS Emulator——可以把它看作原生实现的 LocalStack/Floci。它是用 Rust 编写的,由智能体构建(所以希望更新速度能挺快)。不过目前还没有公开的 Docker 镜像,也没有 GitHub Action。所以我就把这部分补上了。AWS shipped AWS Emulator today - think LocalStack/Floci but native. Rust, built by agents (so hopefully it gets updated pretty fast). No public docker image though, and no GitHub action. So I filled that part.
AWS Emulator 现已正式发布,且不收取额外服务费用。源代码托管在 GitHub 上,采用 CC0 1.0 Universal 公共领域贡献协议;但 vendor/ 目录中的第三方代码除外,该目录中的代码采用 Apache License 2.0。设置详情请参阅用户指南,每个版本均附带保真度评分。AWS Emulator is generally available at no additional service fee. Source is on GitHub under the CC0 1.0 Universal public domain dedication, except third-party code in the vendor/ directory, which is under the Apache License 2.0. Setup details are in the user guide, and fidelity scores ship with each release.