Mugetsu
Mugetsu

Reputation: 1978

AWS Fargate 503 Service Temporarily Unavailable

I'm trying to deploy backend application to the AWS Fargate using cloudformation templates that I found. When I was using the docker image training/webapp I was able to successfully deploy it and access with the externalUrl from the networking stack for the app.
When I try to deploy our backend image I can see the stacks are deploying correctly but when I try to go to the externalUrl I get 503 Service Temporarily Unavailable and I'm unable to see it... Another thing that I've noticed is on the docker hub I can see that the image is continuously pulled all the time when the cloudformation services are running...

The backend is some kind of maven project I don't know exactly what but I know that locally its working but to get it up running the container with this backend image takes about 8 minutes... I'm not sure if this affects the Fargate ?? Any Idea how to get it working ?

Upvotes: 2

Views: 9608

Answers (2)

Miguel Carvalhais Matos
Miguel Carvalhais Matos

Reputation: 1143

Try adding a Health check grace period of 60 by going to ECS -> cluster -> service -> update Network Access section.

Upvotes: 1

Datise
Datise

Reputation: 3963

It sounds like you need to find the actual error that you're experiencing, the 503 isn't enough information. Can you provide some other context?

I'm not familiar with fargate but have been using ecs quite a bit this year and I generally would find that by going to (on the dashboard) ecs -> cluster -> service -> events. The events tab gives more specific errors as to what is happening.

My ecs deployment problems are generally summarized into

  1. the container is not exposing the same port as is in the definition, this could be the case if you're deploying from a stack written by someone else.
  2. the task definition memory/cpu restrictions don't grant enough space for the application and it has trouble placing (probably a problem with ecs more than fargate but you never know.)
  3. Your timeout in the task definition is not set to 8 minutes: see this question, it has a lot of this covered
  4. Your start command in the task definition does not work as expected with the container you're trying to deploy

If it is pulling from docker hub continuously my bet would be that it's 1, 3 or 4, and it's attempting to pull the image over and over again.

Upvotes: 8

Related Questions