In this tutorial I will explain you to deploy a PHP laravel application on AWS Elastic Beanstalk service.
About : Amazon Elastic Beanstalk is an easy-to-use service for deploying and scaling web applications and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker on familiar servers such as Apache, Nginx, Passenger, and IIS.
Working: You simply upload your code and Elastic Beanstalk automatically handles the deployment, from capacity provisioning, load balancing, and automatic scaling to web application health monitoring, with ongoing fully managed patch and security updates.
Step-1) Create a Beanstalk Environment and APP
- Select environment as web server environment
- Create the Application and Environment name:
- Choose the Platform on which you want to deploy your app.Here We will choose PHP for our laravel project.
- The next step is to upload the code(for now we will go with sample code as we will push the original code in the next version with the code pipeline.)
- Click on create and let the enviornment get created.
Finally It will show something like this
And when you click the APP url like this
http://laravelapp-env.eba-muin3rqg.us-east-2.elasticbeanstalk.com/
it will open your app with sample code.
Step-2) Create the CodePipeline
Go to searchbar, type codepipeline and click create codepipeline
- Now Add the source stage, connect to your version control system(like Github here) and select the repository(laraval-demo) and branch(dev)
Check the Start the pipeline on source code change to automatically starts your pipeline when a change occurs in the source code.
Skip the Build stage for now. Add Deployment stage (Pipelines must have at least two stages. Your second stage must be either a build or deployment stage.)
Choose Elastic Beanstalk at the place of Deployment Provider, application name and environment name.
Click Next and Review all the steps and cofiguration.
Finally Click onCreate Pipeline
After Pipeline is succesfull create and deployed it will look something like this:
Now Go to Beanstalk enviornment dashboard and open the application version you will found out that the latest version deployed is via codepipeline
Click on Beanstalk App URL like
http://laravelapp-env.eba-muin3rqg.us-east-2.elasticbeanstalk.com/
to see our deployed laravel app.
Summary:
The CodePipeline will trigger whenever we will push the changes into the git. Hence it is our Continuous integration pipeline.
Top comments (1)
Why did you skip the build phase in CodePipeline?