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' }));npm install -D @seokju-na/aws-emulator-node
yarn add -D @seokju-na/aws-emulator-node
pnpm add -D @seokju-na/aws-emulator-nodeThe 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>.nodeTo override default directory, set the environment variable.
SEOKJU_NA_AWS_EMULATOR_NODE_BINDING_DIR=~/my/custom/directoryIf 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 |
| OS | x64 | arm64 |
|---|---|---|
| macOS | Not Supported | darwin-arm64 |
Currently, only supports macOS darwin-arm64 architecture.
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.
| 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. |