1

From the following link, it seems possible to call a Fargate task from the API Gateway: https://aws.amazon.com/blogs/compute/introducing-amazon-api-gateway-private-endpoints/

But, does the task have to be running 24/7 for this to work? Is it possible to have the task run only when the endpoint is hit? I have some critical but rarely used services and I'd like to make them as inexpensive as possible.

I believe something similar is possible with Gateway + Lambda: https://serverless.com/blog/flask-python-rest-api-serverless-lambda-dynamodb/

But, I like the flexibility and ease of use which comes with using Docker and Fargate.

1 Answers1

1

Short answer: no, it's not possible.

  • When no Fargate task is running the API GW has nowhere to send the request and returns an error.

  • There may be a way to trigger a lambda from API GW when no task is running and start one up, however...

  • Fargate container takes time to start - tens of seconds at least, sometimes over a minute. It would be a poor user experience if their initial request took a minute to return.

Also check this out: AWS Fargate service: scale to zero?

Use Lambda, that's the correct way to do what you want.

Hope that helps :)

MLu
  • 26,247