Choosing an AWS SDK Basics
Choosing an AWS SDK is mostly a language decision, not a capability one.
Busque em todas as páginas da documentação
Choosing an AWS SDK is mostly a language decision, not a capability one.
Because every SDK is generated from the same service model, the operations you need almost certainly exist in whichever language you pick. The real questions are which language your workload runs in, what runtime you deploy to, and how you install the client.
These seven examples walk that decision, five basic and two intermediate, in both Python (boto3) and TypeScript (AWS SDK v3).
pip install boto3 (boto3 1.43.x, Python 3.10+). TypeScript: npm install @aws-sdk/client-s3 and add each service client you need (Node.js 18+).aws configure, environment variables, or an IAM role. The SDK resolves them automatically.AWS_REGION or passed per client.Pick the SDK for the language the workload lives in, not the other way around.
# --- Python (boto3) ---
import boto3
# A Python data job or Django backend? boto3 is the natural fit.
s3 = boto3.client("s3", region_name="us-east-1")
print("using boto3")// --- TypeScript (AWS SDK v3) ---
import { S3Client } from "@aws-sdk/client-s3";
// A Node/TypeScript API or Lambda? AWS SDK v3 is the natural fit.
const s3 = new S3Client({ region: "us-east-1" });
console.log("using AWS SDK v3");Related: The AWS SDK Family: One Team, Many Languages - why parity is so high.
boto3 is one package for everything; SDK v3 is one package per service.
# --- Python (boto3) ---
# pip install boto3
# One install covers S3, DynamoDB, SQS, and every other service.
import boto3
ddb = boto3.client("dynamodb")// --- TypeScript (AWS SDK v3) ---
// npm install @aws-sdk/client-dynamodb
// Install only the service clients you actually use.
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
const ddb = new DynamoDBClient({});@aws-sdk/client-<service> for each service you touch.aws-sdk v2 monolith on npm; v3 is the current line.Related: Bundle Size & Cold Start: Why SDK v3's Modularity Matters - the packaging payoff.
Check the AWS API reference for the operation, then call it in your SDK.
# --- Python (boto3) ---
import boto3
# SQS SendMessage exists in every SDK; here it is in boto3.
sqs = boto3.client("sqs", region_name="us-east-1")
sqs.send_message(QueueUrl="https://sqs.us-east-1.amazonaws.com/123456789012/jobs",
MessageBody="hello")// --- TypeScript (AWS SDK v3) ---
import { SQSClient, SendMessageCommand } from "@aws-sdk/client-sqs";
const sqs = new SQSClient({ region: "us-east-1" });
await sqs.send(new SendMessageCommand({
QueueUrl: "https://sqs.us-east-1.amazonaws.com/123456789012/jobs",
MessageBody: "hello",
}));SendMessage) and inputs come from the shared service model, so both SDKs match the reference.send_message; SDK v3 exposes it as SendMessageCommand.Related: The AWS SDK Family: One Team, Many Languages - the shared model.
Seeing one operation in both SDKs makes the choice feel low-stakes.
# --- Python (boto3) ---
import boto3
s3 = boto3.client("s3")
s3.put_object(Bucket="my-bucket", Key="hello.txt", Body=b"hi")// --- TypeScript (AWS SDK v3) ---
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
const s3 = new S3Client({});
await s3.send(new PutObjectCommand({ Bucket: "my-bucket", Key: "hello.txt", Body: "hi" }));Bucket, Key, and Body inputs are identical because they come from one contract.When two languages are both viable, the deployment target decides.
# --- Python (boto3) ---
import boto3
# Long-running server or data job: startup cost is amortized, boto3 is fine.
s3 = boto3.client("s3", region_name="us-east-1")// --- TypeScript (AWS SDK v3) ---
import { S3Client } from "@aws-sdk/client-s3";
// Lambda: modular v3 keeps the bundle small, so cold starts stay fast.
const s3 = new S3Client({ region: "us-east-1" });Related: Bundle Size & Cold Start: Why SDK v3's Modularity Matters - the Lambda angle.
Whichever SDK you choose, build the client once and reuse it.
# --- Python (boto3) ---
import boto3
# Module scope: one client reused across many operations.
s3 = boto3.client("s3", region_name="us-east-1")
def upload(key, body):
s3.put_object(Bucket="my-bucket", Key=key, Body=body)// --- TypeScript (AWS SDK v3) ---
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
// Module scope: reused across invocations, including warm Lambdas.
const s3 = new S3Client({ region: "us-east-1" });
export async function upload(key: string, body: string) {
await s3.send(new PutObjectCommand({ Bucket: "my-bucket", Key: key, Body: body }));
}Related: Choosing an AWS SDK Best Practices - the habits behind a good default.
A polyglot org can run more than one SDK, as long as the split is intentional.
# --- Python (boto3) ---
import boto3
# Data/ML pipeline in Python writes results to S3.
s3 = boto3.client("s3", region_name="us-east-1")
s3.put_object(Bucket="results", Key="run-1.json", Body=b"{}")// --- TypeScript (AWS SDK v3) ---
import { S3Client, GetObjectCommand } from "@aws-sdk/client-s3";
// TypeScript API/Lambda reads the same object the Python job wrote.
const s3 = new S3Client({ region: "us-east-1" });
await s3.send(new GetObjectCommand({ Bucket: "results", Key: "run-1.json" }));Related: Mixing SDKs in One Organization - the trade-offs in depth.
Stack versions: This page was written for boto3 1.43.x (Python 3.10+) and the AWS SDK for JavaScript v3 (Node.js 18+).
Revisado por Chris St. John·Última atualização: 24 de jul. de 2026