AWS Beanstalk timeouts after 60 seconds

0

Hi,

I have a Python Flask server running on AWS Beanstalk. It times out after 60 seconds:

504 Gateway Time-out - Nginx. 

I tried adding a .ebextensions folder in the root folder of my project that contains the application.py. In that I added a file called nginx.config with the following contents:

option_settings:
  - namespace: aws:elbv2:loadbalancer
    option_name: IdleTimeout
    value: 300
files:
  "/etc/nginx/conf.d/nginx.custom.conf":
      mode: "644"
      owner: "root"
      group: "root"
      content: |
        client_header_timeout   300;
        client_body_timeout     300;
        send_timeout            300;
        proxy_connect_timeout   300;
        proxy_read_timeout      300;
        proxy_send_timeout      300;

It still doesn't work. Can anyone help me?

Mohit
gefragt vor 5 Monaten464 Aufrufe
1 Antwort
0
profile picture
EXPERTE
beantwortet vor 5 Monaten
  • Hi Riku,

    Thank you for your quick response.

    I am not sure what is uwgi. First time hearing it. I am using Flask with python and I am quite new to it. Do I need to set those in my nginx config? If so can you please guide me on how exactly? Do I just append it after proxy_send_timeout?

    Thank you for your help

  • I am not sure what is uwgi. First time hearing it.

    This is middleware for application servers to run Python applications.

    Do I just append it after proxy_send_timeout?

    Yes, you should just write the settings after "proxy_send_timeout".

  • HI Riku,

    Thank you for your response.

    I tried the following:

    option_settings:
      - namespace: aws:elbv2:loadbalancer
        option_name: IdleTimeout
        value: 300
    files:
      "/etc/nginx/conf.d/nginx.custom.conf":
          mode: "644"
          owner: "root"
          group: "root"
          content: |
            client_header_timeout   300;
            client_body_timeout     300;
            send_timeout            300;
            proxy_connect_timeout   300;
            proxy_read_timeout      300;
            proxy_send_timeout      300;
            uwsgi_read_timeout      300;
            uwsgi_send_timeout      300;  
    

    It didn't work. Am I doing something wrong?

  • By the way, can you connect to ElasticBeanstalk's EC2 using SSH etc. and check if the settings are configured in "/etc/nginx/conf.d/nginx.custom.conf"? If the settings are not configured, please create the ".conf" file by creating ".platform/nginx/conf.d/" instead of ".ebextensions". https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux-extend.html#platforms-linux-extend.example

  • For example, try creating a file in the ElasticBeanstalk project folder as shown below. ".platform/nginx/conf.d/nginx.custom.conf"

    client_header_timeout   300;
    client_body_timeout     300;
    send_timeout            300;
    proxy_connect_timeout   300;
    proxy_read_timeout      300;
    proxy_send_timeout      300;
    uwsgi_read_timeout      300;
    uwsgi_send_timeout      300;
    

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