All skills
aws avatar

/aws-sdk-js-v3-usage

@c3ed514

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.

Use this Skill: https://skilld.dev/gh/aws/agent-toolkit-for-aws/aws-sdk-js-v3-usage

This session only. Nothing lands on disk.

referenceslambda.md

≈446 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Lambda Reference

SDK Version in Lambda Runtimes

Lambda bundles a specific SDK version — not the latest. To control the version, bundle the SDK with your function or use a Lambda layer.

Check the installed version:

const pkg = require("@aws-sdk/client-s3/package.json");
exports.handler = () => JSON.stringify(pkg);

Creating a Lambda Layer

// package.json for layer content
{
  "dependencies": {
    "@aws-sdk/client-s3": "<=3.750.0",
    "@aws-sdk/client-dynamodb": "<=3.750.0"
  }
}

Run npm install, then zip as:

layer_content.zip
└ nodejs/node_modules/@aws-sdk/...

Deploy:

import { Lambda } from "@aws-sdk/client-lambda";
import fs from "node:fs";

const lambda = new Lambda();
await lambda.publishLayerVersion({
  LayerName: "my-sdk-layer",
  Content: { ZipFile: fs.readFileSync("./layer_content.zip") },
  CompatibleRuntimes: ["nodejs20.x", "nodejs22.x"],
  CompatibleArchitectures: ["x86_64", "arm64"],
});

One-Time Async Initialization

Don't call async setup outside the handler — signed requests may expire during provisioned concurrency pre-warming. Use a lazy flag inside the handler instead:

// WRONG: risky — network requests may be frozen pre-flight
const ready = prepare();
export const handler = async (event) => { await ready; ... };

// OK: lazy init inside handler
let client = null;
export const handler = async (event) => {
  if (!client) client = await prepare();
  return client.getItem({ ... });
};

SDK clients themselves (no async setup) are safe to initialize outside the handler:

const s3 = new S3Client({}); // OK: outside handler — reused across invocations
export const handler = async (event) => {
  return s3.send(new GetObjectCommand({ ... }));
};

Source: SKILL.md on GitHub

No alerts17d3 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    This skill is a comprehensive documentation resource for the AWS SDK for JavaScript v3. It provides development patterns, best practices for credential management, resource handling, and performance optimization using official AWS packages and repositories.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

Signed by skilld at c3ed514. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 5 months ago

README badge

README badge for aws/agent-toolkit-for-aws/aws-sdk-js-v3-usage