AWS Finally Built Its Own AWS Emulator

Hacker News by 6 min read 41x views
AWS Finally Built Its Own AWS Emulator

Share Post

AWS Emulator is a local emulator of the AWS APIs. You use it to test your application without calling AWS, on your own machine, on a betterment server, or in uninterrupted integration (CI). You don’t need an AWS account. Your requests go to the emulator, not to AWS. So you activity alongside emulated resources alternatively of AWS resources. AWS Emulator has no additional assistance fee. You pay lone for AWS resources whenever you deploy on AWS.

The emulator is a local program that serves an AWS API endpoint. It has no graphical interface. After you commencement the emulator, you set surroundings variables to item the AWS CLI or an AWS SDK at its endpoint. Then you run your code as usual. In embedded mode, you continue the emulator’s HTTP client to your SDK instead.

AWS Emulator is for construction and testing. Don’t use it for manufacturing workloads or to test security. See Security in AWS Emulator.

Documentation: AWS Emulator User Guide

Install the aws-emulator skill, afterward ask your delegate to set up the emulator. This needs the AWS CLI type 2.35.0 or later. See Getting started alongside an AI coding agent.

aws agent-toolkit add-skill --skill-name aws-emulator --region us-east-1

Server manner (CLI and any SDK)

Point your SDK at a operating emulator by environment surroundings variables. See Pointing your AWS SDK at AWS Emulator.

Embedded manner (Rust tests)

Add the emulator as a dev-dependency and run it in-process, one secluded case per test. There is no endpoint URL, certificate, or surroundings changeable to set. Your test wires the emulator's HTTP client direct into the SDK client. See Getting started alongside embedded mode, and Building from source below for its build cost.

To see how closely all assistance matches AWS, inspect the fidelity scores published alongside all publish on the releases page. To inspect whether your own project is expected to work, see Checking whether your project plant alongside AWS Emulator.

Individual gaps are tracked in the repository's issues/ directory. APIs and behaviors that don't activity yet are under issues/things-that-do-not-work/, and ones that have since been fixed move to issues/things-that-now-work/.

You need this if you are modifying the emulator, operating it from a checkout, or using embedded mode. Embedded manner compiles the emulator into your test binary, so the prerequisites and build-cost direction below use to it too. Most another users instal a prebuilt bundle alternatively (see Quick start). Building from origin is supported on Linux (x86_64 and aarch64); on Windows and macOS, use the Docker way above.

  • A Rust toolchain alongside Cargo (install via rustup).
  • A C compiler, specified as GCC or clang. Some requirements build C code.
  • At smallest 100 GB of liberated disk for target/. The workspace has one crate per AWS service, so a debug build of everything is large, and it grows as services are added.
  • A multi-core machine. A chilly complete build compiles all assistance crate, so the archetypal build takes a while; small cores obtain proportionally longer. After that, rebuilding following a alter to one assistance is much faster.
cargo build -p aws-emulator-router cargo run -p aws-emulator-router

The emulator serves HTTPS on 127.0.0.1:9297 (self-signed certificate).

Embedded manner compiles the emulator into your test binary, so your project's archetypal cargo test builds the emulator's assistance crates alongside your own code. Budget a archetypal build and target/ on the identical command as construction from origin above, afterward accelerated incremental builds. Recommendation: reuse one CARGO_TARGET_DIR throughout projects, cache target/ (or use sccache) in CI, and pin the emulator to a publish commit so it isn't rebuilt on all change.

. ├── Cargo.toml # workspace: one associate per service, affirmative the center crates ├── services/ │ └── service-<name>/ # ONE CRATE PER SERVICE │ ├── smithy-model/ # <name>.json — the Smithy example that drives the cable protocol │ ├── build.rs # generates the assistance declaration from the model │ ├── src/ │ │ ├── service.rs # petition routing and refusal overrides │ │ ├── state.rs # this service's in-memory state │ │ └── ops/ # one document per operation │ └── tests/ ├── core/ │ ├── router/ # the emulator binary: mounts all assistance on one endpoint │ └── embedded/ # the in-process (embedded mode) facade ├── vendor/ # example crates — do not edit (replaced on update) └── issues/ # tracked fidelity issues 

AWS Emulator is configured to collect and study use data to AWS, to acquire understanding into how AWS Emulator is used. Telemetry is on by default. AWS Emulator collects telemetry data alongside strict data minimization in mind, preventing acknowledgment or attribution to particular users, accounts, or organizations. Its records never contain what’s in your requests or responses, your code, your credentials, or individual data. We don’t portion telemetry alongside third parties.

For particulars on what is collected and how the data is handled, see Telemetry in AWS Emulator. To rotate telemetry off, use among the following options.

Use a command-line option

Start the emulator alongside the --telemetry choice (short form -t) set to off. This environment applies lone to that emulator process.

aws-emulator --telemetry off

In a container, add --telemetry off following the depiction name in the docker run command.

Use an surroundings variable

Set EMULATOR_TELEMETRY to off before you commencement the emulator. This environment applies to all emulator that you commencement from that shell.

EMULATOR_TELEMETRY accepts on, true, or 1 to rotate telemetry on, and off, false, or 0 to rotate it off. Values aren’t case sensitive. Any another value turns telemetry off, and the startup notice shows a warning.

export EMULATOR_TELEMETRY=off aws-emulator

To rotate telemetry off for all run on a machine, add these lines to the emulator settings file, config.toml. The document is ~/.aws/emulator/config.toml on Linux and macOS, and %USERPROFILE%\.aws\emulator\config.toml on Windows. To use a distinct file, set the EMULATOR_CONFIG surroundings changeable to its path.

[telemetry] enabled = false

Use the embedded configuration API

In embedded mode, rotate off telemetry in the options that you continue whenever you create the emulator.

use aws_emulator_embedded::{AwsEmulatorEmbedded, EmbeddedOptions, Telemetry}; fn main() { let emulator = AwsEmulatorEmbedded::new(EmbeddedOptions::default().telemetry(Telemetry::Off)); let _http_client = emulator.http_client(); }

You power build a tool that includes the emulator, specified as a test example that another group run. If you do, inform your users concerning telemetry and provision them a way to rotate it off. You can additionally container your tool alongside telemetry off.

Reporting issues and contributing

Report bugs and fidelity gaps in GitHub Issues. The most helpful study names the service, the operation, your SDK and version, the petition you sent, and how the reply differed from genuine AWS. This repository does not obtain PRs.

This application is licensed under the CC0 1.0 Universal (CC0-1.0) License, apart from the code in the vendor/ directory, which is under the Apache License 2.0. See LICENSE for details, and vendor/README.md for the licence of the code in vendor/.

Other Article Hacker News
↑
Close Right Ads
Close Left Ads