← AWS CoreCONTENT HISTORYWHAT CHANGED · RULE-BASED ANALYSIS
Update to AWS Core
Snapshot Sep 30, 2026 · 22:47 UTC · version 1.0.0
Collection source: not recorded for this historical snapshot.
First saved snapshot
No earlier snapshot is available to establish a change.
Compare saved observations
Download comparison JSONFull technical diff · 0 changed fields
Full snapshot data
{
"name": "aws-sdk-js-v3-usage",
"description": "AWS SDK for JavaScript v3 development patterns. Use when writing JavaScript or TypeScript code that uses AWS services via @aws-sdk/* packages (aws-sdk-js-v3), or when asked about schemas, runtime validation, serialization, or code generation in the context of the JS/TS AWS SDK.",
"included_files": [
{
"relative_path": "references/clients.md",
"size_in_bytes": 3667
},
{
"relative_path": "references/credentials.md",
"size_in_bytes": 3481
},
{
"relative_path": "references/dynamodb.md",
"size_in_bytes": 2908
},
{
"relative_path": "references/effective-practices.md",
"size_in_bytes": 2307
},
{
"relative_path": "references/error-handling.md",
"size_in_bytes": 1665
},
{
"relative_path": "references/lambda.md",
"size_in_bytes": 1781
},
{
"relative_path": "references/performance.md",
"size_in_bytes": 1979
},
{
"relative_path": "references/s3.md",
"size_in_bytes": 2723
},
{
"relative_path": "references/schemas.md",
"size_in_bytes": 1710
},
{
"relative_path": "references/sigv4a.md",
"size_in_bytes": 1543
},
{
"relative_path": "references/typescript.md",
"size_in_bytes": 1083
}
],
"skill_md_contents": "---\nname: aws-sdk-js-v3-usage\ndescription: |\n AWS SDK for JavaScript v3 development patterns. Use when writing JavaScript or TypeScript code that uses AWS services via @aws-sdk/* packages (aws-sdk-js-v3), or when asked about schemas, runtime validation, serialization, or code generation in the context of the JS/TS AWS SDK.\n---\n\n> Do not use emojis in any code, comments, or output when this skill is active.\n\n# AWS SDK for JavaScript v3\n\n## Package Structure\n\n- `@aws-sdk/client-*` — one per service, generated by [smithy-typescript](https://github.com/awslabs/smithy-typescript); one-to-one with AWS services and operations\n- `@aws-sdk/lib-*` — higher-level helpers (e.g. `lib-dynamodb`, `lib-storage`)\n- `@aws-sdk/*` (no prefix) — utility packages (mostly internal; don't import deep paths)\n\nAlways import from the package root:\n\n```js\nimport { S3Client } from \"@aws-sdk/client-s3\"; // correct\n// NOT: import { S3Client } from \"@aws-sdk/client-s3/dist-cjs/S3Client\"\n```\n\n## Two Client Styles\n\n**Bare-bones** (preferred — smaller bundle):\n\n```js\nimport { S3Client, GetObjectCommand } from \"@aws-sdk/client-s3\";\nconst client = new S3Client({ region: \"us-east-1\" });\nconst output = await client.send(new GetObjectCommand({ Bucket: \"b\", Key: \"k\" }));\n```\n\n**Aggregated** (v2-style but NOT v2, larger bundle):\n\n```js\nimport { S3 } from \"@aws-sdk/client-s3\";\nconst client = new S3({ region: \"us-east-1\" });\nconst output = await client.getObject({ Bucket: \"b\", Key: \"k\" });\n```\n\n## Client Configuration\n\nNo global config in v3 — pass config to each client. `region` is always required; set it explicitly or via `AWS_REGION` env var.\n\n```js\nconst config = { region: \"us-east-1\", maxAttempts: 5 };\nconst s3 = new S3Client(config);\nconst dynamo = new DynamoDBClient(config);\n```\n\n**Do not read or mutate `client.config` after instantiation** — it is a resolved form (e.g. `region` becomes an async function). See `references/effective-practices.md`.\n\nFor HTTP handler (`NodeHttpHandler` from `@smithy/node-http-handler`), retry strategy, endpoint details, logging, FIPS, dual-stack, protocol selection, and S3-specific options → see `references/clients.md`.\n\n## Credentials\n\nAll providers from `@aws-sdk/credential-providers`. Credentials are lazy and cached per client until ~5 min before expiry.\n\n```js\n// Default chain (env → ini → IMDS/ECS) — use in most Node.js apps\nconst client = new S3Client({ credentials: fromNodeProviderChain() });\n\n// Assume role (NOTE: fromTemporaryCredentials is correct for STS AssumeRole)\nconst client = new S3Client({\n credentials: fromTemporaryCredentials({ params: { RoleArn: \"arn:aws:iam::123456789012:role/MyRole\" } }),\n});\n\n// Named profile\nconst client = new S3Client({ profile: \"my-profile\" });\n```\n\nShare credentials and socket pool across multi-region clients:\n\n```js\nconst east = new S3Client({ region: \"us-east-1\" });\nconst { credentials, requestHandler } = east.config;\nconst west = new S3Client({ region: \"us-west-2\", credentials, requestHandler });\n```\n\nFor all providers (Cognito, SSO, web identity, custom chains, STS region priority) → see `references/credentials.md`.\n\n## Streams (e.g. S3 GetObject Body)\n\n**Always read or discard streaming responses** — unread streams leave sockets open (socket exhaustion):\n\n```js\nconst { Body } = await client.send(new GetObjectCommand({ Bucket: \"b\", Key: \"k\" }));\nconst str = await Body.transformToString(); // read as string\nconst bytes = await Body.transformToByteArray(); // read as Uint8Array\n// or discard:\nawait (Body.destroy?.() ?? Body.cancel?.());\n```\n\nStreams can only be read once.\n\n## Paginators\n\nUse `paginate*` functions instead of manual token handling:\n\n```js\nimport { DynamoDBClient, paginateListTables } from \"@aws-sdk/client-dynamodb\";\n\nconst client = new DynamoDBClient({});\n\nconst tableNames = [];\nfor await (const page of paginateListTables({ client }, {})) {\n // page contains a single paginated output.\n tableNames.push(...page.TableNames);\n}\n```\n\n## DynamoDB DocumentClient\n\nUse `@aws-sdk/lib-dynamodb` to work with native JS types instead of AttributeValues:\n\n```js\nimport { DynamoDBClient } from \"@aws-sdk/client-dynamodb\";\nimport { DynamoDBDocumentClient, GetCommand, PutCommand } from \"@aws-sdk/lib-dynamodb\";\n\nconst client = DynamoDBDocumentClient.from(new DynamoDBClient({}));\nawait client.send(new PutCommand({ TableName: \"T\", Item: { id: \"1\", name: \"Alice\" } }));\nconst { Item } = await client.send(new GetCommand({ TableName: \"T\", Key: { id: \"1\" } }));\n```\n\nFor marshall options, large numbers (NumberValue), pagination, and aggregated client → see `references/dynamodb.md`.\n\n## S3: Presigned URLs, Multipart Upload, Waiters\n\n```js\n// Presigned GET URL\nimport { getSignedUrl } from \"@aws-sdk/s3-request-presigner\";\nconst url = await getSignedUrl(client, new GetObjectCommand({ Bucket: \"b\", Key: \"k\" }), { expiresIn: 3600 });\n\n// Multipart upload (large files / streams)\nimport { Upload } from \"@aws-sdk/lib-storage\";\nconst upload = new Upload({ client, params: { Bucket: \"b\", Key: \"k\", Body: stream } });\nawait upload.done();\n\n// Waiters\nimport { waitUntilObjectExists } from \"@aws-sdk/client-s3\";\nawait waitUntilObjectExists({ client, maxWaitTime: 120 }, { Bucket: \"b\", Key: \"k\" });\n```\n\nFor presigned POST, signed headers, waiter options → see `references/s3.md`.\n\n## Error Handling\n\n```js\nimport { S3ServiceException } from \"@aws-sdk/client-s3\";\n\ntry {\n await client.send(new GetObjectCommand({ Bucket: \"b\", Key: \"k\" }));\n} catch (e) {\n if (e?.$metadata) {\n // SDK service error — has $metadata.httpStatusCode, e.name, e.$response\n console.error(e.name, e.$metadata.httpStatusCode);\n }\n}\n```\n\nCheck `e.name` or `instanceof` for specific error types. See `references/error-handling.md` for full patterns.\n\nFor **runtime validation, serialization to non-default formats, or questions about what schemas are** in jsv3 → see `references/schemas.md`.\n\n## Performance: Parallel Workloads\n\n```js\n// Configure maxSockets to match your parallel batch size\nconst client = new S3Client({\n requestHandler: { httpsAgent: { maxSockets: 50 } },\n cacheMiddleware: true, // skip if using custom middleware\n});\n```\n\n**Streaming deadlock warning**: with limited sockets, don't `await` the request and stream body separately — chain them. See `references/performance.md`.\n\n## Middleware\n\nAdd custom logic to all commands on a client:\n\n```js\nclient.middlewareStack.add(\n (next, context) => async (args) => {\n console.log(context.commandName, args.input);\n const result = await next(args);\n return result;\n },\n { name: \"MyMiddleware\", step: \"build\", override: true }\n);\n```\n\nSteps (in order): `initialize` → `serialize` → `build` → `finalizeRequest` → `deserialize`\n\n## Abort Controller\n\n```js\nconst { AbortController } = require(\"@aws-sdk/abort-controller\");\nconst { S3Client, CreateBucketCommand } = require(\"@aws-sdk/client-s3\");\n\nconst abortController = new AbortController();\nconst client = new S3Client(clientParams);\n\nconst requestPromise = client.send(new CreateBucketCommand(commandParams), {\n abortSignal: abortController.signal,\n});\n\n// The request will not be created if abortSignal is already aborted.\n// The request will be destroyed if abortSignal is aborted before response is returned.\nabortController.abort();\n\n// This will fail with \"AbortError\" as abortSignal is aborted.\nawait requestPromise;\n```\n\n## Lambda Best Practices\n\nInitialize clients **outside** the handler (container reuse), make API calls **inside**. For one-time async setup, use a lazy init flag inside the handler:\n\n```js\nimport { S3Client } from \"@aws-sdk/client-s3\";\n\nconst client = new S3Client({}); // outside — reused across invocations\n\nlet ready = false;\nexport const handler = async (event) => {\n if (!ready) { await prepare(); ready = true; } // lazy one-time setup inside handler\n // ... API calls here\n};\n```\n\nSee `references/lambda.md` for Lambda layers and versioning.\n\n## Node.js Version Requirements\n\n- v3.968.0+ requires Node.js >= 20\n- v3.723.0+ requires Node.js >= 18\n\n## TypeScript\n\nResponse fields are typed as `T | undefined` by default. Use `AssertiveClient` from `@smithy/types` to remove `| undefined`, or `NodeJsClient` / `BrowserClient` to narrow streaming blob types. See `references/typescript.md`.\n\n## SigV4a (S3 Multi-Region Access Points)\n\nS3 MRAP and certain other features require SigV4a. You must install and side-effect-import exactly one of:\n\n- `@aws-sdk/signature-v4-crt` — Node.js only, better performance\n- `@aws-sdk/signature-v4a` — Node.js + browsers, pure JS\n\n```js\nimport \"@aws-sdk/signature-v4a\"; // side-effect only — no exported values needed\n```\n\nSee `references/sigv4a.md` for full details and MRAP ARN format.\n"
}SHA-256: 87f96b7eefa2d4aec238962e37e6c5a8309c76cfbda46c1f41e065fa73f6ce44