
Elastic beanstalk
Beanstalk is a tool that makes it simple to manage and deploy applications in the AWS cloud. It Can maintain the highly available, scalable application.

There’s a problem as you deploy and manage your Ruby on Rails project in Elastic Beanstalk on AWS. After deployment, the site operates good, but if any configuration changes are made (for example, changing the environment), the site stops working and generates errors. hence after the environment modification, it was necessary to deploy again. When the environment changed, the site was still being deployed. These kinds of problems are manageable.
How to handle issue at the time of deployment in Elastic beanstalk
If a problem is to be fixed, you must be familiar with every aspect of the situation. That is the deployment process for the source in Beanstalk. Deep dive into the elastic beanstalk, then
Deploy a Project in Beanstalk
There are various ways to deploy a project into Beanstalk. Then come the following
Zip Upload Deploy – Zip the entire project folder and upload into beanstalk and deploy into correct beanstalk environment in console
Ebcli – Install the beanstalk cli. Use ebdeploy command to deploy the project into beanstalk environment.
Use CI/CD Tool to Auto deploy – Set up a code pipeline (CI/CD tool) with the Deployable branch configured in the Git and Beanstalk environments. In comparison to the other two methods, it makes deployment easier.
How the Deployment flow in Beanstalk?
The flow of Deployment is followed by
The deployment process starts by compressing the source code for our application and uploading it to an S3 bucket for Beanstalk.
Then Download the source bundle from the S3 bucket into ec2 instance.
Execute the .ebextensions folder *.config file Before the deployment starts the .ebextensions files are copied. Here the order of execution is followed by
- Packages
- User
- Source
- Files
- Commands
- Command Runs Before the Web server Set up This process is known as infra-embedded prebuild
- Unzip the source bundle in /var/app/staging folder
- Execute the Prebuild hooks which were given into the .platform/hooks/prebuild directory

- Configure the app and proxy. Which means install the software dependencies and Web server and configure it.
- Override the proxy configurations which mentioned in the .platform/nginx directory
- Run the container_commands which is mentioned in .ebextensions.
- Execute the Pre deploy scripts which mentioned in .platformhooks/predeploy directory.
- Actual deployment starts here. Execute the procfile of which is mentioned in the applications.
- Run or rerun the proxy configurations which is mentioned in the .platform/nginx directory.
- Run the post deploy hooks which is mentioned in the .platform/postdeploy directory.
These steps happen all app deploy and also config deploy. But run the .platform/confighooks instead of .platform/hooks while config deploy which means the environment variable changes
How to check the flow of deployment?
SSH into ec2 instance using EC2instance connect, Session manager, SSH client, EC2 serial console.
Check the /var/log/eb-engine.log file which going to tell us how the deployment flow happens.
How I solve the Redeploy issue
SSH into ec2 instance after the app deployment and config deployment (configuration changes).
Compare the both app deploy’s deployment log and config deploy’s(configuration changes).
Find the missing step while config deploy. When I compare the both logs that I found that rake task not running in the configuration deployment.
Run the missing task into the form of scripts under the .platform/confighooks directory. Add the rake task .platform/confighooks/postdeploy directory.
Conclusion
When we need a solution to solve the issue in the deployment in beanstalk, check the eb-engine log. Find reason why the deployment is stopped or application is not running properly. Try find the issue and solve it.
Chandrakumar L, DevOps Team
Mallow Technologies Pvt Ltd