Skip to content

Commit 0715a8b

Browse files
committed
fix: Scope IAM, lowercase durable functions
- Scope lambda:InvokeFunction to specific functions instead of wildcard - Lowercase durable functions throughout docs and template - Add expected test output in README - Add LinkedIn profile to example-pattern.json
1 parent 0531ff5 commit 0715a8b

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

lambda-durable-hitl-python-sam/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Lambda Durable Functions to DynamoDB with Human-in-the-Loop
1+
# AWS Lambda durable functions to DynamoDB with Human-in-the-Loop
22

33
This pattern demonstrates how to implement Lambda durable functions with Human-in-the-Loop (HITL) approval workflows. The workflow pauses execution, waits for human approval via callback, and resumes based on the decision while maintaining state across the pause/resume cycle.
44

@@ -137,6 +137,10 @@ aws logs tail /aws/lambda/$WORKFLOW_FUNCTION --follow
137137

138138
Expected output: The workflow should complete and return the approval decision. The DynamoDB item should show status as "approved" with the approver's comments and timestamp.
139139

140+
A successful test shows these log messages:
141+
- Workflow logs: `Callback created``Approval request created``SNS notification sent``Waiting for approval callback`
142+
- After approval: `Callback received, workflow resuming``Workflow completed successfully` with decision "approved"
143+
140144
## Cleanup
141145

142146
1. Delete the stack

lambda-durable-hitl-python-sam/example-pattern.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"title": "Lambda Durable Functions with Human-in-the-Loop",
2+
"title": "Lambda durable functions with Human-in-the-Loop",
33
"description": "Demonstrates Lambda durable functions with human approval workflow using Python 3.13, DynamoDB, and SNS",
44
"language": "Python",
55
"level": "300",
@@ -66,13 +66,14 @@
6666
"authors": [
6767
{
6868
"name": "Mian Tariq",
69-
"bio": "Cloud Solutions Architect"
69+
"bio": "Cloud Solutions Architect",
70+
"linkedin": "mian-tariq"
7071
}
7172
],
7273
"patternArch": {
7374
"icon1": {
7475
"name": "lambda",
75-
"label": "Lambda Durable Functions"
76+
"label": "Lambda durable functions"
7677
},
7778
"icon2": {
7879
"name": "dynamodb",

lambda-durable-hitl-python-sam/template.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
AWSTemplateFormatVersion: '2010-09-09'
22
Transform: AWS::Serverless-2016-10-31
33
Description: >
4-
Lambda Durable Functions with Human-in-the-Loop (HITL) Pattern
4+
Lambda durable functions with Human-in-the-Loop (HITL) Pattern
55
66
This pattern demonstrates how to pause Lambda execution, wait for human approval,
77
and resume using the Lambda durable functions SDK with Python 3.13.
@@ -102,7 +102,7 @@ Resources:
102102
- Effect: Allow
103103
Action:
104104
- lambda:InvokeFunction
105-
Resource: !Sub 'arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${AWS::StackName}-*'
105+
Resource: !Sub 'arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${AWS::StackName}-ApprovalApi'
106106
- Effect: Allow
107107
Action:
108108
- lambda:CheckpointDurableExecution
@@ -165,7 +165,7 @@ Resources:
165165
- Effect: Allow
166166
Action:
167167
- lambda:InvokeFunction
168-
Resource: !Sub 'arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${AWS::StackName}-*'
168+
Resource: !Sub 'arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${AWS::StackName}-Workflow'
169169
- Effect: Allow
170170
Action:
171171
- lambda:SendDurableExecutionCallbackSuccess

0 commit comments

Comments
 (0)