Worldskills 2024
Menu
Deployment
EC2
ECR
EKS
Serverless
Other
Utility
Best Practices
Home
CLI
lambda
0 Clicks
step function to iterate of json and update dyanmodb
Copy
example input: { "Pferds": [ {"id": "Pferd1"}, {"id": "Pferd2"}, {"id": "Pferd3"} ] } { "Comment": "Step Function to update Pferd hunger values using DynamoDB", "StartAt": "UpdatePferdHunger", "States": { "UpdatePferdHunger": { "Type": "Map", "ItemsPath": "$.Pferds", "Iterator": { "StartAt": "UpdateItem", "States": { "UpdateItem": { "Type": "Task", "Resource": "arn:aws:states:::dynamodb:updateItem", "Parameters": { "TableName": "unicorn", "Key": { "id": { "S.$": "$.id" } }, "UpdateExpression": "SET hunger = :newVal", "ExpressionAttributeValues": { ":newVal": { "N": "100" } } }, "End": true } } }, "End": true } } }