Complete the code to import the DynamoDB client from AWS SDK.
const { DynamoDBClient } = require('[1]');The AWS SDK for JavaScript v3 modular packages require importing DynamoDBClient from '@aws-sdk/client-dynamodb'.
Complete the code to create a new DynamoDB client with region 'us-east-1'.
const client = new DynamoDBClient({ region: '[1]' });The region 'us-east-1' is specified as the AWS region for the DynamoDB client.
Fix the error in the code to put an item into DynamoDB using the client.
const params = { TableName: 'Users', Item: { id: { S: '123' }, name: { S: 'Alice' } } };
await client.[1](new PutItemCommand(params));In AWS SDK v3, you create a PutItemCommand and then call client.send(command). The client does not have a direct 'putItem' method.
Fill both blanks to import and create a PutItemCommand for DynamoDB.
const { [1] } = require('@aws-sdk/client-dynamodb');
const command = new [2]({ TableName: 'Users', Item: { id: { S: '001' } } });The PutItemCommand is imported and instantiated to create a command for putting an item in DynamoDB.
Fill all three blanks to get an item from DynamoDB and extract the attribute 'name'.
const { [1] } = require('@aws-sdk/client-dynamodb');
const client = new DynamoDBClient({ region: 'us-east-1' });
const command = new [2]({ TableName: 'Users', Key: { id: { S: '123' } } });
const response = await client.[3](command);
const userName = response.Item?.name?.S;To get an item, import and instantiate GetItemCommand, then call client.send(command) to execute it.