Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
February 4, 2021 03:12 pm GMT

Upgrading to the AWS SDK for JavaScript v3

Three Dice

In December 2020, AWS announced general availability of version 3 of their SDK for JavaScript. I decided to take some time to experiment and see whats changed.

Whats New?

There are lots of new features in this release. Heres the new features that Ive seen highlighted the most.

Modular Packages

In prior versions, wed just npm install the entire aws-sdk package and everything was in there. Now the sdk is split among multiple npm packages. Just install the packages that you need to use for your application. This is a big win for being able to get those code bundle sizes down.

Middleware Stack

The Middleware Stack gives developers more control over the lifecycle of the requests sent via the aws-sdk. My internal mental reaction is similar to how I felt after hearing the AWS Lambda Extensions announcement. It seems interesting, but Im not quite sure what Id do with it. That doesnt mean this isnt an exciting feature to someone else.

First Class TypeScript Support

TypeScript is growing in popularity, so it seems fitting that AWS would continue the trend. As someone who recently started using TypeScript, this is pretty exciting.

Lets See Some Code!

Because I was curious about how everything might look in v3, I experimented by converting a minimally featured CRUD api to use the new version. Check out the README to see the high level architecutre of the app. And heres the git diff when converting from the sdk v2 to v3.

Since DynamoDB is my database in this app, I went looking for the v3 equivalent of the DynamoDB document client that strips out the DynamoDB types and makes things more human readible. I found some mixed messaging on the official AWS Github repo for the JavaScript SDK and my overall takeway is that originally an AWS employee said theyd port it over, now it looks like that probably wont happen. My personal opinion is that they couldve done a better job communicating in this issue filed on Github.

Anyway long story short, I found I was able to get the same result by marshalling and unmarshalling JavaScript objects/DynamoDB Records in the code. Info on that can be found in the docs for the util-dynamodb package here. Another example can also be found in my git diff mentioned above.

Whats Next?

Out of caution, I plan to wait for things to settle a bit more before doing upgrades on major business critical applications.

This has been a fun experiment to see whats changed, what stayed the same, and what I can look forward to in the future. Overall, I felt like AWS did a great job with this rewrite.

What are your thoughts on the update? Have any fun use case ideas with the new middleware stack feature? Let me know!


Original Link: https://dev.to/deeheber/upgrading-to-the-aws-sdk-for-javascript-v3-48ha

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To