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
gefragt vor 7 Monaten421 Aufrufe
2 Antworten
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
beantwortet vor 7 Monaten
  • 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
beantwortet vor 6 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen