DynamoDB Get in Typescript (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: Query Date Range
- DynamoDB: Create if Not Exists
- DynamoDB: Query JSON
- DynamoDB: Get By ID
- DynamoDB: Delete All Items With Partition Key
- DynamoDB: GetItem
- DynamoDB: Not Begins With
- DynamoDB: Delete Table
- DynamoDB: Like
- DynamoDB: Delete Multiple Items in Javascript
- DynamoDB: Query Count
- DynamoDB: Query Ends With
- DynamoDB BatchWriteItem in Typescript
- DynamoDB: Attribute Not Null
- DynamoDB: Bulk Insert
Dynobase is a Professional GUI Client for DynamoDB
Start your 7-day free trial today