Perform DynamoDB CRUD operations with Step Functions
You can integrate Step Functions with DynamoDB to perform CRUD operations on a DynamoDB table. This page lists the supported
DynamoDB APIs and provides an example Task
state to retrieve an item from DynamoDB.
Step Functions can control certain Amazon services directly from Using Amazon States Language to define Step Functions workflows (ASL). To learn more, see Integrating other services and Passing parameters to a service API in Step Functions.
Note
There is a quota for the maximum input or result data size for a task in Step Functions. This restricts you to 256 KB of data as a UTF-8 encoded string when you send to, or receive data from, another service. See Quotas related to state machine executions.
How the optimized DynamoDB integration is different than the DynamoDB Amazon SDK integration
-
There is no optimization for the Request Response integration pattern.
-
The Wait for a Callback with the Task Token integration pattern is not supported.
-
Only
GetItem
,PutItem
,UpdateItem
, andDeleteItem
API actions are available through optimized integration. Other API actions, such asCreateTable
are available using the DynamoDB Amazon SDK integration.
Supported Amazon DynamoDB APIs and syntax:
Parameters in Step Functions are expressed in PascalCase
Even if the native service API is in camelCase, for example the API action startSyncExecution
, you specify parameters in PascalCase, such as: StateMachineArn
.
The following is a Task
state that retrieves a message from DynamoDB.
"Read Next Message from DynamoDB": {
"Type": "Task",
"Resource": "arn:aws:states:::dynamodb:getItem",
"Parameters": {
"TableName": "TransferDataRecords-DDBTable-3I41R5L5EAGT",
"Key": {
"MessageId": {"S.$": "$.List[0]"}
}
},
"ResultPath": "$.DynamoDB",
"Next": "Send Message to SQS"
},
To see this state in a working example, see the Transfer data records with Lambda, DynamoDB, and Amazon SQS sample project.
For information about how to configure IAM permissions when using Step Functions with other Amazon services, see How Step Functions generates IAM policies for integrated services.