DEV Community

Discussion on: Lessons Learned From Switching to AWS SDK v3

Collapse
 
dvddpl profile image
Davide de Paolis

Hi, nice article. I Wrote something similar some time ago, because indeed switching to V3 is not so straightforward.
from my tests you dont really need marshalling/ unmarshalling if you use the DynamoDBDocumentClient. (it is the same confusion as with V2 between the DynamoDBClient and DynamoDBDocumentClient)

import {DynamoDBClient} from "@aws-sdk/client-dynamodb";
import {DynamoDBDocumentClient, PutCommand} from "@aws-sdk/lib-dynamodb";
const dynamoClient = new DynamoDBClient()
const documentClient = DynamoDBDocumentClient.from(dynamoClient)
const params = {
    Item: {
        "Artist": "No One You Know",
        "SongTitle": "Call Me Today",
        "Year": 2001
        }
    },
    TableName: "Music"
};
 const response = await documentClient.send(new PutCommand(params))
Enter fullscreen mode Exit fullscreen mode

I wrote some samples here

Collapse
 
allenheltondev profile image
Allen Helton

This is great, thank you!