AWS SDK v2 to v3 Converter for JavaScript & TypeScript

Paste aws-sdk v2 code and get modular @aws-sdk/client-* v3 code back, with clients, commands and imports rewritten. AWS SDK for JavaScript v2 reached end-of-support on September 8, 2025.

Your codeAWS SDK v2 (JS/TS)
Drop the file to load it
Tab indents · Esc, Tab exits
ResultAWS SDK v3 (JS/TS)
Your AWS SDK v3 (JS/TS) will appear hereClick Convert to v3 or press Ctrl Enter
converted-v3.js
Don't paste secrets

How to convert AWS SDK v2 code to v3

To convert AWS SDK v2 code to v3, paste the code into the editor above and press Convert to v3. The converter replaces each aws-sdk service object with a v3 client, turns each method call into client.send(new SomethingCommand(params)) and removes .promise(). Then install the @aws-sdk/* packages the result imports and run your tests.

  1. Add your v2 codePaste it into the AWS SDK v2 (JS/TS) editor, use Paste, Open file (.js, .mjs, .cjs, .jsx, .ts, .tsx or .txt, up to 500 KB) or drag a file onto the editor. Sample loads a DynamoDB and S3 example.
  2. Let the secret check runBefore anything is sent, the page looks for AWS access keys, secret keys, private keys and common API tokens in your code. If it finds one, it shows you where so you can swap it for a placeholder.
  3. Convert to v3Click Convert to v3 or press Ctrl + Enter. The v3 code streams into the right-hand editor, and you can stop it at any time. Each conversion takes up to 60,000 characters, so convert one file or module at a time.
  4. Review the resultRead the output side by side with your original. Look for TODO: comments, which mark places without a direct v3 equivalent. Use Wrap for long lines, then Copy or Download it as converted-v3.js.
  5. Install the clients and testAdd each package the new imports use, for example npm install @aws-sdk/client-s3, then run your tests before you remove aws-sdk from package.json.
Four-step AWS SDK v2 to v3 conversion workflow: paste v2 code, local secret check, streamed v3 conversion, install the v3 clients and test
The workflow: your code is checked for secrets in the browser before it's sent for conversion.

How this converter helps with your SDK v3 migration

AWS SDK for JavaScript v2 no longer gets updates or security fixes, and AWS Lambda's Node.js runtimes from nodejs18.x onward include SDK v3 but not v2. A function that imports aws-sdk fails on those runtimes unless you bundle v2 yourself. Moving to v3 is usually the simpler fix.

The migration is mostly mechanical, but there's a lot of it: every import, every client, every call. This converter does that rewrite for one file at a time, so you can spend your time on the parts that need judgment, such as S3 streams, pagination and error handling. It's useful when you're upgrading a Lambda runtime, maintaining an older Node.js service, reviewing a migration pull request, or just want to see what the v3 version of a snippet looks like.

For a large codebase, pair it with AWS's aws-sdk-js-codemod: run the codemod for bulk changes, then use this page for the files it can't convert cleanly.

Comparison of the single aws-sdk v2 package, which bundles every AWS service, with separate v3 packages such as @aws-sdk/client-s3, @aws-sdk/client-dynamodb and @aws-sdk/lib-dynamodb
v2 ships every service in one package. In v3 you install only the clients you use.

What changes between AWS SDK v2 and v3

Version 3 of the AWS SDK for JavaScript splits the single aws-sdk package into one package per service, such as @aws-sdk/client-s3. Instead of calling s3.getObject(params).promise(), you create a client and send it a command: client.send(new GetObjectCommand(params)). The converter makes these changes for you: imports, client construction, command classes and the removal of .promise().

A few differences need more than a find-and-replace. DynamoDB's DocumentClient becomes DynamoDBDocumentClient from @aws-sdk/lib-dynamodb. S3 object bodies arrive as streams instead of Buffers, so you read them with Body.transformToString() or transformToByteArray(). Pagination moves to built-in helpers such as paginateListObjectsV2. Check each of these in the converted code. AWS's official migration guide covers the full list.

The v3 SDK is modular, so install each client the converted code imports, for example npm install @aws-sdk/client-s3 @aws-sdk/lib-dynamodb @aws-sdk/client-dynamodb.

Diagram of the AWS SDK v3 command pattern: an S3Client and a GetObjectCommand are passed to client.send(), which returns a promise, replacing s3.getObject(params).promise() in v2
v2 method calls become a client plus a command, sent with client.send().

AWS SDK v2 vs v3: quick reference

The most common v2 patterns and what they become in v3. The converter applies these for you. The rows from DynamoDB down are the ones most worth checking by hand.

AWS SDK for JavaScript v2 compared with v3, by task
TaskSDK v2SDK v3
Installnpm install aws-sdknpm install @aws-sdk/client-s3 (one package per service)
Importimport AWS from "aws-sdk"import { S3Client, GetObjectCommand } from "@aws-sdk/client-s3"
Create a clientnew AWS.S3()new S3Client({ region })
Call an APIs3.getObject(params).promise()client.send(new GetObjectCommand(params))
Shared settingsAWS.config.update({ region })No global config. Pass options to each client, or set AWS_REGION
Named profilenew AWS.SharedIniFileCredentials({ profile })fromIni({ profile }) from @aws-sdk/credential-providers
DynamoDB documentsnew AWS.DynamoDB.DocumentClient()DynamoDBDocumentClient.from(new DynamoDBClient({})) from @aws-sdk/lib-dynamodb
S3 object bodyBody is a BufferBody is a stream: await Body.transformToString()
Large uploadss3.upload(params).promise()new Upload({ client, params }).done() from @aws-sdk/lib-storage
Presigned URLss3.getSignedUrlPromise("getObject", params)getSignedUrl(client, command, { expiresIn }) from @aws-sdk/s3-request-presigner
PaginationLoop on NextContinuationToken or .eachPage()for await (const page of paginateListObjectsV2({ client }, params))
Waiterss3.waitFor("bucketExists", params).promise()waitUntilBucketExists({ client, maxWaitTime: 60 }, params)
Errorserr.code, err.statusCodeerr.name, err.$metadata.httpStatusCode

Key features

  • Imports, clients and calls rewrittenaws-sdk imports become @aws-sdk/client-* imports, service objects become v3 clients, and method calls become commands sent with client.send().
  • Your code stays recognizableVariable names, function structure and comments are kept wherever they still apply, so the diff is easy to review.
  • Gaps are flagged, not hiddenWhen something has no direct v3 equivalent, the output includes a TODO: comment that says what to check.
  • JavaScript and TypeScriptWorks with .js, .mjs, .cjs, .jsx, .ts and .tsx code. TypeScript input comes back as TypeScript.
  • Secret check before sendingAWS access keys, secret keys, private keys and common API tokens are detected in your browser before any code leaves it.
  • Streaming outputThe v3 code appears as it's written. Stop the conversion at any point if you pasted the wrong file.
  • Copy or downloadCopy the result, or download it as converted-v3.js. Wrap long lines to read them without scrolling.
  • Free, with no signupConvert straight away. A free account raises your limits and keeps a list of your recent conversions.

Examples: AWS SDK v2 code converted to v3

Three patterns that need more than renaming. Each shows v2 code and the v3 code it should become. Choose Try this example to load the v2 version into the converter. Your output may be formatted differently.

Generate a presigned S3 upload URL

getSignedUrlPromise moves to the separate @aws-sdk/s3-request-presigner package, and the Expires parameter becomes the expiresIn option.

SDK v2
import S3 from "aws-sdk/clients/s3";

const s3 = new S3({ region: "us-east-1" });

export function getUploadUrl(key) {
  return s3.getSignedUrlPromise("putObject", {
    Bucket: "uploads",
    Key: key,
    ContentType: "image/png",
    Expires: 900,
  });
}
SDK v3
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";

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

export function getUploadUrl(key) {
  const command = new PutObjectCommand({
    Bucket: "uploads",
    Key: key,
    ContentType: "image/png",
  });
  return getSignedUrl(client, command, { expiresIn: 900 });
}

Upload a large file to S3

v2's managed s3.upload() has no method on the v3 client. Its replacement is the Upload class from @aws-sdk/lib-storage, which handles multipart uploads.

SDK v2
import S3 from "aws-sdk/clients/s3";
import fs from "node:fs";

const s3 = new S3();

export async function uploadBackup(path) {
  const result = await s3
    .upload({
      Bucket: "backups",
      Key: "db/latest.sql.gz",
      Body: fs.createReadStream(path),
    })
    .promise();

  return result.Location;
}
SDK v3
import { S3Client } from "@aws-sdk/client-s3";
import { Upload } from "@aws-sdk/lib-storage";
import fs from "node:fs";

const client = new S3Client({});

export async function uploadBackup(path) {
  const upload = new Upload({
    client,
    params: {
      Bucket: "backups",
      Key: "db/latest.sql.gz",
      Body: fs.createReadStream(path),
    },
  });

  const result = await upload.done();
  return result.Location;
}

Invoke a Lambda function

In v3, Payload is a Uint8Array in both directions, so encode the request and decode the response instead of treating it as a string.

SDK v2
import Lambda from "aws-sdk/clients/lambda";

const lambda = new Lambda();

export async function resizeImage(key) {
  const res = await lambda
    .invoke({
      FunctionName: "resize-image",
      Payload: JSON.stringify({ key }),
    })
    .promise();

  return JSON.parse(res.Payload);
}
SDK v3
import { LambdaClient, InvokeCommand } from "@aws-sdk/client-lambda";

const client = new LambdaClient({});

export async function resizeImage(key) {
  const res = await client.send(
    new InvokeCommand({
      FunctionName: "resize-image",
      Payload: new TextEncoder().encode(JSON.stringify({ key })),
    })
  );

  return JSON.parse(new TextDecoder().decode(res.Payload));
}

Tips for better results

  • Convert one module at a time. A single file with its imports converts more reliably than a whole project pasted at once.
  • Keep the import lines. They tell the converter which services and client styles you use, such as DocumentClient versus the low-level DynamoDB client.
  • Include the helper functions a call depends on. If a function builds the params or handles the response, paste it too so both sides change together.
  • Search the output for TODO comments. Lines starting with TODO: mark the spots the converter couldn't map one-to-one.
  • Run your tests. Mock libraries change too: aws-sdk-client-mock replaces most v2 mocking approaches.

Common mistakes to avoid

  • Treating an S3 Body as a Buffer. In v3 it's a stream. Call await Body.transformToString() or transformToByteArray() before you parse it.
  • Checking err.code. v3 errors use err.name, such as NoSuchKey, and the HTTP status is in err.$metadata.httpStatusCode.
  • Relying on AWS.config. There's no global config in v3. Pass the region and credentials to each client, or set AWS_REGION in the environment.
  • Creating a client inside every Lambda invocation. Create v3 clients once, outside the handler, so they're reused across invocations.
  • Sending undefined values to DynamoDB. @aws-sdk/lib-dynamodb throws on them by default. Remove them, or set marshallOptions: { removeUndefinedValues: true }.
  • Forgetting a package. Every @aws-sdk/* import in the converted code, including lib-dynamodb, lib-storage and s3-request-presigner, is a separate npm install.

Frequently asked questions

How do I convert AWS SDK v2 code to v3?

Paste your v2 code into the converter at the top of this page and press Convert to v3 (or Ctrl + Enter). It replaces each aws-sdk service object with a v3 client and each method call with client.send(new SomethingCommand(params)). Then install the @aws-sdk/* packages the result imports and run your tests.

Is AWS SDK for JavaScript v2 still supported?

No. AWS SDK for JavaScript v2 entered maintenance mode on September 8, 2024 and reached end-of-support on September 8, 2025. It no longer receives updates, including security fixes, so AWS recommends moving to v3.

What are the main differences between v2 and v3?

v3 is modular, with one package per service, so your bundles only include the clients you use. It uses a command pattern (client.send(new Command())) with native promises, has first-class TypeScript types, and adds middleware for customizing requests.

Is there an official codemod for AWS SDK v2 to v3?

Yes. AWS publishes aws-sdk-js-codemod, which you run with npx aws-sdk-js-codemod@latest -t v2-to-v3 PATH. It's the fastest option for bulk changes across a repository. This converter helps with the files the codemod can't finish, and when you want to see the v3 version of a single snippet.

Does the converter support TypeScript?

Yes. Paste or open .ts and .tsx files as well as JavaScript. TypeScript input is converted as TypeScript, so type annotations stay in place alongside the new v3 client and command types.

Can I migrate to v3 gradually?

Yes. v2 and v3 can run side by side in the same project, so you can convert one service client or one file at a time and ship each change separately. For the whole-app process, follow the guide to migrate a Node.js app from AWS SDK v2 to v3.

Does the converter change my application logic?

It aims to keep your logic, names and comments the same and change only the SDK calls, imports and client setup. Where there's no direct equivalent it adds a TODO: comment. Review the output anyway, especially around S3 body streams, pagination and error handling, where v3 behaves differently.

Is my code stored?

No. Your code is sent to an AI model hosted on NVIDIA's API only to produce the conversion, and ChatWithCloud doesn't store or log it. Your latest draft is kept only in your browser. Replace real keys and passwords with placeholders before converting. For the full picture, see whether it's safe to paste AWS code into an AI converter.

Is the converter free, and how much code can I convert?

Yes, it's free. Each conversion accepts up to 60,000 characters, and files up to 500 KB. Without an account you can run 6 conversions a minute and 60 a day. A free account raises that to 12 a minute and 200 a day, and lists your recent conversions on your dashboard. The guide to ChatWithCloud free converter limits shows how far they stretch for a real migration.

Related tools and next steps