Batch Read in DynamoDB Using Java (Guide w/ Code Examples)

Provided by Rafal Wilinski
To perform a batch GetItem request in DynamoDB, you can use the AmazonDynamoDB#batchGetItem method. This method allows you to retrieve multiple items from one or more tables in a single request.
AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard().build(); Map<String, KeysAndAttributes> requestItems = new HashMap<>(); // Add a map entry for each table from which you want to retrieve items KeysAndAttributes keysAndAttributes = new KeysAndAttributes(); // Add a list of primary key attribute values for the items you want to retrieve keysAndAttributes.setKeys( Arrays.asList( new PrimaryKey("PK", 1), new PrimaryKey("PK", 2) ) ); // Add optional attributes to retrieve for each item keysAndAttributes.setAttributesToGet(Arrays.asList("attr1", "attr2")); requestItems.put("myTable", keysAndAttributes); BatchGetItemRequest request = new BatchGetItemRequest() .withRequestItems(requestItems); BatchGetItemResult result = client.batchGetItem(request);
Similar Code Examples
- Update Expression in DynamoDB Using Java
- Update Item in DynamoDB Using Java
- Get Multiple Items in DynamoDB Using Java
- Batch Insert in DynamoDB Using Java
- Update Multiple Attributes in DynamoDB Using Java
- Remove Attribute in DynamoDB Using Java
- Batch Write Item in DynamoDB Using Java
- Query Date Range in DynamoDB Using Java
- Batch Update Using DynamoDB Mapper
- Batch Save Using DynamoDB Mapper
- Conditional Update in DynamoDB Using Java
- Update Attribute in DynamoDB Using Java
- Delete in DynamoDB Using Java
- GetItem in DynamoDB Using Java
- Delete by Hashkey Using DynamoDB Mapper
Dynobase is a Professional GUI Client for DynamoDB
Start your 7-day free trial today
Product Features
- New in Dynobase 3.0
- Semantic and Vector Search
- Schema Explorer
- Visual JSON Path Filtering
- Visual Item Diff
- MCP Server for AI Tools
- Use SQL with DynamoDB
- Import CSV To DynamoDB
- Import JSON To DynamoDB
- Export DynamoDB To JSON
- Export DynamoDB To S3
- Export DynamoDB To CSV
- DynamoDB Update Item
- DynamoDB Delete All Items
- DynamoDB Delete Item
- DynamoDB Create Table
- DynamoDB Delete Table
- DynamoDB Conditional Update
DynamoDB Tools
DynamoDB Info
© 2026 Dynobase