Ttechflare641

aws-sdk-v2-to-v3

AWS SDK v2 to v3 migration (modular clients, command pattern, promise removal)

transformationmigrationawsaws-sdkv2v3modulars3dynamodb
Public
0 executions

Run locally

npx codemod aws-sdk-v2-to-v3

aws-sdk-v2-to-v3

JSSG codemod (transform.ts) for a partial AWS SDK for JavaScript v2 → v3 upgrade: modular client imports, service construction rewriting, .promise() removal, and TODOs for command pattern migration, global config, and middleware.

Scope (automated)

  • import AWS from "aws-sdk" / const AWS = require("aws-sdk") → modular @aws-sdk/client-* imports
  • new AWS.S3(...)new S3Client(...) from @aws-sdk/client-s3
  • new AWS.DynamoDB(...)new DynamoDBClient(...) from @aws-sdk/client-dynamodb
  • new AWS.SQS(...)new SQSClient(...) from @aws-sdk/client-sqs
  • new AWS.SNS(...)new SNSClient(...) from @aws-sdk/client-sns
  • new AWS.Lambda(...)new LambdaClient(...) from @aws-sdk/client-lambda
  • .promise() calls removed (v3 operations return promises natively)
  • Method calls like s3.putObject(params) flagged with TODO to convert to client.send(new PutObjectCommand(params))
  • AWS.config.update(...) flagged with TODO for per-client configuration
  • AWS.config.maxRetries / AWS.config.httpOptions / etc. flagged with TODO for middleware stack

Not covered (manual / follow-up)

  • Full command pattern rewriting (e.g. s3.putObject(params)client.send(new PutObjectCommand(params)))
  • Paginators, waiters, S3 presigned URLs, DynamoDB document client
  • Stream handling changes, event-based APIs
  • AWS.Request / AWS.Response types
  • Services beyond S3, DynamoDB, SQS, SNS, Lambda

Run locally

bash

Publish to Codemod registry

From this directory (with tests passing):

bash

Package name in codemod.yaml is aws-sdk-v2-to-v3; version is semver in codemod.yaml and package.json (currently 0.0.1).

License

MIT

Ready to contribute?

Build your own codemod and share it with the community.