Search code examples
amazon-ec2aws-lambdaaws-api-gatewayamazon-ecsecs-taskdefinition

How can I call ECS task from Lambda and give arguments to ECS and return the output of ECS to Lambda?


I want to pass the arguments from the Lambda function to the ECS task, and the ECS task should process the data and return the results to the Lambda function. For example, if a user calls the API endpoint and sends some data, the API gateway will trigger the lambda function. Lambda should launch a new task on ECS and pass the request data (from the API) to the ECS task, which should process the data (request data) and return the processed data to Lambda, who should then return the data to the user as a response to the API request. Is this a possibility? If so, could you please advise me on how to proceed?


Solution

  • It seems like you have a very strong idea of what you want to do, but are unsure of how to do it.

    I would suggest starting with some of the Fargate patterns from ServerlessLand.com and building from there.