When I was trying to deploy my Django application to AWS Elastic Beanstalk. Then I got this error.
2023/12/30 21:26:42.478526 [ERROR] An error occurred during the execution of command [app-deploy] - [PreBuildEbExtension]. Stop running the command. Error: EbExtension build failed. Please refer to /var/log/cfn-init.log for more details.
What is the reason for that?
Here is my Django.config which is located in .ebextensions folder.
When I remove the 'commands' it gives me 502 bad gateway since the application cannot import the relavant packages.
commands:
01_activate_virtualenv:
command: "source /var/app/venv/staging-LQM1lest/bin/activate"
02_install_requirements:
command: "pip install -r /var/app/current/requirements.txt"
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: django-pixel/core/wsgi.py

Elastic Beanstalks keeps many log files for every stages of the deployment. If you got any error from .ebextensions folder, you need to check cfn-init.log. As the error message said:
You need to ssh into your eb instance and write down:
cat /var/log/cfn-init.logto view it. For more details lookcfn-init-cmd.log.