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 Answer
2
Accepted Answer

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
answered a year ago
profile picture
EXPERT
reviewed 17 days ago
profile picture
EXPERT
reviewed a year ago
profile pictureAWS
EXPERT
reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions