[{"data":1,"prerenderedAt":62},["ShallowReactive",2],{"workflow-idempotent-workflow-sam":3},{"id":4,"title":5,"cleanup":6,"contributors":10,"deploy":12,"description":16,"diagram":17,"extension":18,"framework":19,"gitHub":20,"introBox":29,"level":35,"meta":36,"resources":37,"s3URL":49,"services":50,"simplicity":53,"stem":54,"testing":55,"type":59,"usecase":60,"videoId":28,"__hash__":61},"workflows\u002Fworkflows\u002Fidempotent-workflow-sam.json","Idempotent Workflow - SAM",{"headline":7,"text":8},"Cleanup",[9],"1. Delete the stack: \u003Ccode>sam delete\u003C\u002Fcode>.",[11],"content\u002Fcontributors\u002Fdaniel-moser.json",{"text":13},[14,15],"sam build --use-container","sam deploy --guided","A workflow that uses DynamoDB to implement idempotency ","\u002Fassets\u002Fimages\u002Fworkflows\u002Fidempotent-workflow-sam.png","json","AWS SAM",{"template":21,"payloads":26},{"repoURL":22,"templateDir":23,"templateFile":24,"ASL":25},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fstep-functions-workflows-collection\u002Ftree\u002Fmain\u002Fidempotent-workflow-sam\u002F","idempotent-workflow-sam","template.yaml","statemachine\u002Fstatemachine.asl.json",[27],{"headline":28,"payloadURL":28},"",{"headline":30,"text":31},"How it works",[32,33,34],"The workflow tracks the workflow execution and status in a DynamoDB table. When the workflow starts, an idempotency key is calculated based on the input event (customizable) and stored in the database as a semaphore together with a status of `IN_PROGRESS`.","If storing the key was successful, the workflow runs the actual workflow steps and records the result in the database with a status of `SUCCESS` (or `FAILED` in case of an error).","If acquiring the semaphore was not successful (i.e. the workflow successfully executed previously or another execution is running concurrently and thus the status is `IN_PROGRESS`) the workflow retrieves the idempotency record from the database. When the status is `SUCCESS` and there is a result the result is returned as output of the workflow. If the status is `IN_PROGRESS` the workflow continues to query the database every 10 seconds until the status changes to either `SUCCESS` and it continues as described above, or `FAILED`, in which case the workflow tries to acquire the semaphore again.","100",{},{"headline":38,"bullets":39},"Additional resources",[40,43,46],{"text":41,"link":42},"The AWS Step Functions Workshop","https:\u002F\u002Fcatalog.workshops.aws\u002Fstepfunctions\u002Fen-US",{"text":44,"link":45},"Idempotent Lambda Functions with AWS Lambda Powertools (Python)","https:\u002F\u002Fawslabs.github.io\u002Faws-lambda-powertools-python\u002Flatest\u002Futilities\u002Fidempotency\u002F",{"text":47,"link":48},"Idempotent Lambda Functions with AWS Lambda Powertools (Java)","https:\u002F\u002Fawslabs.github.io\u002Faws-lambda-powertools-java\u002Futilities\u002Fidempotency\u002F","https:\u002F\u002Fda-public-assets.s3.amazonaws.com\u002Fworkflows\u002Fidempotent-workflow-sam\u002Fcloudformation.yml",[51,52],"lambda","dynamodb","2 - Pattern","workflows\u002Fidempotent-workflow-sam",{"headline":56,"text":57},"Testing",[58],"See the GitHub repo for detailed testing instructions.","Standard","Error Handling","Is5eSDRpsyXtPPO9qfATVLxZxADI3r1Q_uSJWmdy_lA",1779273340848]