DynamoDB: GetItem (Guide w/ Code Examples)

Provided by Rafal Wilinski
Last updated: October 23rd, 2026
Use GetCommand with the full primary key to read one item. The document client returns native JavaScript values; Item is undefined when no matching item exists.
Install @aws-sdk/client-dynamodb and @aws-sdk/lib-dynamodb, use an ES module on a supported Node.js runtime, and configure an AWS Region and credentials. The examples use an existing Orders table with String keys pk and sk unless an index or timestamp key is described.
import { DynamoDBClient } from "@aws-sdk/client-dynamodb"; import { DynamoDBDocumentClient, GetCommand } from "@aws-sdk/lib-dynamodb"; const ddb = DynamoDBDocumentClient.from(new DynamoDBClient({})); const { Item } = await ddb.send(new GetCommand({ TableName: "Orders", Key: { pk: "CUSTOMER#123", sk: "ORDER#001" }, ConsistentRead: true, })); console.log(Item ?? "Item not found");
A TypeScript type assertion does not validate data from DynamoDB at runtime. Validate the returned object before treating it as your domain model.
Reference: AWS GetItem API. For related access patterns, see DynamoDB query examples.
Similar Code Examples
- DynamoDB: Batch Get
- DynamoDB: Query Count
- DynamoDB: Delete Multiple Items in Javascript
- DynamoDB: Get By ID
- DynamoDB: BatchGetItem
- DynamoDB: Get Multiple Items
- DynamoDB: Query Items
- DynamoDB Get in Typescript
- DynamoDB: Query KeyConditionExpression
- DynamoDB: Query Global Secondary Index in Nodejs
- DynamoDB: Query Date Range
- DynamoDB: Get Last 10 Records
- DynamoDB: Not Begins With
- DynamoDB: Get Last Inserted Item
- DynamoDB: Like
Dynobase is a Professional GUI Client for DynamoDB
Start your 7-day free trial today
Product Features
DynamoDB Tools
- SSH GUI Client
- Chat With Cloud
- MongoDB GUI Client
- AWS Cost Monitoring
- DynamoDB Query Builder
- DynamoDB Code Examples
- DynamoDB Node.js Queries
- DynamoDB JSON Converter
- DynamoDB UUID Generator
- DynamoDB Local Admin GUI
- DynamoDB Pricing Calculator
- DynamoDB Single-Table Design
- Best DynamoDB GUI Clients
- Dynobase vs DynoTable