DynamoDB: Get By ID (Guide w/ Code Examples)

Provided by Rafal Wilinski
To retrieve an item by if from a DynamoDB table using the JavaScript SDK, you can use the get
method. The method takes an object with the required parameters, including the table name and the primary key of the item you want to retrieve. Here is an example of how you can use the get
method to retrieve an item with a specific Id:
const AWS = require('aws-sdk'); const dynamoDb = new AWS.DynamoDB.DocumentClient(); const params = { TableName: 'my-table', Key: { id: 'some-id' } }; dynamoDb.get(params, (error, data) => { if (error) { console.error(error); return; } console.log(data.Item); });
Similar Code Examples
- DynamoDB: Delete Table
- DynamoDB: Get Last Inserted Item
- DynamoDB BatchWriteItem in Typescript
- DynamoDB: Delete All Items With Partition Key
- DynamoDB Get in Typescript
- DynamoDB: BatchGetItem
- DynamoDB: Query Group By
- DynamoDB: Query Date Range
- DynamoDB: Delete Multiple Items in Javascript
- DynamoDB: Batch Get
- DynamoDB: Increment Counter
- DynamoDB: Not Between
- DynamoDB: Get Random Item
- DynamoDB: Get Table
- DynamoDB: Query KeyConditionExpression
Login to the AWS Console less. Use Dynobase.
Try 7-day free trial. No credit card needed.
Product Features
DynamoDB Tools
DynamoDB Info
© 2025 Dynobase