AWS SDK for JavaScript to Boto3 (Python) Converter

Port Node.js or TypeScript code that uses the AWS SDK, v2 or v3, to Python with boto3 for scripts, data jobs and Python Lambda functions.

Your codeAWS SDK (JS/TS)
Drop the file to load it
Tab indents · Esc, Tab exits
ResultPython (boto3)
Your Python (boto3) will appear hereClick Convert to Python or press Ctrl Enter
converted.py
Don't paste secrets

How to convert AWS SDK JavaScript code to boto3

To convert AWS SDK JavaScript code to Python, paste it above and press Convert to Python. SDK calls become boto3 client methods in snake_case, such as s3.list_objects_v2(Bucket=...), await becomes a normal call, and paginators become get_paginator(). Then pip install boto3 and run it against test data.

  1. Add your JavaScript or TypeScriptPaste it into the AWS SDK (JS/TS) editor, use Paste or Open file (.js, .mjs, .cjs, .jsx, .ts, .tsx or .txt, up to 500 KB), or drop a file onto the editor. v2 .promise() code and v3 commands both work. Sample loads an S3-to-DynamoDB indexing job.
  2. Let the secret check runBefore the code leaves your browser, the page scans it for AWS access keys, secret keys, private keys and common API tokens. If it finds one, it highlights the match so you can replace it with a placeholder.
  3. Convert to PythonClick Convert to Python or press Ctrl + Enter. The boto3 code streams in as it's written, and Stop cancels it. One conversion takes up to 60,000 characters.
  4. Review the PythonCheck error handling, number and date types, and anything that ran in parallel with Promise.all. Search for TODO: comments, then copy the code or download it as converted.py.
  5. Install boto3 and run itRun pip install boto3, make sure your AWS credentials are available, and try the script against a test bucket or table before production.
Four-step workflow for converting AWS SDK JavaScript code to boto3: paste JS or TS code, local secret check, streamed Python conversion, pip install boto3 and run
From Node.js AWS code to a Python script you can run.

Why port AWS SDK JavaScript code to Python

Teams move AWS logic from Node.js to Python for practical reasons: a data or ML team that works in Python needs the same S3 or DynamoDB logic, an ops script should run next to other boto3 tooling, or a Lambda function is being consolidated into a Python codebase. The AWS calls stay the same, but rewriting every call, parameter object and error check by hand takes time.

Because the AWS SDK for JavaScript and boto3 both call the same API operations with the same request and response keys, most of the conversion is mechanical: method names, keyword arguments, async code and error handling. The converter handles that rewrite, keeping your function names and comments, so you can focus on behavior that differs, such as concurrency and number types.

Once the Python version works, the IAM policy generator for Python code can draft a policy for the boto3 calls it makes.

Diagram showing a JavaScript ListObjectsV2Command call and a boto3 list_objects_v2 call sending the same ListObjectsV2 operation to Amazon S3 with the same Bucket parameter
Both SDKs call the same AWS operations, so request and response keys stay the same.

How JavaScript AWS SDK calls map to boto3

A v3 client.send(new ListObjectsV2Command(params)) or a v2 s3.listObjectsV2(params).promise() becomes s3.list_objects_v2(**params) in boto3. Method names switch to snake_case, but request and response keys such as Bucket, Contents and NextContinuationToken keep their PascalCase names, because they come from the AWS API rather than the language.

boto3 calls block until they return, so await disappears. Pagination helpers become boto3 paginators, and JavaScript checks on err.name or err.code become except botocore.exceptions.ClientError blocks that read err.response["Error"]["Code"], as the boto3 error handling guide describes.

Mapping of JavaScript AWS SDK patterns to boto3: listObjectsV2 to list_objects_v2, a params object to keyword arguments, await to a synchronous call, paginateListObjectsV2 to get_paginator, err.name to the ClientError code
What changes when AWS code moves from JavaScript to Python.

AWS SDK for JavaScript vs boto3: quick reference

Common JavaScript AWS SDK patterns and their boto3 equivalents. The converter applies these, and the last few rows are where hand-checking pays off.

AWS SDK for JavaScript patterns compared with Python boto3
TaskJavaScript (v3)Python (boto3)
Installnpm install @aws-sdk/client-s3pip install boto3 (every service in one package)
Create a clientnew S3Client({ region: "eu-west-1" })boto3.client("s3", region_name="eu-west-1")
Call an APIawait s3.send(new ListObjectsV2Command({ Bucket }))s3.list_objects_v2(Bucket=bucket)
PaginationpaginateListObjectsV2({ client }, params)s3.get_paginator("list_objects_v2").paginate(**params)
WaiterswaitUntilBucketExists({ client, maxWaitTime }, params)s3.get_waiter("bucket_exists").wait(Bucket=b)
S3 object bodyawait Body.transformToString()res["Body"].read().decode("utf-8")
DynamoDB documentsDynamoDBDocumentClientboto3.resource("dynamodb").Table(name), with numbers as Decimal
Errorserr.nameerr.response["Error"]["Code"] on ClientError
Parallel callsawait Promise.all(tasks)concurrent.futures.ThreadPoolExecutor, or run sequentially
TimestampsJavaScript DateTimezone-aware datetime

Key features

  • Works with SDK v2 and v3 inputThe converter reads v2 .promise() calls and v3 commands, including lib-dynamodb, and produces the same boto3 code for either.
  • Pythonic calls, same AWS keysMethods become snake_case boto3 calls with keyword arguments, while API keys like Bucket and Items stay exactly as AWS expects.
  • Paginators and waiters mappedpaginate* helpers and waitUntil* functions become boto3 get_paginator() and get_waiter() calls.
  • Error handling rewrittenJavaScript error checks become try/except ClientError blocks that compare the AWS error code.
  • Flags what needs a personWhere JavaScript behavior has no clean Python equivalent, the output includes a TODO: comment.
  • Checked for secrets firstThe page looks for access keys, secret keys, private keys and tokens in your browser before sending anything.
  • Copy or download as converted.pyCopy the result, wrap long lines, or download it ready to drop into a project.

Examples: JavaScript AWS SDK code converted to boto3

Three realistic conversions, from both SDK versions. Choose Try this example to load the JavaScript into the converter. Your output may be formatted differently.

Query a DynamoDB table (SDK v3 DocumentClient)

The DocumentClient maps most naturally to the boto3 resource API, which also takes plain values. The same expression strings work unchanged. Numbers in the returned items are Decimal values.

AWS SDK (JS/TS)
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient, QueryCommand } from "@aws-sdk/lib-dynamodb";

const ddb = DynamoDBDocumentClient.from(new DynamoDBClient({}));

export async function getOrders(customerId) {
  const { Items = [] } = await ddb.send(
    new QueryCommand({
      TableName: "orders",
      KeyConditionExpression: "customerId = :c",
      ExpressionAttributeValues: { ":c": customerId },
    })
  );
  return Items;
}
Python (boto3)
import boto3

table = boto3.resource("dynamodb").Table("orders")


def get_orders(customer_id):
    res = table.query(
        KeyConditionExpression="customerId = :c",
        ExpressionAttributeValues={":c": customer_id},
    )
    return res.get("Items", [])

Process messages from an SQS queue (SDK v2)

v2 .promise() calls become plain boto3 calls. Optional response keys like Messages are read with .get(), the Python version of the JavaScript default value.

AWS SDK (JS/TS)
const AWS = require("aws-sdk");
const sqs = new AWS.SQS();

async function drainQueue(queueUrl, handle) {
  const { Messages = [] } = await sqs
    .receiveMessage({ QueueUrl: queueUrl, MaxNumberOfMessages: 10, WaitTimeSeconds: 20 })
    .promise();

  for (const msg of Messages) {
    await handle(JSON.parse(msg.Body));
    await sqs.deleteMessage({ QueueUrl: queueUrl, ReceiptHandle: msg.ReceiptHandle }).promise();
  }
  return Messages.length;
}
Python (boto3)
import json

import boto3

sqs = boto3.client("sqs")


def drain_queue(queue_url, handle):
    res = sqs.receive_message(QueueUrl=queue_url, MaxNumberOfMessages=10, WaitTimeSeconds=20)
    messages = res.get("Messages", [])

    for msg in messages:
        handle(json.loads(msg["Body"]))
        sqs.delete_message(QueueUrl=queue_url, ReceiptHandle=msg["ReceiptHandle"])
    return len(messages)

Check whether an S3 object exists

A subtle one. In v3 a missing object throws an error named NotFound, but boto3 reports a HEAD request on a missing key with the error code "404". Check that the converted comparison uses the right value.

AWS SDK (JS/TS)
import { S3Client, HeadObjectCommand } from "@aws-sdk/client-s3";

const s3 = new S3Client({});

export async function objectExists(bucket, key) {
  try {
    await s3.send(new HeadObjectCommand({ Bucket: bucket, Key: key }));
    return true;
  } catch (err) {
    if (err.name === "NotFound") return false;
    throw err;
  }
}
Python (boto3)
import boto3
from botocore.exceptions import ClientError

s3 = boto3.client("s3")


def object_exists(bucket, key):
    try:
        s3.head_object(Bucket=bucket, Key=key)
        return True
    except ClientError as err:
        if err.response["Error"]["Code"] == "404":
            return False
        raise

Tips for better results

  • Paste whole functions with their imports. The imports tell the converter which SDK version and clients you use, including whether DynamoDB goes through the DocumentClient.
  • Say whether you want clients or resources. Add a comment like // use boto3 clients only at the top if your team avoids the resource API.
  • Keep the Python synchronous unless you need speed. For parallel work, use concurrent.futures with one boto3 client per thread rather than sharing a session across threads.
  • Let boto3 find credentials. Like the JavaScript SDK, it reads environment variables, ~/.aws profiles and IAM roles, so don't hard-code keys into the converted script.
  • Test with real response shapes. Run the script against a test bucket or table to catch Decimal, datetime and missing-key differences early.

Common mistakes when porting to boto3

  • Treating DynamoDB numbers as floats. The resource API returns Decimal, which json.dumps can't serialize without a custom encoder.
  • Reading an S3 body twice. res["Body"] is a StreamingBody. Call .read() once and keep the bytes.
  • Indexing optional keys directly. res["Contents"] raises KeyError on an empty bucket. Use res.get("Contents", []).
  • Leaving await in Python code. boto3 isn't async. An await left in a regular function is a syntax error.
  • Comparing error codes blindly. Codes can differ from JavaScript error names, as with HeadObject, which reports "404" in boto3.

Frequently asked questions

How do I convert AWS SDK JavaScript code to Python boto3?

Paste the JavaScript or TypeScript into the converter at the top of this page and press Convert to Python. It rewrites each SDK call as a boto3 client method, turns async code into regular calls and maps paginators and error handling. Then run pip install boto3 and test the script.

Does it matter whether my code uses AWS SDK v2 or v3?

No. The converter reads v2 .promise() calls and v3 commands alike, and both become the same boto3 code.

Will the Python code be async?

Usually not. boto3 is synchronous, so the output uses plain function calls. If you need async Python, the community aioboto3 library exists, but check its API before adapting the result.

Should the output use boto3 clients or resources?

Clients map most directly to JavaScript SDK calls and cover every service. The resource interface is convenient for DynamoDB and S3, but AWS isn't adding new features to it, so clients are the safer default.

Can I convert TypeScript?

Yes. Paste or open .ts and .tsx files. Type annotations don't carry over to boto3 directly, so add Python type hints afterwards if your project uses them.

Can I convert Python back to JavaScript?

Yes. The boto3 to AWS SDK v3 converter goes the other way and produces TypeScript.

Is my code stored?

No. The 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 stays in your browser. Swap real keys and passwords for placeholders before converting. For the full picture, see whether it's safe to paste AWS code into an AI converter.

Is the converter free?

Yes, it's free. Each conversion takes 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