{"id":827,"date":"2022-11-29T06:09:25","date_gmt":"2022-11-29T06:09:25","guid":{"rendered":"http:\/\/cloudaliv.com\/stage\/?p=827"},"modified":"2023-08-09T09:08:41","modified_gmt":"2023-08-09T09:08:41","slug":"deploying-php-application-to-aws-elastic-beanstalk-using-aws-codepipeline","status":"publish","type":"post","link":"https:\/\/cloudaliv.com\/stage\/deploying-php-application-to-aws-elastic-beanstalk-using-aws-codepipeline\/","title":{"rendered":"Deploying PHP application to AWS Elastic Beanstalk using AWS CodePipeline"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"827\" class=\"elementor elementor-827\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-35b6e594 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"35b6e594\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-1d8c9126\" data-id=\"1d8c9126\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-4534d006 elementor-widget elementor-widget-text-editor\" data-id=\"4534d006\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\r\n<h3 class=\"wp-block-heading\"><strong>AWS Elastic Beanstalk<\/strong><\/h3>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Elastic Beanstalk can be used to deploy and manage applications within the AWS Cloud without having knowledge about the infrastructure that executes those applications. Elastic Beanstalk supports applications developed in java, Go, PHP, NodeJS, Python and Ruby. Elastic Beanstalk reduces management complexity and handles capability provisioning, load balancing, scaling and application health. AWS Elastic Beanstalk for PHP makes it easy to deploy, manage, and scale PHP web applications.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><strong>AWS CodePipeline<\/strong><\/h3>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">AWS CodePipeline is a continuous delivery service that assists in automating pipelines for fast and reliable application and infrastructure updates. When new commits happen AWS CodePipeline automates the build, test, and deployment stages of a new release. AWS CodePipeline easily integrates AWS cloud environments with third-party services such as GitHub.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Setting up AWS Elastic Beanstalk and CodePipeline is relatively easy. We have outlined the steps below.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><strong>Step 1: Create an EB environment<\/strong><\/h3>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Elastic Beanstalk will host web applications without the need to launch, configure, or operate EC2 instances on your own. It automatically provisions and operates the infrastructure. Don\u2019t need to worry about the infrastructure, Elastic Beanstalk will take care of everything.<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Go to Elastic Beanstalk\u2019 Console and Click on \u2018Create Application\u2019<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"169\" class=\"wp-image-829\" src=\"http:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-1-1024x169.png\" alt=\"\" srcset=\"https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-1-1024x169.png 1024w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-1-300x50.png 300w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-1-768x127.png 768w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-1-1536x254.png 1536w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-1.png 1672w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Choose PHP as Platform from the drop-down menu and click on \u2018Create Application\u2019<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"986\" class=\"wp-image-830\" src=\"http:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-2-1024x986.png\" alt=\"\" srcset=\"https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-2-1024x986.png 1024w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-2-300x289.png 300w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-2-768x740.png 768w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-2.png 1033w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Elastic Beanstalk will create a sample environment with an Amazon EC2 instance, a security group, an Auto Scaling group, an Amazon S3 bucket, Amazon CloudWatch alarms, and a domain name for the application.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Note: This may take several minutes.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"189\" class=\"wp-image-831\" src=\"http:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-3-1024x189.png\" alt=\"\" srcset=\"https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-3-1024x189.png 1024w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-3-300x55.png 300w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-3-768x142.png 768w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-3-1536x284.png 1536w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-3.png 1801w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Once the environment setup is completed, can see the health status and access the EB endpoint to view the sample PHP page.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"395\" class=\"wp-image-832\" src=\"http:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-4-1024x395.png\" alt=\"\" srcset=\"https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-4-1024x395.png 1024w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-4-300x116.png 300w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-4-768x296.png 768w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-4-1536x592.png 1536w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-4.png 1722w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"297\" class=\"wp-image-833\" src=\"http:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-5-1024x297.png\" alt=\"\" srcset=\"https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-5-1024x297.png 1024w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-5-300x87.png 300w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-5-768x223.png 768w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-5-1536x446.png 1536w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-5.png 1891w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><strong>Step 2: Clone the sample code from the GitHub repository<\/strong><\/h3>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Sample PHP application is in GitHub which is going to be deployed on Elastic Beanstalk and along with that, CodePipeline needs to be configured. This pipeline will take the source code from the GitHub repository and deploy it to Elastic Beanstalk. If there is any change in the source code it will directly deploy that change to EB-EC2 Instances.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Fork the GitHub repository for PHP Sample Application: https:\/\/github.com\/example\/aws-codepipeline-s3-codedeploy-linux.git<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><strong>Step 3: Create a CodePipeline<\/strong><\/h3>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Using CodePipeline, Build, test, and deploy code every time there is a code change.<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Go to CodePipeline service, click on \u201cCreate pipeline\u201d and name it accordingly.<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"921\" height=\"567\" class=\"wp-image-834\" src=\"http:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-6.png\" alt=\"\" srcset=\"https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-6.png 921w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-6-300x185.png 300w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-6-768x473.png 768w\" sizes=\"(max-width: 921px) 100vw, 921px\" \/><\/figure>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Select GitHub as the Source provider and authorize the application, specify the repository and the branch.<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"917\" height=\"800\" class=\"wp-image-835\" src=\"http:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-7.png\" alt=\"\" srcset=\"https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-7.png 917w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-7-300x262.png 300w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-7-768x670.png 768w\" sizes=\"(max-width: 917px) 100vw, 917px\" \/><\/figure>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>A sample PHP application, don\u2019t need to build the code. So skip the Build stage.<\/li>\r\n<li>In the next step, Select the deploy provider as Amazon Elastic Beanstalk. Select the Application Name and Environment Name accordingly.<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"912\" height=\"615\" class=\"wp-image-836\" src=\"http:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-8.png\" alt=\"\" srcset=\"https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-8.png 912w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-8-300x202.png 300w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-8-768x518.png 768w\" sizes=\"(max-width: 912px) 100vw, 912px\" \/><\/figure>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">To make sure the pipeline is running successfully, monitor the progress of the pipeline as it moves through each stage. The status of each stage will change from \u201cIn Progress\u201d to either \u201cSucceeded\u201d or \u201cFailed\u201d.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"389\" class=\"wp-image-837\" src=\"http:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-9-1024x389.png\" alt=\"\" srcset=\"https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-9-1024x389.png 1024w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-9-300x114.png 300w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-9-768x292.png 768w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-9-1536x584.png 1536w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-9.png 1630w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Access the Beanstalk endpoint and can see the updated code.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"209\" class=\"wp-image-838\" src=\"http:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-10-1024x209.png\" alt=\"\" srcset=\"https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-10-1024x209.png 1024w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-10-300x61.png 300w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-10-768x157.png 768w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-10-1536x314.png 1536w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-10.png 1600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><strong>Step 4: Commit the changes and automate deployments to your EB environment<\/strong><\/h3>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Revise the code and commit the changes to the repository. CodePipeline will detect updated sample code and then automatically initiate deploying it to the EC2 instance via Elastic Beanstalk.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Let\u2019s update the index.html page, commit changes and after some time the pipeline is being updated. It will automatically pull the updated code and will start reflecting the changes.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"457\" class=\"wp-image-839\" src=\"http:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-11-1024x457.png\" alt=\"\" srcset=\"https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-11-1024x457.png 1024w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-11-300x134.png 300w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-11-768x342.png 768w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-11-1536x685.png 1536w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-11.png 1579w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"201\" class=\"wp-image-840\" src=\"http:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-12-1024x201.png\" alt=\"\" srcset=\"https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-12-1024x201.png 1024w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-12-300x59.png 300w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-12-768x151.png 768w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-12-1536x301.png 1536w, https:\/\/cloudaliv.com\/stage\/wp-content\/uploads\/2022\/03\/php-12.png 1918w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">And that\u2019s all! Deployed a sample PHP application to AWS Elastic Beanstalk using AWS CodePipeline.<\/p>\r\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>AWS Elastic Beanstalk Elastic Beanstalk can be used to deploy and manage applications within the AWS Cloud without having knowledge about the infrastructure that executes those applications. Elastic Beanstalk supports applications developed in java, Go, PHP, NodeJS, Python and Ruby. Elastic Beanstalk reduces management complexity and handles capability provisioning, load balancing, scaling and application health. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":828,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[12,14],"tags":[19,20],"class_list":["post-827","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aws","category-devops","tag-aws","tag-devops"],"acf":[],"_links":{"self":[{"href":"https:\/\/cloudaliv.com\/stage\/wp-json\/wp\/v2\/posts\/827","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudaliv.com\/stage\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudaliv.com\/stage\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudaliv.com\/stage\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudaliv.com\/stage\/wp-json\/wp\/v2\/comments?post=827"}],"version-history":[{"count":6,"href":"https:\/\/cloudaliv.com\/stage\/wp-json\/wp\/v2\/posts\/827\/revisions"}],"predecessor-version":[{"id":4202,"href":"https:\/\/cloudaliv.com\/stage\/wp-json\/wp\/v2\/posts\/827\/revisions\/4202"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudaliv.com\/stage\/wp-json\/wp\/v2\/media\/828"}],"wp:attachment":[{"href":"https:\/\/cloudaliv.com\/stage\/wp-json\/wp\/v2\/media?parent=827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudaliv.com\/stage\/wp-json\/wp\/v2\/categories?post=827"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudaliv.com\/stage\/wp-json\/wp\/v2\/tags?post=827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}