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.

referencess3.md

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

S3 Reference

Presigned URLs (GET / PUT)

import { S3Client, GetObjectCommand, PutObjectCommand } from "@aws-sdk/client-s3";
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";

const client = new S3Client({ region: "us-east-1" });

// GET — default expiry 900s
const getUrl = await getSignedUrl(client, new GetObjectCommand({ Bucket: "b", Key: "k" }), { expiresIn: 3600 });

// PUT
const putUrl = await getSignedUrl(client, new PutObjectCommand({ Bucket: "b", Key: "k" }), { expiresIn: 3600 });

Signing non-x-amz headers (e.g. Content-Type):

const url = await getSignedUrl(client, new PutObjectCommand({ Bucket: "b", Key: "k", ContentType: "image/png" }), {
  signableHeaders: new Set(["content-type"]),
  expiresIn: 3600,
});

Signing x-amz-* headers (must use unhoistableHeaders):

const url = await getSignedUrl(client, new PutObjectCommand({ Bucket: "b", Key: "k", ChecksumSHA256: sha }), {
  unhoistableHeaders: new Set(["x-amz-checksum-sha256"]),
  expiresIn: 3600,
});

Presigned POST (browser file upload)

import { createPresignedPost } from "@aws-sdk/s3-presigned-post";

const { url, fields } = await createPresignedPost(client, {
  Bucket: "b",
  Key: "uploads/${filename}",  // ${filename} replaced by browser
  Expires: 600,
  Conditions: [["content-length-range", 0, 10485760]],
  Fields: { acl: "bucket-owner-full-control" },
});
// Use url + fields in an HTML <form> or FormData POST

Multipart Upload (lib-storage)

Use @aws-sdk/lib-storage for large files, streams, or unknown-size bodies:

import { Upload } from "@aws-sdk/lib-storage";
import { S3Client } from "@aws-sdk/client-s3";

const upload = new Upload({
  client: new S3Client({}),
  params: { Bucket: "b", Key: "k", Body: readableStream },
  queueSize: 4,          // parallel part uploads (default 4)
  partSize: 5 * 1024 * 1024, // min 5MB per part
  leavePartsOnError: false,
});

upload.on("httpUploadProgress", (progress) => console.log(progress));
await upload.done();

Waiters

import { S3Client } from "@aws-sdk/client-s3";
import { waitUntilBucketExists, waitUntilObjectExists } from "@aws-sdk/client-s3";

const client = new S3Client({});

await waitUntilBucketExists({ client, maxWaitTime: 60 }, { Bucket: "my-bucket" });
await waitUntilObjectExists({ client, maxWaitTime: 120 }, { Bucket: "my-bucket", Key: "my-key" });

Available S3 waiters: waitUntilBucketExists, waitUntilBucketNotExists, waitUntilObjectExists, waitUntilObjectNotExists.

Waiter config: maxWaitTime (seconds, required), minDelay (default 5s), maxDelay (default 120s).

Other services export their own waitUntil* functions from the same client package.

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