Skip to content

Add Step Functions to ECS Python integration pattern (sfn-ecs-python-sam)#2927

Open
4D54 wants to merge 2 commits intoaws-samples:mainfrom
4D54:sfn-ecs-python-sam-pattern
Open

Add Step Functions to ECS Python integration pattern (sfn-ecs-python-sam)#2927
4D54 wants to merge 2 commits intoaws-samples:mainfrom
4D54:sfn-ecs-python-sam-pattern

Conversation

@4D54
Copy link

@4D54 4D54 commented Feb 5, 2026

  • 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

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.

- 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
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.

Hi @4D54 - requesting a few minor changes. Also, please take a look at the error I received while testing the callback scenario.

awslogs-stream-prefix: callback

# Step Functions Role
StepFunctionsRole:
Copy link
Contributor

Choose a reason for hiding this comment

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

Recommend scoping this policy down to only the task and cluster being acted upon.

- `SyncStateMachineArn` - ARN for the synchronous pattern
- `CallbackStateMachineArn` - ARN for the callback pattern
- `ECSClusterName` - Name of the ECS cluster
- `TaskDefinitionArn` - ARN of the task definition
Copy link
Contributor

Choose a reason for hiding this comment

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

This output isn't included in the template outputs. Please check.

aws logs tail /ecs/sfn-ecs-python-callback --follow
```

4. **The task will automatically send the callback** when processing completes.
Copy link
Contributor

Choose a reason for hiding this comment

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

The callback execution failed in my test:

The ECS task did not send a callback within the timeout period

The ECS task log has the following:

[CALLBACK] ERROR: An error occurred (TaskTimedOut) when calling the SendTaskSuccess operation: Task Timed Out: 'Provided task does not exist anymore'
[CALLBACK] Failed to send callback: An error occurred (TaskTimedOut) when calling the SendTaskFailure operation: Task Timed Out: 'Provided task does not exist anymore'


---

Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
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
Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copyright 2026 Amazon.com, Inc. or its affiliates. All Rights Reserved.

"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.

Please add a publicly accessible 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.

Please add a linkedin id

@@ -0,0 +1,365 @@
# AWS Step 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
# AWS Step Functions to Amazon ECS with Python
# AWS Step Functions to Amazon Elastic Container Service (Amazon ECS) with Python

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants