{"id":15525,"library":"aws-client","title":"Minimalist AWS Client for Node.js","description":"aws-client is a minimalist Node.js client library providing simplified access to a subset of AWS services. Currently, it supports core operations for DynamoDB (get, batchGet, put, batchPut, query) via `DynamoClient` and SNS (publish) via `SNSClient`. The package is at version 3.0.6 and appears to be actively maintained, with an ongoing migration of \"v1 functions\" to \"v2 functions.\" A key differentiator is its focus on minimalism and efficiency: v2 functions leverage the modular packages of the AWS SDK v3 internally, reducing the overall dependency footprint compared to requiring the full `aws-sdk` package. However, users employing older \"v1 functions\" must still explicitly install `aws-sdk` as a peer dependency, a requirement that will be phased out as the migration completes.","status":"active","version":"3.0.6","language":"javascript","source_language":"en","source_url":"https://github.com/chrisgitrepo/aws-client","tags":["javascript","aws","client","api","dynamo","sns"],"install":[{"cmd":"npm install aws-client","lang":"bash","label":"npm"},{"cmd":"yarn add aws-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add aws-client","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for 'v1 functions'. 'v2 functions' use modular AWS SDK v3 packages internally and do not require this explicit dependency.","package":"aws-sdk","optional":true}],"imports":[{"note":"ES6 named import. For CommonJS, use destructuring `const { DynamoClient } = require('aws-client')`.","wrong":"const DynamoClient = require('aws-client').DynamoClient","symbol":"DynamoClient","correct":"import { DynamoClient } from 'aws-client'"},{"note":"ES6 named import. For CommonJS, use destructuring `const { SNSClient } = require('aws-client')`.","wrong":"const SNSClient = require('aws-client').SNSClient","symbol":"SNSClient","correct":"import { SNSClient } from 'aws-client'"},{"note":"The library exports named clients, not a default export or a single object containing all clients. Always use named imports or destructuring require.","wrong":"import awsClient from 'aws-client'; const dynamo = new awsClient.DynamoClient(...)","symbol":"{ DynamoClient, SNSClient }","correct":"import { DynamoClient, SNSClient } from 'aws-client'"}],"quickstart":{"code":"import { DynamoClient } from 'aws-client';\n\nconst client = new DynamoClient({\n  region: 'eu-west-1',\n  tableName: 'users-prod'\n});\n\nconst getUser = async (id) => {\n  try {\n    const data = await client.get({ id });\n    console.log('User data:', data);\n  } catch (error) {\n    console.error('Error fetching user:', error.message);\n  }\n};\n\ngetUser('fred');\n// Example: batch operations (if 'users-prod' has items with ids 'fred' and 'jane')\n// const getMultipleUsers = async () => {\n//   const data = await client.batchGet(['fred', 'jane']);\n//   console.log('Batch user data:', data);\n// };\n// getMultipleUsers();","lang":"javascript","description":"Demonstrates initializing a DynamoClient and fetching an item by ID. Includes error handling and shows the minimalist API for a common DynamoDB operation."},"warnings":[{"fix":"If using `v1` functions, run `npm install aws-sdk`. It is recommended to migrate to the `v2` functions as `v1` functions will eventually be deprecated and removed.","message":"Prior to version 2, `aws-client` functions required the full `aws-sdk` package. With the introduction of 'v2 functions' in version 2, the library began using modular AWS SDK v3 packages internally. However, if you are still using 'v1 functions', you *must* explicitly install `aws-sdk` as a separate dependency.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Consult the package documentation for the list of supported services and operations. For broader AWS service coverage or unsupported operations, consider using the official AWS SDK directly.","message":"`aws-client` is intentionally minimalist and only supports a limited set of operations for DynamoDB and SNS. It does not provide full coverage of all AWS services or all operations within supported services. Attempting to use an unsupported service or operation will result in runtime errors.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Run `npm install aws-sdk` if you intend to use 'v1' functions. Otherwise, refactor your code to use 'v2' functions which do not have this dependency.","cause":"Legacy 'v1' functions were used without installing the `aws-sdk` package, which became an optional peer dependency for those functions starting in v2.","error":"Error: Cannot find module 'aws-sdk'"},{"fix":"Verify that the desired operation is listed in the `aws-client` documentation for the specific client (e.g., `DynamoClient`, `SNSClient`). If not supported, use the official AWS SDK directly for that operation.","cause":"Attempting to call an AWS service method that `aws-client` does not explicitly wrap or support. The library provides a minimalist API.","error":"TypeError: client.unsupportedMethod is not a function"}],"ecosystem":"npm"}