AWS1 input → 2 outputs
DynamoDB Batch
Performs bulk DynamoDB operations — insert/delete many items at once (BatchWrite) or retrieve many items by key at once (BatchGet). Handles chunking and retry automatically.
Inputs
Outputs
Output 1 — Success (BatchWrite) Output 1 — Success (BatchGet) Output 2 — ErrorHow to Use — BatchWrite
- Set Operation to
BatchWrite. - Set
msg.payload.putsto an array of item objects to insert. Each item must include all key attributes. - Optionally set
msg.payload.deletesto an array of key objects to delete. - The node automatically chunks into batches of 25 and retries any
UnprocessedItemswith exponential backoff. - Check
msg.payload.unprocessedon output 1 — if > 0, some items were not written after all retries.
How to Use — BatchGet
- Set Operation to
BatchGet(or override at runtime viamsg.payload.batchOperation). - Set
msg.payload.keysto an array of key objects to retrieve. - The node chunks into batches of 100 and returns all found items in
msg.payload.items. - Missing keys are silently absent — no error. Compare
foundvsrequestedto detect gaps.
ConnectHealth Example
Bulk-insert FHIR Patient demographics into DynamoDB after a bulk export:
// BatchWrite — insert 500 patients at once:
msg.payload = {
puts: patients.map(p => ({
id: "patient#" + p.id,
sk: "demographics",
name: p.name,
dob: p.birthDate,
mrn: p.identifier
}))
};
// Output 1: { success: true, processed: 500, unprocessed: 0 }
// BatchGet — retrieve tokens for multiple integrations:
msg.payload = {
batchOperation: "batchGet",
keys: [
{ id: "epic-hospital-A", sk: "oauth_token" },
{ id: "cerner-clinic-B", sk: "oauth_token" },
{ id: "hl7-gateway-X", sk: "session" }
]
};
// Output 1: { items: [...], found: 3, requested: 3 }
Best Practices
- Check
msg.payload.unprocessedafter BatchWrite — a non-zero value means some items were throttled and need to be re-queued. - BatchGet does not error on missing keys — always compare
foundvsrequestedto detect items that don't exist. - For very large datasets (10,000+ items), use a Function node to split the array into smaller chunks and loop through them, rather than sending everything in one message.
- BatchWrite supports mixed puts and deletes in one call — use this for atomic swap operations.