pythonamazon-web-servicesflaskamazon-elastic-beanstalkebextensions

How do I prevent my Elastic Beanstalk app from showing as unhealthy if my post deploy takes a long time?


I my .ebextensions/00.command.config, I have:

container_commands:
  00_download_models:
    command: "./download.py"

In download.py, I have some code that downloads a lot of files (around 20GB). That takes time and I'd like that to finish before Elastic Beanstalk attempts to boot my app. But in /var/log/web.stdout.log, I see:

Jun 27 19:42:46 ip-172-31-46-211 web: [2020-06-27 19:42:46 +0000] [3997] [INFO] Worker exiting (pid: 3997)
Jun 27 19:42:46 ip-172-31-46-211 web: Loading generator
Jun 27 19:42:46 ip-172-31-46-211 web: using device: cpu

Loading generator is what I print in my application.py. This is a flask app, if that matters. It appears to attempt to restart the app multiple times while downloading.

What can I do to first finish download.py, THEN attempt to start the app?


Solution

  • In EB, you can disable health checks during deployments. For example in console you can do this as shown in the screenshot:

    enter image description here

    Obviously, you can also do it form CLI if you use it for deployments.

    They still may show as unhealthy, but won't lead to failed deployments.