{"id":37425,"date":"2017-11-23T11:20:53","date_gmt":"2017-11-23T11:20:53","guid":{"rendered":"https:\/\/www.whizlabs.com\/?p=37425"},"modified":"2024-05-08T10:10:20","modified_gmt":"2024-05-08T04:40:20","slug":"working-with-code-pipeline","status":"publish","type":"post","link":"https:\/\/www.whizlabs.com\/blog\/working-with-code-pipeline\/","title":{"rendered":"Working with Code Pipeline"},"content":{"rendered":"<h2 style=\"text-align: justify;\"><b>Exam Objective<\/b><\/h2>\n<p style=\"text-align: justify;\">The topic &#8220;Working with Code Pipeline&#8221; addresses the Continuous Delivery and Process Automation topic as highlighted in the AWS Blueprint for the exam guide.<\/p>\n<p><em>Check out the AWS Certified DevOps Engineer Professional\u00a0Free and Practice Tests <a href=\"https:\/\/www.whizlabs.com\/aws-devops-certification-training\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/em><\/p>\n<p style=\"text-align: justify;\">The AWS Code Pipeline services allow one to build a continuous integration and continuous delivery pipeline. This is an important service especially for those organizations that are looking towards implementing DevOps in their organizations. The AWS Code Pipeline service also has built-in integration with popular continuous integration tools such as Jenkins. The Code Pipeline tool can be used to pull out code from famous source code configuration management tools such as Git.<\/p>\n<p>&nbsp;<\/p>\n<h2 style=\"text-align: justify;\"><b>How does Code Pipeline work?<\/b><\/h2>\n<p style=\"text-align: justify;\">The below diagram from the AWS documentation shows the structure of a pipeline.<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"alignnone wp-image-37427 size-full\" src=\"https:\/\/www.whizlabs.com\/wp-content\/uploads\/2017\/09\/AWSDevOPS_wwcp_1.png\" alt=\"Pipeline\" width=\"283\" height=\"466\" \/><\/p>\n<p style=\"text-align: justify;\">1) <strong>Stages<\/strong> &#8211; The pipeline consists of multiple stages. In your organization, you can have multiple stages such as staging and production.<\/p>\n<p style=\"text-align: justify;\">2) <strong>Action<\/strong> &#8211; Each stage consists of a series of actions which specify what must be done on the artifact. Each stage can only perform one revision of the source code at a time. All of the artifacts are stored in an S3 bucket. For example, the code which needs to be built will be copied to the S3 bucket for the pipeline. This becomes the input artifact.<\/p>\n<p style=\"text-align: justify;\">3) <strong>Transition<\/strong> &#8211; A transition is an action which is performed when one stage is moved to the next in the pipeline. An approval action can also put in place so that if a manual approval is required before it goes to the next stage.<\/p>\n<p style=\"text-align: justify;\"><strong>The below diagram from the AWS documentation shows an example of a pipeline. In the below diagram we have<\/strong><\/p>\n<p style=\"text-align: justify;\">1) <strong>Source Stage<\/strong> \u2013 This is where the code is going to come from. In this diagram, it shows that the code is coming from CodeCommit. The code can also come from Git.<\/p>\n<p style=\"text-align: justify;\">2) <strong>Build Stage<\/strong> &#8211; In this stage, the code can be built into a binary.<\/p>\n<p style=\"text-align: justify;\">3) <strong>Integration Stage<\/strong> &#8211; There is a separate stage that performs an Integration test.<\/p>\n<p style=\"text-align: justify;\">4) <strong>Production Stage<\/strong> &#8211; This stage moves the code to production. Here the code is being deployed using the CodeDeploy AWS service.<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"alignnone wp-image-37428 size-full\" src=\"https:\/\/www.whizlabs.com\/wp-content\/uploads\/2017\/09\/AWSDevOPS_wwcp_2.png\" alt=\"Example Pipeline\" width=\"177\" height=\"404\" \/><\/p>\n<h4 style=\"text-align: justify;\"><b>Getting started with Code Pipeline<\/b><\/h4>\n<p style=\"text-align: justify;\">Now let\u2019s look at how we can start working with CodePipeline. The following example will create 2 stages, one which downloads the code from a Github repository. And the next stage is used to deploy the code using the AWS CodeDeploy service. Please refer to the article on CodeDeploy on how to create a Code Deploy service.<\/p>\n<p style=\"text-align: justify;\">Since we are using a code deploy service, we have to ensure that we have the appspec.yml file in our Github repository as shown below.<\/p>\n<p style=\"text-align: justify;\">You can use any public GitHub repository. The below snapshot shows a github repository which has the appspec.yml file and a sample HTML file which will be get deployed to the EC2 Instances.<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"alignnone wp-image-37429 size-full\" src=\"https:\/\/www.whizlabs.com\/wp-content\/uploads\/2017\/09\/AWSDevOPS_wwcp_3.png\" alt=\"Getting Started\" width=\"154\" height=\"62\" \/><\/p>\n<p style=\"text-align: justify;\">So let\u2019s now perform the following steps to get the Code Pipeline structure in place<\/p>\n<p style=\"text-align: justify;\"><strong>Step 1)<\/strong> Go to Developer Tools and choose CodePipeline<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"alignnone wp-image-37430 size-full\" src=\"https:\/\/www.whizlabs.com\/wp-content\/uploads\/2017\/09\/AWSDevOPS_wwcp_4.png\" alt=\"Code Pipeline\" width=\"204\" height=\"192\" \/><\/p>\n<p style=\"text-align: justify;\">Then choose to create a new Pipeline<\/p>\n<p style=\"text-align: justify;\"><strong>Step 2)<\/strong> Give a name for the pipeline. In the below example, we are giving a name of DemoPipeline. Then click on the Next step<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"alignnone wp-image-37431 size-full\" src=\"https:\/\/www.whizlabs.com\/wp-content\/uploads\/2017\/09\/AWSDevOPS_wwcp_5.png\" alt=\"AWS Code Pipeline\" width=\"1064\" height=\"345\" \/><\/p>\n<p style=\"text-align: justify;\"><strong>Step 3)<\/strong> Next you need to provide a source provider. We can choose Github for our example.<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"alignnone wp-image-37432 size-full\" src=\"https:\/\/www.whizlabs.com\/wp-content\/uploads\/2017\/09\/AWSDevOPS_wwcp_6.png\" alt=\"Source Provider\" width=\"1065\" height=\"340\" \/><\/p>\n<p style=\"text-align: justify;\"><strong>Step 4)<\/strong> Next you will be requested to connect to Github. Here you can also mention running the pipeline when any changes to the source content are detected.<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"alignnone wp-image-37433 size-full\" src=\"https:\/\/www.whizlabs.com\/wp-content\/uploads\/2017\/09\/AWSDevOPS_wwcp_7.png\" alt=\"Pipeline Execution\" width=\"740\" height=\"401\" \/><\/p>\n<p style=\"text-align: justify;\"><strong>Step 5)<\/strong> Next you have to choose the repository and the branch from Github from where the code needs to be downloaded.<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"alignnone wp-image-37434 size-full\" src=\"https:\/\/www.whizlabs.com\/wp-content\/uploads\/2017\/09\/AWSDevOPS_wwcp_8.png\" alt=\"GitHub\" width=\"687\" height=\"249\" \/><\/p>\n<p style=\"text-align: justify;\"><strong>Step 6)<\/strong> Next you need to choose if you need to have a build server in place. For the current demo, let\u2019s leave it as no Build.<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"alignnone wp-image-37435 size-full\" src=\"https:\/\/www.whizlabs.com\/wp-content\/uploads\/2017\/09\/AWSDevOPS_wwcp_9.png\" alt=\"Create Pipeline\" width=\"1080\" height=\"314\" \/><\/p>\n<p style=\"text-align: justify;\"><strong>Step 7)<\/strong> Next you need to choose a deployment provider. Here we can choose AWS Code Deploy as an example.<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"alignnone wp-image-37436 size-full\" src=\"https:\/\/www.whizlabs.com\/wp-content\/uploads\/2017\/09\/AWSDevOPS_wwcp_10.png\" alt=\"Deployment Provider\" width=\"1103\" height=\"337\" \/><\/p>\n<p style=\"text-align: justify;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 You can choose the relevant Code Deployment configuration<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"alignnone wp-image-37437 size-full\" src=\"https:\/\/www.whizlabs.com\/wp-content\/uploads\/2017\/09\/AWSDevOPS_wwcp_11.png\" alt=\"AWS Code Deploy\" width=\"727\" height=\"502\" \/><\/p>\n<p style=\"text-align: justify;\"><strong>Step 8)<\/strong> Finally you can create a role. This will allow CodePipeline to create work with the resources in your AWS account. You can click on Create role to create a new role.<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"alignnone wp-image-37438 size-full\" src=\"https:\/\/www.whizlabs.com\/wp-content\/uploads\/2017\/09\/AWSDevOPS_wwcp_12.png\" alt=\"Create Pipeline\" width=\"1065\" height=\"388\" \/><\/p>\n<p style=\"text-align: justify;\"><strong>Step 9)<\/strong> Once the Role is created, choose the Role and click on the next step<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"alignnone wp-image-37439 size-full\" src=\"https:\/\/www.whizlabs.com\/wp-content\/uploads\/2017\/09\/AWSDevOPS_wwcp_13.png\" alt=\"AWS\" width=\"1062\" height=\"364\" \/><\/p>\n<p style=\"text-align: justify;\"><strong>Step 10)<\/strong> Finally you can do a review and create your pipeline<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"alignnone wp-image-37440 size-full\" src=\"https:\/\/www.whizlabs.com\/wp-content\/uploads\/2017\/09\/AWSDevOPS_wwcp_14.png\" alt=\"Pipeline Settings\" width=\"747\" height=\"397\" \/><\/p>\n<p style=\"text-align: justify;\"><strong>Step 11)<\/strong> Immediately a deployment will kick off. So the first stage will start downloading the files from Github.<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"alignnone wp-image-37441 size-full\" src=\"https:\/\/www.whizlabs.com\/wp-content\/uploads\/2017\/09\/AWSDevOPS_wwcp_15.png\" alt=\"GitHub\" width=\"259\" height=\"442\" \/><\/p>\n<p style=\"text-align: justify;\"><strong>Step 12)<\/strong> Once the deployment is complete, you will get be able to see the progress of the Pipeline.<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"alignnone wp-image-37442 size-full\" src=\"https:\/\/www.whizlabs.com\/wp-content\/uploads\/2017\/09\/AWSDevOPS_wwcp_16.png\" alt=\"GitHub\" width=\"267\" height=\"487\" \/><\/p>\n<p style=\"text-align: justify;\"><strong>Step 13)<\/strong> Whenever you make a change to the Github repository, the pipeline will again be triggered. Here it will download the latest code from the mentioned branch.<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"alignnone wp-image-37426 size-full\" src=\"https:\/\/www.whizlabs.com\/wp-content\/uploads\/2017\/09\/AWSDevOPS_wwcp_17.png\" alt=\"code pipeline \" width=\"411\" height=\"304\" \/><\/p>\n<p style=\"text-align: justify;\">If you want you can force a change by clicking on the Release Change button.<\/p>\n<p style=\"text-align: justify;\">The Edit button allows you to edit the Pipeline.<\/p>\n<h2 style=\"text-align: justify;\"><b>Additional Points to Remember<\/b><\/h2>\n<p style=\"text-align: justify;\">1) The AWS Code Pipeline services allows one to build a continuous integration and continuous delivery pipeline<\/p>\n<p style=\"text-align: justify;\">2) The Code Pipeline consists of the following parts<\/p>\n<ul style=\"text-align: justify;\">\n<li>Stages &#8211; In your organization, you can have multiple stages such as staging and production.<\/li>\n<li>Action &#8211; Each stage consists of a series of actions which specify what must be done on the artifact<\/li>\n<li>Transition &#8211; A transition is an action which is performed when one stage is moved to the next in the pipeline<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">3) Whenever a change is made to the source code configuration repository, the code pipeline flow is triggered.<\/p>\n<p><em>Preparing for AWS Certification? Pass in First Attempt with Whizlabs <a href=\"https:\/\/www.whizlabs.com\/aws-certifications\/\" target=\"_blank\" rel=\"noopener noreferrer\">AWS Certification Training Courses<\/a>!<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Exam Objective The topic &#8220;Working with Code Pipeline&#8221; addresses the Continuous Delivery and Process Automation topic as highlighted in the AWS Blueprint for the exam guide. Check out the AWS Certified DevOps Engineer Professional\u00a0Free and Practice Tests here. The AWS Code Pipeline services allow one to build a continuous integration and continuous delivery pipeline. This is an important service especially for those organizations that are looking towards implementing DevOps in their organizations. The AWS Code Pipeline service also has built-in integration with popular continuous integration tools such as Jenkins. The Code Pipeline tool can be used to pull out code [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":44715,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[4],"tags":[184,222,250,274,515,745,780],"class_list":["post-37425","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aws-certifications","tag-aws","tag-aws-certified-devops-engineer-professional","tag-aws-code-pipeline","tag-aws-documentation","tag-blueprint","tag-exam-objective","tag-github"],"uagb_featured_image_src":{"full":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/109.jpg",560,315,false],"thumbnail":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/109-150x150.jpg",150,150,true],"medium":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/109-300x169.jpg",300,169,true],"medium_large":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/109.jpg",560,315,false],"large":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/109.jpg",560,315,false],"1536x1536":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/109.jpg",560,315,false],"2048x2048":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/109.jpg",560,315,false],"profile_24":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/109.jpg",24,14,false],"profile_48":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/109.jpg",48,27,false],"profile_96":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/109.jpg",96,54,false],"profile_150":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/109.jpg",150,84,false],"profile_300":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/109.jpg",300,169,false],"tptn_thumbnail":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/109-250x250.jpg",250,250,true],"web-stories-poster-portrait":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/109.jpg",560,315,false],"web-stories-publisher-logo":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/109.jpg",96,54,false],"web-stories-thumbnail":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/109.jpg",150,84,false]},"uagb_author_info":{"display_name":"Pavan Gumaste","author_link":"https:\/\/www.whizlabs.com\/blog\/author\/pavan\/"},"uagb_comment_info":0,"uagb_excerpt":"Exam Objective The topic &#8220;Working with Code Pipeline&#8221; addresses the Continuous Delivery and Process Automation topic as highlighted in the AWS Blueprint for the exam guide. Check out the AWS Certified DevOps Engineer Professional\u00a0Free and Practice Tests here. The AWS Code Pipeline services allow one to build a continuous integration and continuous delivery pipeline. This&hellip;","_links":{"self":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts\/37425","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/comments?post=37425"}],"version-history":[{"count":2,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts\/37425\/revisions"}],"predecessor-version":[{"id":95423,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts\/37425\/revisions\/95423"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/media\/44715"}],"wp:attachment":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/media?parent=37425"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/categories?post=37425"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/tags?post=37425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}