Skip to content

Lambda ecs durable python sam#2953

Open
4D54 wants to merge 4 commits intoaws-samples:mainfrom
4D54:lambda-ecs-durable-python-sam
Open

Lambda ecs durable python sam#2953
4D54 wants to merge 4 commits intoaws-samples:mainfrom
4D54:lambda-ecs-durable-python-sam

Conversation

@4D54
Copy link

@4D54 4D54 commented Feb 12, 2026

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

4D54 added 3 commits February 5, 2026 19:46
- Demonstrates synchronous (polling) and callback integration patterns
- Includes inline Python code in ECS task definitions
- Complete SAM template with VPC, networking, and IAM roles
- Comprehensive documentation and testing instructions
- Document permissive IAM and security group configurations
- Explain why they exist (demo/learning purposes)
- Provide production security recommendations
- Recommend deployment in non-production environments
…ttern

- Replace sfn-ecs-python-sam with lambda-ecs-python-sam
- Implement synchronous pattern with polling using context.wait()
- Implement callback pattern with DynamoDB state tracking
- Use Python 3.13 with container image deployment
- Support durable execution for workflows up to 1 year
- Reduce costs with no charges during context.wait() periods
@rohanmeh
Copy link

@4D54 instead of storing the callback token in dynamodb, the ecs task can call these to send the callback token to the lambda service directly?

send_durable_execution_callback_failure
send_durable_execution_callback_heartbeat
send_durable_execution_callback_success

@bfreiberg
Copy link
Contributor

And please make sure to use the correct capitalization: It's Lambda durable functions not Lambda Durable Functions

@bfreiberg bfreiberg added the durable functions Pattern for AWS Lambda durable functions label Feb 19, 2026
… APIs

- callback_handler: Use context.create_callback() and callback.result()
  instead of DynamoDB-based polling
- template.yaml: Remove CallbackTable, update ECSTaskRole with durable
  execution callback permissions, fix IAM circular dependency using Sub
  with explicit ARN construction
- ECS task now calls SendDurableExecutionCallbackSuccess/Failure directly
- README restructured to match serverless-patterns format
@4D54
Copy link
Author

4D54 commented Mar 2, 2026

Fixed! Thanks @rohanmeh @bfreiberg

Copy link
Contributor

@ellisms ellisms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the submission @4D54 . Requesting a few changes.

Statement:
- Effect: Allow
Action:
- ecs:RunTask
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RunTask should be scoped to a specific task.

Action:
- ecs:RunTask
- ecs:DescribeTasks
Resource: '*'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be scoped to the specific tasks being run.

Action:
- lambda:CheckpointDurableExecutions
- lambda:GetDurableExecutionState
Resource: '*'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be scoped to at least the function name, with wildcards for the individual executions.

```
1. Change directory to the pattern directory:
```
cd lambda-ecs-python-sam
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be lambda-ecs-durable-python-sam

response.json

# Monitor Lambda logs
aws logs tail /aws/lambda/$SYNC_FUNCTION --follow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What information determines a successful test?

"resources": {
"bullets": [
{
"text": "Lambda Durable Functions",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"text": "Lambda Durable Functions",
"text": "Lambda durable functions",

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
Lambda Durable Functions to ECS with Python - Demonstrates durable execution patterns with ECS tasks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Lambda Durable Functions to ECS with Python - Demonstrates durable execution patterns with ECS tasks
Lambda durable functions to ECS with Python - Demonstrates durable execution patterns with ECS tasks

@@ -0,0 +1,138 @@
# Lambda Durable Functions to Amazon ECS with Python
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Lambda Durable Functions to Amazon ECS with Python
# AWS Lambda durable functions to Amazon ECS with Python

"authors": [
{
"name": "Mian Tariq",
"image": "",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a publicly available image?

"name": "Mian Tariq",
"image": "",
"bio": "Senior Delivery Consultant",
"linkedin": ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a linkedin ID?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

durable functions Pattern for AWS Lambda durable functions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants