aws-lite

A simple, fast, extensible AWS client

README

aws-lite


aws-lite is simple, extremely fast, extensible Node.js client for interacting with AWS services.

(It's got good error reporting, too.)

You can think of it as a community-driven alternative to AWS's JavaScript SDK.

Who made this?
So, what is aws-lite?
Why not use aws-sdk / @aws-sdk/*?
Features
Install aws-lite
Example
Learn more
Client configuration
Requests / responses
Using TypeScript
Plugin API
Performance
Contributing

List of official @aws-lite/* plugins

Who made this?


aws-lite is developed and maintained by the folks at OpenJS Foundation Architect . We <3 AWS!

So, what is aws-lite?


aws-lite is a simple, extremely fast, extensible Node.js client for interacting with AWS services.

(It's got good error reporting, too.)

You can think of it as a community-driven alternative to AWS's JavaScript SDK.

Why not use aws-sdk/ @aws-sdk/*?


Amazon has historically done a great job of maintaining its SDKs. However, AWS has deprecated its widely-adopted v2 SDK; its v3 SDK relies on generated code, resulting in large dependencies, poor performance, awkward semantics, difficult to understand documentation, and errors without usable stack traces.

We rely on and believe in AWS, so we built aws-lite to provide a simpler, faster, more stable position from which to work with AWS services in Node.js.

Features


2-5x faster than AWS SDK v3
Simple semantics & straightforward promise-based interface
Human-readable documentation
Customizable
Errors with stack traces and line numbers
Built-in pagination
Secured with AWS Signature v4
Interacts with any AWS service without needing any plugins
Automatically parses / serializes JSON, AWS-flavored JSON, and XML request / response payloads
Easily integrates with local testing suites and AWS service mocks
Use existing service plugins, or develop your own
Debug mode for inspecting raw requests and responses
Just two dependencies

Install aws-lite


Install the client:

  1. ``` shell
  2. npm i @aws-lite/client
  3. ```

You can use the client as-is to quickly interact with AWS service APIs, or extend it with specific service plugins like so:

  1. ``` shell
  2. npm i @aws-lite/dynamodb
  3. ```

Generally, types are available as optional @aws-lite/*-typespackages, and can be added like so:

  1. ``` shell
  2. npm i -D @aws-lite/dynamodb-types
  3. ```

Learn more about aws-lite types.

Example


Now start making calls to AWS:

  1. ``` js
  2. // Instantiate a client with the DynamoDB plugin
  3. import awsLite from '@aws-lite/client'
  4. const aws = await awsLite({ region: 'us-west-1', plugins: [ import('@aws-lite/dynamodb') ] })

  5. // Easily interact with the AWS services your application relies on
  6. await aws.DynamoDB.PutItem({
  7.   TableName: '$table-name',
  8.   Item: {
  9.     // AWS-lite automatically de/serializes DynamoDB JSON
  10.     pk: '$item-key',
  11.     data: {
  12.       ok: true,
  13.       hi: 'friends'
  14.     }
  15.   }
  16. })

  17. await aws.DynamoDB.GetItem({
  18.   TableName: '$table-name',
  19.   Key: { pk: '$item-key' }
  20. })
  21. // {
  22. //   Item: {
  23. //     pk: '$item-key',
  24. //     data: data: {
  25. //       ok: true,
  26. //       hi: 'friends'
  27. //     }
  28. //   }
  29. // }

  30. // Use the lower-level client to fire a GET request by specifying a `service` and `endpoint`
  31. await aws({
  32.   service: 'lambda',
  33.   endpoint: '/2015-03-31/functions/$function-name/configuration',
  34. })
  35. // {
  36. //   FunctionName: '$function-name',
  37. //   Runtime: 'nodejs20.x',
  38. //   ...
  39. // }

  40. // POST JSON by adding a `payload` property
  41. await aws({
  42.   service: 'lambda',
  43.   endpoint: '/2015-03-31/functions/$function-name/invocations',
  44.   payload: { ok: true },
  45. })
  46. ```

Learn more


Client configuration


Credential and general configuration options for aws-lite

Requests / responses


Using aws-lite to make requests and receiving responses

Using TypeScript


Guide and examples for using TypeScript with aws-lite

Plugin API


Docs and examples for the aws-liteplugin API

Performance


Open, reproducible, real-world metrics for the performance of aws-liteand other AWS SDKs

Contributing


Open source contributor guidelines, methodology, and instructions

List of official @aws-lite/*plugins


ACM
API Gateway V2
API Gateway WebSocket Management API
CloudFormation
CloudFront
CloudWatch Logs
DynamoDB
IAM
Lambda
Organizations
RDS Data Service
Route 53
S3
SNS
SQS
SSM
STS