How to Deploy Laravel on Amazon Web Services: A Detailed Step-by-step Tutorial

To do so run the code below:cd /home/ec2-usercurl -O https://aws-codedeploy-.s3.amazonaws.com/latest/installchmod +x ./installsudo ./install autoIf the CodeDeploy agent is successfully installed go to Bitbucket and make your first deployStep 2.5 Deploy on Load Balanced environmentAccess your AWS ConsoleGo to EC2Click Auto Scaling Groups in the left menuSelect the group that corresponds to your load balancerTake note of the Launch Configuration name that corresponds to the Auto Scaling GroupClick Launch Configurations in the left menuSelect the configuration that you needClick Actions > Copy launch configurationOn the new page click Edit detailsClick Advanced Details and in the User data text area after Content-Disposition: attachment; filename=”user-data.txt” add:#!/bin/bashsudo yum install -y nodejs npm –enablerepo=epel pip install awscli php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"sudo php composer-setup.php — –install-dir=/home/ec2-user –filename=composersudo rm composer-setup.php yum -y updateyum install -y ruby cd /home/ec2-usercurl -O https://aws-codedeploy-.s3.amazonaws.com/latest/installchmod +x ./install./install autoClick Skip to reviewClick Create laungh configurationSelect a key pairCheck I acknowledge that I have access to the selected private key file, and that without this file, I won’t be able to log into my instance and click Create launch configurationClick Auto Scaling Groups in the left menu and then select your balancer’s groupClick Actions > EditIn the Details tab for Launch Configuration select the newly created configuration and click SaveNow you need to update the appspec.yml file that is in your project root with the following codeApplicationStart:- location: scripts/RegisterWithELB.shApplicationStop:- location: scripts/DeregisterFromELB.shAdd RegisterWithELB.sh and DeregisterFromELB.sh in your project’s scripts folderPush modifications to BitbucketStep 2.6 Deploy from BitbucketGo to your project’s repository on BitbucketClick BranchesClick the branch that you want to deploy to AWSClick Deploy to AWSChoose desired Deployment GroupClick Start DeploymentNow you can check on the status of the deployment in the CodeDeploy consoleConclusionWith a bit of luck, at this point you should have a Laravel app running on Elastic Beanstalk..Feel free to start tweaking the setup and config files to meet your needs..What’s next?.If you’re thinking of monitoring your environment or integrating with other AWS services, have a look at the Elastic Beanstalk documentation.I hope you’ve enjoyed this article about deploying Laravel to AWS using Elastic Beanstalk..Do you have any hints or tips of your own?.Or maybe some questions?.Feel free to ask in the comments.Or maybe you’re trying to do other cool stuff with Laravel..I have..Stay tuned for other step-by-step guides to deploying a Laravel app on Heroku, on Google Compute Engine on LINUX, on Google App Engine or setting up a Laravel-based e-commerce platform.Happy coding!If you liked this, you might also be interested in our other projects..Read more on our blog..Follow us @UPDIVISION1 and on Facebook.. More details

Leave a Reply