Skip to content

About

Unofficial AWS Emulator for Node.js

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

aws-emulator-node

Unofficial AWS Emulator for Node.js.

AWS Emulator embedded mode, built into a Node.js native addons with napi-rs. The emulator runs inside Node.js process.

import { S3Client, CreateBucketCommand } from '@aws-sdk/client-s3';
import { AwsEmulator } from '@seokju-na/aws-emulator-node';

await using aws = new AwsEmulator({ closeTimeout: 5_000 });

const s3 = new S3Client(aws.clientConfig());
await s3.send(new CreateBucketCommand({ Bucket: 'my-bucket' }));

Install

npm install -D @seokju-na/aws-emulator-node
yarn add -D @seokju-na/aws-emulator-node
pnpm add -D @seokju-na/aws-emulator-node

The native binding (~1GB) is too large for the npm tarball. postinstall downloads this platform's binary from the package version's GitHub release to:

~/.aws/emulator-node/<version>/aws-emulator-node.<triple>.node

To override default directory, set the environment variable.

SEOKJU_NA_AWS_EMULATOR_NODE_BINDING_DIR=~/my/custom/directory

If your package manager skipped the postinstall script, the binding is missing and loading the package throws an error with these same steps. Allow the script, then re-run it:

Package Manager Allow the script
npm Runs by default; make sure ignore-scripts is not set
pnpm pnpm approve-builds, or onlyBuiltDependencies: ['@seokju-na/aws-emulator-node'] in pnpm-workspace.yaml
yarn Add "dependenciesMeta": { "@seokju-na/aws-emulator-node": { "built": true } } to package.json

Platforms

OS x64 arm64
macOS Not Supported darwin-arm64

Currently, only supports macOS darwin-arm64 architecture.

Upstream

The native binding is built from aws/aws-emulator v1.0.353 (commit ca8a89de), checked out as a git submodule at vendor/aws-emulator. The submodule stays at that upstream commit.

Patches

Patch Change Reason
0001-lambda-getrusage-non-linux.patch On non-Linux targets, the Lambda Python runtime counts page faults with getrusage(RUSAGE_SELF) instead of RUSAGE_THREAD. RUSAGE_THREAD exists only on Linux, so upstream does not compile on macOS. On macOS the count covers the whole process, so the runtime's memory limit is less precise.

License

  • MIT for this repository's own code.
  • The vendored AWS Emulator keeps its licenses (CC0-1.0, and Apache-2.0 for its vendor/), and the native binding statically links many third-party crates under their own licenses.
  • See LICENSE and NOTICE.

About

Unofficial AWS Emulator for Node.js

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages