Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-sdk/client-dynamodb

Package Overview
Dependencies
Maintainers
5
Versions
438
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/client-dynamodb

AWS SDK for JavaScript Dynamodb Client for Node.js, Browser and React Native

  • 3.535.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.5M
increased by5.2%
Maintainers
5
Weekly downloads
 
Created

What is @aws-sdk/client-dynamodb?

The @aws-sdk/client-dynamodb npm package is a client library for interacting with Amazon DynamoDB, a NoSQL database service provided by AWS. It allows developers to perform various operations on DynamoDB tables and data, such as creating and deleting tables, reading and writing data, and querying and scanning data.

What are @aws-sdk/client-dynamodb's main functionalities?

Creating a DynamoDB Table

This code sample demonstrates how to create a new DynamoDB table with a specified schema and provisioned throughput.

const { DynamoDBClient, CreateTableCommand } = require('@aws-sdk/client-dynamodb');

const client = new DynamoDBClient({ region: 'us-west-2' });
const createTableParams = {
  TableName: 'MyTable',
  KeySchema: [{ AttributeName: 'id', KeyType: 'HASH' }],
  AttributeDefinitions: [{ AttributeName: 'id', AttributeType: 'S' }],
  ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 }
};

const createTableCommand = new CreateTableCommand(createTableParams);
client.send(createTableCommand).then((data) => console.log(data)).catch((error) => console.error(error));

Inserting Data into a DynamoDB Table

This code sample shows how to insert a new item into a DynamoDB table.

const { DynamoDBClient, PutItemCommand } = require('@aws-sdk/client-dynamodb');

const client = new DynamoDBClient({ region: 'us-west-2' });
const putItemParams = {
  TableName: 'MyTable',
  Item: {
    'id': { S: '123' },
    'data': { S: 'Some data' }
  }
};

const putItemCommand = new PutItemCommand(putItemParams);
client.send(putItemCommand).then((data) => console.log(data)).catch((error) => console.error(error));

Querying Data from a DynamoDB Table

This code sample illustrates how to query a DynamoDB table for items with a specific key.

const { DynamoDBClient, QueryCommand } = require('@aws-sdk/client-dynamodb');

const client = new DynamoDBClient({ region: 'us-west-2' });
const queryParams = {
  TableName: 'MyTable',
  KeyConditionExpression: 'id = :idValue',
  ExpressionAttributeValues: {
    ':idValue': { S: '123' }
  }
};

const queryCommand = new QueryCommand(queryParams);
client.send(queryCommand).then((data) => console.log(data.Items)).catch((error) => console.error(error));

Other packages similar to @aws-sdk/client-dynamodb

FAQs

Package last updated on 15 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc