Search code examples
amazon-web-servicesamazon-ecs

AWS ECS Custom RunTask Response


I am using AWS ECS and invoking tasks via the AWS SDK RunTask function: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_RunTask.html

I am pulling messages from an SQS queue in these tasks and want to send these messages as string back in the RunTask response. Does anyone know how I could add this in the response, thanks.


Solution

  • That's not possible. RunTask exits as soon as it asks ECS to run a task. It doesn't sit and wait for a task to complete before returning a response. It doesn't even wait for the task to start running. Also, there's no way to "send a response" back from the docker container running inside ECS.

    Are you sure AWS Lambda isn't a better fit for your use case? If not, then you will need to have your docker application running in ECS push your response somewhere else, like to SQS, SNS, SES, etc.