adding lambda-durable-functions-nodejs-calling-ecs#2959
adding lambda-durable-functions-nodejs-calling-ecs#2959dsiz wants to merge 5 commits intoaws-samples:mainfrom
Conversation
| "description": "Orchestrate long-running ECS Fargate tasks using Lambda durable functions with callback pattern", | ||
| "language": "Node.js", | ||
| "level": "200", | ||
| "framework": "SAM", |
There was a problem hiding this comment.
| "framework": "SAM", | |
| "framework": "AWS SAM", |
| "headline": "How it works", | ||
| "text": [ | ||
| "This pattern demonstrates how to use AWS Lambda durable functions to orchestrate Amazon ECS Fargate tasks that can run for up to 24 hours.", | ||
| "The Lambda function creates a callback ID, starts an ECS task with that ID, and suspends execution without incurring compute charges during the wait period.", |
There was a problem hiding this comment.
| "The Lambda function creates a callback ID, starts an ECS task with that ID, and suspends execution without incurring compute charges during the wait period.", | |
| "The Lambda function creates a callback ID, starts an ECS task with that ID, and then automatically suspends execution without incurring compute charges during the wait period.", |
| }, | ||
| "cleanup": { | ||
| "text": [ | ||
| "sam delete" |
There was a problem hiding this comment.
| "sam delete" | |
| "<code>sam delete</code>" |
| { | ||
| "name": "Surya Sai D", | ||
| "image": "", | ||
| "bio": "Surya works as a Technical Account Manager in AWS. He is an expert in Serverless frameworks and Event Driven Architectures. Surya is also passionate on technical writing and has contributed to AWS blogs and other Open Source Content.", |
There was a problem hiding this comment.
| "bio": "Surya works as a Technical Account Manager in AWS. He is an expert in Serverless frameworks and Event Driven Architectures. Surya is also passionate on technical writing and has contributed to AWS blogs and other Open Source Content.", | |
| "bio": "Surya works as a Technical Account Manager at AWS. He is an expert in Serverless frameworks and Event Driven Architectures. Surya is also passionate on technical writing and has contributed to AWS blogs and other Open Source Content.", |
| response.json | ||
| ``` | ||
|
|
||
| **Note:** The `:prod` alias is required for durable functions. |
There was a problem hiding this comment.
The alias is not required. Any qualified ARN suffices (https://docs.aws.amazon.com/lambda/latest/dg/durable-invoking.html#durable-invoking-qualified-arns)
| Action: | ||
| - ecs:RunTask | ||
| - ecs:DescribeTasks | ||
| Resource: '*' |
There was a problem hiding this comment.
restrict to same account and current region
| - logs:CreateLogGroup | ||
| - logs:CreateLogStream | ||
| - logs:PutLogEvents | ||
| Resource: '*' |
There was a problem hiding this comment.
restrict to same account and current region
| ExecutionTimeout: 86400 | ||
| RetentionPeriodInDays: 7 | ||
|
|
||
| # Lambda Durable Function - Polling Pattern |
lambda-durable-functions-nodejs-calling-ecs/src/callback-handler.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
This file does not seem related to this pattern
2fbfbf4 to
dc9dd7b
Compare
|
@bfreiberg please check again, I applied the suggested changes and also removed polling pattern to stick with callback pattern only. |
bfreiberg
left a comment
There was a problem hiding this comment.
Looks good, one minor change and one open comment from the previous round.
| @@ -0,0 +1,68 @@ | |||
| { | |||
| "title": "AWS Lambda durable functions in NodeJS calling ECS", | |||
There was a problem hiding this comment.
| "title": "AWS Lambda durable functions in NodeJS calling ECS", | |
| "title": "AWS Lambda durable functions in NodeJS calling Amazon ECS", |
| console.log('Callback ID created:', callbackId); | ||
| console.log('Starting ECS task with callback ID...'); |
There was a problem hiding this comment.
Please change all console.log to context.logger (see https://github.com/aws/aws-durable-execution-sdk-js/tree/main)
Issue #, if available:
Description of changes:
adding lambda-durable-functions-nodejs-calling-ecs
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.