@@ -39,7 +39,7 @@ Each step is automatically checkpointed, allowing the workflow to resume from th
3939* [ AWS CLI] ( https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html ) installed and configured
4040* [ AWS SAM CLI] ( https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html ) installed
4141* [ Python 3.13] ( https://www.python.org/downloads/ ) (for local development)
42- * [ Docker] ( https://docs.docker.com/get-docker/ ) ( for containerized builds )
42+ * [ Docker] ( https://docs.docker.com/get-docker/ ) or [ Finch ] ( https://runfinch.com/ ) ( for ` sam build --use-container ` )
4343
4444### Required IAM Permissions
4545
@@ -53,12 +53,13 @@ Your AWS CLI user/role needs the following permissions for deployment and testin
5353
5454## Deployment
5555
56- 1 . Navigate to the pattern directory:
56+ 1 . Clone the repository and navigate to the pattern directory:
5757 ``` bash
58- cd lambda-durable-webhook-sam-python
58+ git clone https://github.com/aws-samples/serverless-patterns
59+ cd serverless-patterns/lambda-durable-webhook-sam-python
5960 ```
6061
61- 2 . Build the application using containerized build (required for Python 3.13) :
62+ 2 . Build the application:
6263 ``` bash
6364 sam build --use-container
6465 ```
@@ -71,7 +72,7 @@ Your AWS CLI user/role needs the following permissions for deployment and testin
7172 During the guided deployment, provide:
7273 - ** Stack Name** : ` lambda-durable-webhook ` (or your preferred name)
7374 - ** AWS Region** : Choose a region that supports durable functions (e.g., ` us-east-1 ` )
74- - ** WebhookSecret** : (Optional) Leave empty or provide a secret for HMAC validation
75+ - ** WebhookSecret** : Press Enter to skip (optional — only needed if you want HMAC signature validation)
7576 - ** Confirm changes** : Y
7677 - ** Allow SAM CLI IAM role creation** : Y
7778 - ** Save arguments to configuration file** : Y
@@ -84,14 +85,18 @@ Your AWS CLI user/role needs the following permissions for deployment and testin
8485
8586## Testing
8687
87- ### Step 1: Get Your API Endpoint
88+ ### Step 1: Monitor Lambda Logs (in a separate terminal)
8889
89- After deployment, get the webhook endpoint :
90+ View the durable function execution logs :
9091``` bash
91- aws cloudformation describe-stacks \
92- --stack-name lambda-durable-webhook \
93- --query ' Stacks[0].Outputs[?OutputKey==`WebhookEndpoint`].OutputValue' \
94- --output text
92+ # Get function name
93+ FUNCTION_NAME=$( aws cloudformation describe-stack-resources \
94+ --stack-name < stack-name> \
95+ --query ' StackResources[?LogicalResourceId==`WebhookProcessorFunction`].PhysicalResourceId' \
96+ --output text)
97+
98+ # Tail logs
99+ aws logs tail /aws/lambda/$FUNCTION_NAME --follow
95100```
96101
97102### Step 2: Submit a Webhook
@@ -120,7 +125,7 @@ Expected response (202 Accepted):
120125Wait a few seconds, then query the status. First, get the execution token from DynamoDB:
121126``` bash
122127aws dynamodb scan \
123- --table-name lambda-durable-webhook -webhook-events \
128+ --table-name < stack-name > -webhook-events \
124129 --limit 1 \
125130 --query ' Items[0].executionToken.S' \
126131 --output text
@@ -147,28 +152,6 @@ Expected response:
147152}
148153```
149154
150- ### Step 4: Monitor Lambda Logs
151-
152- View the durable function execution logs:
153- ``` bash
154- # Get function name
155- FUNCTION_NAME=$( aws cloudformation describe-stack-resources \
156- --stack-name lambda-durable-webhook \
157- --query ' StackResources[?LogicalResourceId==`WebhookProcessorFunction`].PhysicalResourceId' \
158- --output text)
159-
160- # Tail logs
161- aws logs tail /aws/lambda/$FUNCTION_NAME --follow
162- ```
163-
164- You should see the 3 checkpointed steps:
165- ```
166- Step 1: Validating 1234567890123
167- Step 2: Processing 1234567890123
168- Step 3: Finalizing 1234567890123
169- Stored event: 1234567890123, status: completed
170- ```
171-
172155## How It Works
173156
174157### Durable Execution
@@ -266,42 +249,15 @@ python -m pytest tests/ --cov=src --cov-report=html
266249
267250To completely remove the stack and all resources:
268251
269- ### Option 1: Using SAM CLI (Recommended)
270-
271252``` bash
272- sam delete --stack-name lambda-durable-webhook --region us-east-1
253+ sam delete
273254```
274255
275256When prompted:
276257- ** Delete the stack** : Y
277258- ** Delete ECR repository** : Y (if using container images)
278259- ** Delete S3 bucket** : Y
279260
280- ### Option 2: Using AWS CLI
281-
282- ``` bash
283- # Delete the CloudFormation stack
284- aws cloudformation delete-stack \
285- --stack-name lambda-durable-webhook \
286- --region us-east-1
287-
288- # Wait for deletion to complete
289- aws cloudformation wait stack-delete-complete \
290- --stack-name lambda-durable-webhook \
291- --region us-east-1
292- ```
293-
294- ### Verify Cleanup
295-
296- Confirm all resources are deleted:
297-
298- ``` bash
299- # Check stack status (should return error if deleted)
300- aws cloudformation describe-stacks \
301- --stack-name lambda-durable-webhook \
302- --region us-east-1
303- ```
304-
305261### Clean Local Build Artifacts
306262
307263``` bash
0 commit comments