Elastic Beanstalk: `.ebextensions` not getting executed

Question:

I’m deploying a PHP application to Beanstalk and all appears to be fine, however my .ebextensions configuration files don’t seem to be running.

I have just a single configuration file that is supposed to create a file, and then reload nginx.
/my-project/.ebextensions/nginx.config:

My architecture is currently:
1. CodePipeline hooked up to GitHub that deploys the app to CodeDeploy everytime master is updated.
2. CodeDeploy receives the deployment from CodePipeline.
3. CodeDeploy installs it to the Elastic Beanstalk instance.

All the above steps work fine. I just don’t understand why the config file in .ebextensions is not creating the file as expected.

Note: I have confirmed that the .ebextensions folder is in the root of the revision .zip by manually downloading one of the revisions and checking.

Answer:

For me I was confused why a file I was trying to create was not showing up when I was deploying. The deployment had an error, and the system would automatically delete the file due to the error instead of letting it persist while rolling back to it’s previous state on failure. This gave me the false notion that the file was never created in the first place.

I was able to determine this from /var/log/nginx/error.log which gave the following:

which meant at least for me, I needed to override nginx.conf instead of adding a configuration file. Make sure that you aren’t getting errors with your deployment if you’re not seeing a file get created.

Leave a Reply