AWS SDK for JavaScript v3 to v2 Converter

Translate @aws-sdk/client-* v3 code into aws-sdk v2 syntax for codebases that can't move yet. v2 reached end-of-support on September 8, 2025, so use v3 for new work.

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

How to convert AWS SDK v3 code to v2

  1. Add your codePaste it into the AWS SDK v3 (JS/TS) editor, drag in a file, or keep the sample to see how it works.
  2. Convert to v2Click the button or press Ctrl + Enter. The result streams into the right-hand editor.
  3. Review and use itCopy or download the result, then test it before you rely on it. AI output is a strong first draft, not a guarantee.

When converting to v2 makes sense

Most teams should move the other way, from v2 to v3. But some projects are pinned to aws-sdk v2 for now: an older service that shares helpers with v2 code, a framework plugin that expects v2 clients, or a codebase where mixing both SDKs would complicate a release. When you find a v3 snippet in documentation or another repo and need it to fit that code, this converter rewrites it in v2 style.

The mapping is mostly mechanical. Each client.send(new SomeCommand(params)) call becomes the matching v2 method, such as s3.getObject(params).promise(). Separate @aws-sdk/client-* imports become require("aws-sdk") or a per-service import like aws-sdk/clients/s3. DynamoDBDocumentClient from @aws-sdk/lib-dynamodb becomes AWS.DynamoDB.DocumentClient.

Some v3 features have no direct v2 equivalent. Paginator helpers like paginateListObjectsV2 become manual loops over ContinuationToken or NextToken, middleware becomes request event listeners, and errors are identified by err.code instead of err.name or exception classes. Check those parts of the output carefully.

AWS SDK for JavaScript v2 reached end-of-support on September 8, 2025 and no longer receives updates, including security fixes. Treat converted code as a stopgap, and plan to move it to v3 with the v2 to v3 converter.

Tips for better results

  • Include the imports. They tell the converter which clients you use, including whether you want the DocumentClient or the low-level DynamoDB client.
  • Watch paginated calls. v3 paginator loops need a manual token loop in v2. Confirm the converted loop stops when there's no next token.
  • Check error checks. Replace instanceof checks and err.name comparisons with err.code, which is how v2 reports error types.
  • Bundle the SDK on Lambda. The Node.js 18 and later Lambda runtimes include only SDK v3, so v2 code must ship aws-sdk in its deployment package.
  • Test S3 downloads. v2 returns Body as a Buffer, so remove any transformToString() calls the converter misses.

Frequently asked questions

Should I use AWS SDK v2 for new projects?

No. v2 reached end-of-support on September 8, 2025 and gets no more updates. Use v3 for anything new, and only convert to v2 when existing code has to stay on it for now.

Can v2 and v3 code live in the same project?

Yes. The packages don't conflict, so you can keep a converted v2 file next to v3 code and migrate each file separately later.

What happens to v3 paginators in v2?

v2 has no paginate* helpers for most services. The converter rewrites them as loops that pass the continuation token from each response into the next request, which you should test with more than one page of results.

Does the converter work with TypeScript?

Yes. Paste TypeScript and the output keeps your types where it can. v2 ships its own typings, so some type names change, such as S3.GetObjectOutput instead of GetObjectCommandOutput.