2

I have my application hosted in AWS. And I have a python application running on the ECS using gunicorn web server and the ECS is behind the load balancer (ALB). The issue that I'm facing is, I get a 502 Gateway error often from ALB. When I checked the logs, it has - (hyphen) in the place of the target_status_code column.

According to AWS doc, the following is the description for this field,

target_status_code: The status code of the response from the target. This value is recorded only if a connection was established to the target and the target sent a response. Otherwise, it is set to -.

But when I checked the target groups, it doesn't look like there are any connection issues.

I use the following command to start the gunicorn workers,

gunicorn \
-c gunicorn_config.py \
-b 0.0.0.0:5000 aiohttp_wsgi_handler:aioapp \
-k aiohttp.worker.GunicornWebWorker \
-w 3 \
--access-logfile - \
--access-logformat '%t [INFO] %P request_id=%{X-REQUEST-ID}o cf_id=%{X-Amz-Cf-Id}i %r %s %b %Tfs' \
--log-level debug \
--graceful-timeout 180

Also, I checked the application logs, the request that I made hasn't reached the application.

What could be the cause for this?

Manoj Kumar S
  • 634
  • 8
  • 16

0 Answers0