Steps to upgrade the AWS SDK from v2 to v3

0

My app is working fine with v2 of the AWS-SDK, but I see that when I run tests, there's a message stating that v2 is being moved to maintenance mode soon. I tried running aws-sdk-js-codemod per https://www.npmjs.com/package/aws-sdk-js-codemod, but I keep getting $ command not found when I run

$ npx aws-sdk-js-codemod@latest -t v2-to-v3 PATH...

I know I have npx installed because I ran $ npx create-react-app right before that.

What I want is a set of examples such as those found here:

https://www.npmjs.com/package/amazon-cognito-identity-js#usage.

If it's just a matter of converting the import I have

import AWS from "aws-sdk";

to that found in the docs, namely

import * as AWS from 'aws-sdk/global';

please advise.

Rob
asked 6 months ago387 views
2 Answers
0

Hi,

When you run the command, try not to put the "$" symbol in the beginning, as it is generally used to indicate the command is being run in the terminal or command prompt.
The $ is not part of the command itself. It simply represents the command prompt and $ is not meant to be typed.

So, your command should be:

npx aws-sdk-js-codemod@latest -t v2-to-v3 example.ts

For more details regarding upgrading from v2 to v3, you can follow the guide: [1] [2].

References:
[1] https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/migrating-to-v3.html
[2] https://hackernoon.com/notes-on-migrating-aws-sdk-v2-to-v3-javascript-a-quick-guide-to-help-you-out

Thanks,
Atul

profile picture
answered 6 months ago
  • Hi Atul,

    Thanks for replying. I am aware that $ represents a bash prompt and it wasn't included in the command. I also substituted in the correct path for PATH. That said,

    npx aws-sdk-js-codemod@latest -t v2-to-v3 PATH...

    didn't work, stating command not found.

    For the record, I am not trying to use Lambdas, DynamoDB or S3. I am trying to use Cognito and I need instructions for how to perform all the operations detailed in https://www.npmjs.com/package/amazon-cognito-identity-js#usage. I had already read the docs you cite and didn't find them helpful.

0

Friendly ping.

Rob
answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions