ECS Fargate service with load balancer not working

0

I have been stuck on this for 3 days. I have a fargate service running in ECS. It is running a gunicorn app on port 80. I can see from the logs, the server starts:

[2023-04-04 20:51:39 +0000] [1] [INFO] Listening at: http://0.0.0.0:80 (1)

I have a load balancer, listening at port 80 with a target group. My issue is I cannot seem to access to load balancer. Get the following:

<!doctype html>
<html lang=en>
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>

I can confirm that:

  1. My load balancer is exposed to the internet.
  2. My security group for ECS has inbound rule to allow traffic from my load balancer.

I must have tried about 15 times. I cannot seem to make it work.

1 Antwort
1
Akzeptierte Antwort

I believe that given that the http "404" error is an application error is not related to load balancer or other network configuration. If you are getting 404 error you are actually reaching the application, however the application do have the web page you are trying to display. My suggestion is to double check your docker image configuration, you are probably having some issue on how you build you image.

To make the debugging faster, you could run the container in your local environment, login into your container and verify that you are getting the same error performing the same API call. For example:

wget http://localhost:80

If you are getting the same error is going to be clear that the issue is within the docker image itself

AWS
beantwortet vor einem Jahr
profile picture
EXPERTE
überprüft vor 9 Monaten
profile pictureAWS
EXPERTE
überprüft vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen