Reputation: 33545
I have written a state in AWS StepFunctions to insert an an item into the DynamoDB Table as shown below. The output of the Lambda state goes to the input of below the DynamoDB state.
"States":{
"Update the order table":{
"Type":"Task",
"Resource":"arn:aws:states:::dynamodb:putItem",
"Parameters":{
"TableName":"OrderTable",
"Item":{
"OrderId":{
"S":"$.OrderId"
},
"ItemName":{
"S":"$.ItemName"
},
"Price":{
"S":"$.Price"
},
"CC":{
"S":"$.CC"
}
}
},
"End":true
}
}
The literal strings "$.OrderId", "$.ItemName" and others are getting inserted into the DynamoDB table and not the values from the Lambda function.
So, I removed the double quotes around the "$.OrderId" and I get the below error.
The input to the DynamoDB state is correct, but still I am not able to insert the output of the Lambda into the DynamoDB table.
Any help would be appreciated.
Upvotes: 2
Views: 1448
Reputation: 12253
This is how your Task definition should look like. Notice $
sign after the datatype for each item attribute.
"States":{
"Update the order table":{
"Type":"Task",
"Resource":"arn:aws:states:::dynamodb:putItem",
"Parameters":{
"TableName":"OrderTable",
"Item":{
"OrderId":{
"S.$":"$.OrderId"
},
"ItemName":{
"S.$":"$.ItemName"
},
"Price":{
"S.$":"$.Price"
},
"CC":{
"S.$":"$.CC"
}
}
},
"End":true
}
}
Upvotes: 3