opensite-ai/opensite-skills / aws-sdk-js-v3-usage
aws-sdk-js-v3-usage
UnverifiedAWS 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.
| File | Kind | Size |
|---|---|---|
| .aws-skill-metadata | other | 18 B |
| SKILL.md | skill md | 8.5 KB |
| references/clients.md | markdown | 3.6 KB |
| references/credentials.md | markdown | 3.4 KB |
| references/dynamodb.md | markdown | 2.8 KB |
| references/effective-practices.md | markdown | 2.3 KB |
| references/error-handling.md | markdown | 1.6 KB |
| references/lambda.md | markdown | 1.7 KB |
| references/performance.md | markdown | 1.9 KB |
| references/s3.md | markdown | 2.7 KB |
| references/schemas.md | markdown | 1.7 KB |
| references/sigv4a.md | markdown | 1.5 KB |
| references/typescript.md | markdown | 1.1 KB |
references/clients.md
View on GitHub# Client Configuration Reference
## Request Handler (HTTP)
### Node.js (shorthand, v3.521.0+)
```js
const client = new S3Client({
requestHandler: {
requestTimeout: 15_000, // ms to receive response
connectionTimeout: 6_000, // ms to establish connection
httpsAgent: { keepAlive: true, maxSockets: 50 },
},
});
```
### Node.js (explicit)
```js
import { NodeHttpHandler } from "@smithy/node-http-handler";
import https from "node:https";
const client = new S3Client({
requestHandler: new NodeHttpHandler({
httpsAgent: new https.Agent({ keepAlive: true, maxSockets: 200 }),
requestTimeout: 15_000,
connectionTimeout: 6_000,
}),
});
```
Default `maxSockets` is 50 per client. Socket exhaustion warning:
```text
@smithy/node-http-handler:WARN - socket usage at capacity=N and M additional requests are enqueued.
```
### Browser
```js
import { FetchHttpHandler } from "@aws-sdk/config/requestHandler";
const client = new S3Client({ requestHandler: new FetchHttpHandler({ requestTimeout: 30_000 }) });
```
XHR (for upload progress events):
```js
import { XhrHttpHandler } from "@aws-sdk/xhr-http-handler";
const handler = new XhrHttpHandler({ requestTimeout: 30_000 });
handler.on(XhrHttpHandler.EVENTS.UPLOAD_PROGRESS, (event) => { ... });
const client = new S3Client({ requestHandler: handler });
```
## Retry Strategy
```js
// Simple: set max attempts
new S3Client({ maxAttempts: 5 });
// Custom backoff
import { ConfiguredRetryStrategy } from "@aws-sdk/config/retryStrategy";
new S3Client({
retryStrategy: new ConfiguredRetryStrategy(5, (attempt) => 500 + attempt * 1_000),
});
// Adaptive (rate-limiting)
new S3Client({ retryMode: "ADAPTIVE" });
```
When `retryStrategy` is set, `retryMode` and `maxAttempts` are ignored.
## Logging
```js
// Enable SDK logging (suppress trace/debug)
new S3Client({
logger: { ...console, debug() {}, trace() {} },
});
```
For full request/response logging, use middleware (see SKILL.md Middleware section).
## Endpoint
```js
// Custom endpoint (e.g. local mock)
new S3Client({ endpoint: "http://localhost:8888" });
```
## FIPS / Dual-stack
```js
new S3Client({ useFipsEndpoint: true });
new S3Client({ useDualstackEndpoint: true });
```
## Retrieving the Endpoint Without Making a Request
**This interface is not public/stable.** Do not use in production, or verify it on every SDK version upgrade.
```ts
import { GetObjectCommand, S3Client } from "@aws-sdk/client-s3";
import { getEndpointFromInstructions } from "@smithy/middleware-endpoint";
const client = new S3Client({ region: "us-east-1" });
/** @internal do not directly use in production. */
const endpoint = await getEndpointFromInstructions(
{ Key: "foo", Bucket: "bar" }, // 1. command input
GetObjectCommand, // 2. Command class
client.config // 3. client config
);
```
## Protocol Selection (v3.953.0+)
Most services support only one protocol. CloudWatch and SQS support multiple:
```js
import { AwsJson1_0Protocol, AwsSmithyRpcV2CborProtocol } from "@aws-sdk/core/protocols";
new CloudWatch({ protocol: AwsJson1_0Protocol }); // default
new CloudWatch({ protocol: AwsSmithyRpcV2CborProtocol }); // CBOR
```
## Middleware Caching
```js
// Cache middleware stack per client+command — reduces per-request overhead.
// Do not use if you modify the middleware stack after requests begin.
new S3Client({ cacheMiddleware: true });
```
## S3-Specific Options
```js
// Retry with corrected region on 301 redirect (use only if bucket region is unknown)
new S3Client({ followRegionRedirects: true });
```
## Schemas (v3.953.0+)
See `references/schemas.md`.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |