dynobase-icon
Dynobase

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

Rafal Wilinski

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.

Dynobase is a Professional GUI Client for DynamoDB

Start your 7-day free trial today

Product Features

Download
/
Pricing
/
Member Portal
/
Privacy
/
EULA
/
Twitter
© 2026 Dynobase
+
Still using AWS DynamoDB Console?
Try Dynobase to accelerate your DynamoDB workflow. Start your 7-day free trial today.