{"id":4011,"date":"2021-02-13T15:56:51","date_gmt":"2021-02-13T14:56:51","guid":{"rendered":"http:\/\/miro.borodziuk.eu\/?p=4011"},"modified":"2021-05-25T15:24:24","modified_gmt":"2021-05-25T13:24:24","slug":"codepipeline","status":"publish","type":"post","link":"http:\/\/miro.borodziuk.eu\/index.php\/2021\/02\/13\/codepipeline\/","title":{"rendered":"CodePipeline"},"content":{"rendered":"<p><!--more--><\/p>\n<ul>\n<li>Continuous delivery<\/li>\n<li>Visual workflow<\/li>\n<li>Source: GitHub \/ CodeCommit \/ Amazon S3<\/li>\n<li>Build: CodeBuild \/ Jenkins \/ etc &#8230;<\/li>\n<li>Load Testing: 3 rd party tools<\/li>\n<li>Deploy: AWS CodeDeploy \/ Beanstalk \/ CloudFormation \/ ECS &#8230;<\/li>\n<li>Made of stages:\n<ul>\n<li>Each stage can have sequential actions and \/ or parallel actions<\/li>\n<li>Stages examples: Build \/Test \/ Deploy \/ Load Test \/ etc &#8230;<\/li>\n<li>Manual approval can be defined at any stage<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4026 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline02.jpg\" alt=\"\" width=\"1745\" height=\"931\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline02.jpg 1745w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline02-300x160.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline02-1024x546.jpg 1024w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline02-768x410.jpg 768w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline02-1536x819.jpg 1536w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>AWS CodePipeline Artifacts<\/p>\n<ul>\n<li>Each pipeline stage can create &#8220;artifacts&#8221;<\/li>\n<li>Artifacts are passed stored in Amazon S3 and passed on to the next stage<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-4029 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline05.jpg\" alt=\"\" width=\"1702\" height=\"512\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline05.jpg 1702w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline05-300x90.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline05-1024x308.jpg 1024w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline05-768x231.jpg 768w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline05-1536x462.jpg 1536w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>We have code in CodeCommit. W are able to deploy this code using CodeDeploy but first we need to package as an archive the code in S3 in order for the deployment to work. We want to automate the transition from CodeCommit into CodeDeploy. Let&#8217;s start with the first pipeline:<\/p>\n<p><code>Developer Tools -&gt; CodePipeline -&gt; Pipelines -&gt; Create new pipeline<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4032 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline06.jpg\" alt=\"\" width=\"715\" height=\"769\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline06.jpg 715w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline06-279x300.jpg 279w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><\/p>\n<p>From advanced settings it is better to choose &#8220;Custom location&#8221; because if we choose &#8220;Default location&#8221; everytime we will use new bucket for every pipeline and we will reach the limit of buckets in our account.<\/p>\n<p><code>Next -&gt;<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4035 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline07.jpg\" alt=\"\" width=\"726\" height=\"663\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline07.jpg 726w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline07-300x274.jpg 300w\" sizes=\"(max-width: 726px) 100vw, 726px\" \/><\/p>\n<p><code>Next -&gt; Skip build stage<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4039 alignright\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline08.jpg\" alt=\"\" width=\"731\" height=\"604\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline08.jpg 731w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline08-300x248.jpg 300w\" sizes=\"(max-width: 731px) 100vw, 731px\" \/><code>Next -&gt; Create pipeline -&gt;<\/code><\/p>\n<p>Now if we change the content of any file in my-webpage in CodeCommit repository<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4045 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline10.jpg\" alt=\"\" width=\"979\" height=\"741\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline10.jpg 979w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline10-300x227.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline10-768x581.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>then CodePipeline will start deploying new version of application.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4042\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline09.jpg\" alt=\"\" width=\"548\" height=\"760\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline09.jpg 548w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline09-216x300.jpg 216w\" sizes=\"(max-width: 548px) 100vw, 548px\" \/><\/p>\n<p>After deployment finishes we will see the new version of an application:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4046 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline11.jpg\" alt=\"\" width=\"1246\" height=\"217\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline11.jpg 1246w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline11-300x52.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline11-1024x178.jpg 1024w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline11-768x134.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #3366ff;\">Adding CodeBuild Stage.<\/span><\/p>\n<p><code>Developer Tools -&gt; CodePipeline -&gt; Pipelines -&gt; CodePipelineDemo -&gt; Edit CodePipelineDemo -&gt; Add stage<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4048\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline12.jpg\" alt=\"\" width=\"603\" height=\"239\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline12.jpg 603w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline12-300x119.jpg 300w\" sizes=\"(max-width: 603px) 100vw, 603px\" \/><\/p>\n<p><code>Add action group -&gt;<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4050 size-full aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline14.jpg\" alt=\"\" width=\"769\" height=\"899\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline14.jpg 769w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline14-257x300.jpg 257w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p><code>Done -&gt; Save -&gt; Save<\/code><\/p>\n<p>Now we can ruun new pipeline by clicking on &#8220;Release change&#8221;.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4053 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline15.jpg\" alt=\"\" width=\"498\" height=\"833\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline15.jpg 498w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline15-179x300.jpg 179w\" sizes=\"(max-width: 498px) 100vw, 498px\" \/><\/p>\n<p>But we have an error:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4054 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline16.jpg\" alt=\"\" width=\"1089\" height=\"791\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline16.jpg 1089w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline16-300x218.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline16-1024x744.jpg 1024w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline16-768x558.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>We have a problem on access to the s3 bucket so let&#8217;s modify the<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4056 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline17.jpg\" alt=\"\" width=\"857\" height=\"799\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline17.jpg 857w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline17-300x280.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline17-768x716.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p><code>Review policy -&gt; save changes<\/code><\/p>\n<p>Now we can test the pipeline again by clicking on <code>\"Release change\"<\/code>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4059 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline18.jpg\" alt=\"\" width=\"371\" height=\"848\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline18.jpg 371w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline18-131x300.jpg 131w\" sizes=\"(max-width: 371px) 100vw, 371px\" \/><\/p>\n<p>This time everything is ok.<\/p>\n<p>Now in the repository let&#8217;s change the index.html:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4062 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline19.jpg\" alt=\"\" width=\"667\" height=\"637\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline19.jpg 667w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline19-300x287.jpg 300w\" sizes=\"(max-width: 667px) 100vw, 667px\" \/><\/p>\n<p>Because <code>buildspec.yml<\/code> test if <code>index.html<\/code> consist &#8220;Congratulations&#8221; word the test failed:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4063 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline20.jpg\" alt=\"\" width=\"981\" height=\"679\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline20.jpg 981w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline20-300x208.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline20-768x532.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4064 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline21.jpg\" alt=\"\" width=\"617\" height=\"711\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline21.jpg 617w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline21-260x300.jpg 260w\" sizes=\"(max-width: 617px) 100vw, 617px\" \/><\/p>\n<p>If we want to have artifacts in additional s3 bucket we must edit the pipline:<\/p>\n<p><code>Developer Tools -&gt; CodePipeline -&gt; Pipelines -&gt; CodePipelineDemo -&gt; Edit CodePipelineDemo -&gt; Edit deploy -&gt; Edit stage -&gt; Add action<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4067 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline22.jpg\" alt=\"\" width=\"789\" height=\"900\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline22.jpg 789w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline22-263x300.jpg 263w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline22-768x876.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><code>Done -&gt;<\/code><\/p>\n<p>Now we have added parallel stage to our pipeline:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4069 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline23.jpg\" alt=\"\" width=\"666\" height=\"838\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline23.jpg 666w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline23-238x300.jpg 238w\" sizes=\"(max-width: 666px) 100vw, 666px\" \/><\/p>\n<p><code>Save -&gt; Save -&gt;<\/code><\/p>\n<p>Let&#8217;s change the<code> index.html<\/code> once again:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4072 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline24.jpg\" alt=\"\" width=\"657\" height=\"624\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline24.jpg 657w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline24-300x285.jpg 300w\" sizes=\"(max-width: 657px) 100vw, 657px\" \/><\/p>\n<p>After pipeline finish the work on the additional s3bucket we will see folder with artifacts:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4073 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline25.jpg\" alt=\"\" width=\"776\" height=\"526\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline25.jpg 776w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline25-300x203.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline25-768x521.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #3366ff;\">Manual Approval Steps<\/span><\/p>\n<p>We can add additional stage and deploy to production.<\/p>\n<p><code>Developer Tools -&gt; CodePipeline -&gt; Pipelines -&gt; CodePipelineDemo -&gt; Edit CodePipelineDemo -&gt; Add Stage<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4076 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline26.jpg\" alt=\"\" width=\"604\" height=\"235\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline26.jpg 604w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline26-300x117.jpg 300w\" sizes=\"(max-width: 604px) 100vw, 604px\" \/><\/p>\n<p><code>Add action group -&gt;<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4077 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline27.jpg\" alt=\"\" width=\"758\" height=\"816\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline27.jpg 758w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline27-279x300.jpg 279w\" sizes=\"(max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/p>\n<p><code>Done -&gt;<\/code><\/p>\n<p>If we want ManualApproval step before deployment to production we should click on the &#8220;Add action group&#8221; button:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4080 size-full aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline28-1.jpg\" alt=\"\" width=\"644\" height=\"304\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline28-1.jpg 644w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline28-1-300x142.jpg 300w\" sizes=\"(max-width: 644px) 100vw, 644px\" \/><\/p>\n<p>And then\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4082 size-full aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline30.jpg\" alt=\"\" width=\"605\" height=\"736\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline30.jpg 605w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline30-247x300.jpg 247w\" sizes=\"(max-width: 605px) 100vw, 605px\" \/><\/p>\n<p>In the &#8220;URL for review&#8221; you can put URL of the application to approve. If the site is good you will approve the deployment.<\/p>\n<p><code>Done -&gt; <\/code><\/p>\n<p>Now, the last stage looks like:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4083 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline31.jpg\" alt=\"\" width=\"600\" height=\"468\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline31.jpg 600w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline31-300x234.jpg 300w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><code>Save -&gt; Save<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4084 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline32.jpg\" alt=\"\" width=\"523\" height=\"470\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline32.jpg 523w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline32-300x270.jpg 300w\" sizes=\"(max-width: 523px) 100vw, 523px\" \/><\/p>\n<p>Now we can test our new pipeline by clicking <code>\"Release change\"<\/code> and<code> \"Release\"<\/code>.<\/p>\n<p>In the DeployToProd stage we are waiting for manual approval before instances are deploy to production:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4087 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline33.jpg\" alt=\"\" width=\"535\" height=\"465\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline33.jpg 535w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline33-300x261.jpg 300w\" sizes=\"(max-width: 535px) 100vw, 535px\" \/><\/p>\n<p>When wwe click on the Review button we can see URL with the new version ofthe application and approve it.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4088 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline35.jpg\" alt=\"\" width=\"583\" height=\"425\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline35.jpg 583w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline35-300x219.jpg 300w\" sizes=\"(max-width: 583px) 100vw, 583px\" \/><\/p>\n<p><code>Approve -&gt;<\/code><\/p>\n<p>After the deployment will be approved the deployment should happend.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4090 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline36.jpg\" alt=\"\" width=\"538\" height=\"449\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline36.jpg 538w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline36-300x250.jpg 300w\" sizes=\"(max-width: 538px) 100vw, 538px\" \/><\/p>\n<p>Let&#8217;s test our pipeline with manual approval. First we change the <code>index.html<\/code>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4094 size-full aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline38.jpg\" alt=\"\" width=\"627\" height=\"691\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline38.jpg 627w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline38-272x300.jpg 272w\" sizes=\"(max-width: 627px) 100vw, 627px\" \/><\/p>\n<p>After we change the index.html file the pipeline starts automaticaly.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4095 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline40.jpg\" alt=\"\" width=\"708\" height=\"712\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline40.jpg 708w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline40-298x300.jpg 298w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline40-150x150.jpg 150w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline40-100x100.jpg 100w\" sizes=\"(max-width: 708px) 100vw, 708px\" \/><\/p>\n<p>After we Approve the changes we can see such an appllication:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4096 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline39.jpg\" alt=\"\" width=\"1248\" height=\"232\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline39.jpg 1248w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline39-300x56.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline39-1024x190.jpg 1024w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline39-768x143.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #3366ff;\">CloudWatch Events Integration<\/span><\/p>\n<p>We can invoke CodePipieline in the schedule. For example we can invoke pipeline one time a day:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4098 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline41.jpg\" alt=\"\" width=\"732\" height=\"732\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline41.jpg 732w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline41-300x300.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline41-150x150.jpg 150w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline41-100x100.jpg 100w\" sizes=\"(max-width: 732px) 100vw, 732px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>If in the pipeline is failure we can invoke Lambda function e.g. to inform the slack channel.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4100 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline42.jpg\" alt=\"\" width=\"769\" height=\"748\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline42.jpg 769w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline42-300x292.jpg 300w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #3366ff;\">Custom Action Jobs with AWS Lambda<\/span><\/p>\n<p>We have to create a lambda funcion.<\/p>\n<p><code>Lambda -&gt; Functions -&gt; Create function<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4103 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline43.jpg\" alt=\"\" width=\"647\" height=\"686\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline43.jpg 647w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline43-283x300.jpg 283w\" sizes=\"(max-width: 647px) 100vw, 647px\" \/><\/p>\n<p><code>Create function -&gt;<\/code><\/p>\n<p>After we create our lambda function we need to edit newly created role.<\/p>\n<p><code>IAM -&gt; Roles<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4104 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline44.jpg\" alt=\"\" width=\"597\" height=\"406\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline44.jpg 597w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline44-300x204.jpg 300w\" sizes=\"(max-width: 597px) 100vw, 597px\" \/><\/p>\n<p><code>Roles -&gt; LambdaCodepipeline-role-n7veufq7 -&gt; Add inline policy -&gt; JSON<\/code><\/p>\n<p>Copy from references link (3) code:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4106 size-full aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline45.jpg\" alt=\"\" width=\"613\" height=\"496\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline45.jpg 613w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline45-300x243.jpg 300w\" sizes=\"(max-width: 613px) 100vw, 613px\" \/><\/p>\n<p><code>Review policy -&gt;<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4108 size-full aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline47.jpg\" alt=\"\" width=\"843\" height=\"539\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline47.jpg 843w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline47-300x192.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline47-768x491.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/> <code>Create policy -&gt;<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4109\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline48.jpg\" alt=\"\" width=\"824\" height=\"622\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline48.jpg 824w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline48-300x226.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline48-768x580.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>Back to the lambda function and we have to edit the code. Copy the code from references link 3 and save.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4111 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline49.jpg\" alt=\"\" width=\"840\" height=\"650\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline49.jpg 840w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline49-300x232.jpg 300w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline49-768x594.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>Now, we must edit our pipeline.<\/p>\n<p><code>Developer Tools -&gt; CodePipeline -&gt; Pipelines -&gt; CodePipelineDemo -&gt; Edit CodePipelineDemo -&gt; Edit Deploy -&gt; Add stage -&gt;\u00a0<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4113 aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline50.jpg\" alt=\"\" width=\"578\" height=\"220\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline50.jpg 578w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline50-300x114.jpg 300w\" sizes=\"(max-width: 578px) 100vw, 578px\" \/><\/p>\n<p><code>Add stage<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4116 size-full aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline51.jpg\" alt=\"\" width=\"631\" height=\"607\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline51.jpg 631w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline51-300x289.jpg 300w\" sizes=\"(max-width: 631px) 100vw, 631px\" \/><\/p>\n<p><code>Add action group -&gt;<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4117 size-full aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline52.jpg\" alt=\"\" width=\"772\" height=\"842\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline52.jpg 772w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline52-275x300.jpg 275w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline52-768x838.jpg 768w\" sizes=\"(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p><code>Done -&gt;<\/code><\/p>\n<p>Now we add paralel action<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4119 size-full aligncenter\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline54.jpg\" alt=\"\" width=\"681\" height=\"831\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline54.jpg 681w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline54-246x300.jpg 246w\" sizes=\"(max-width: 681px) 100vw, 681px\" \/><\/p>\n<p>Done -&gt;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4121\" src=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline55.jpg\" alt=\"\" width=\"626\" height=\"718\" srcset=\"http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline55.jpg 626w, http:\/\/miro.borodziuk.eu\/wp-content\/uploads\/CodePipeline55-262x300.jpg 262w\" sizes=\"(max-width: 626px) 100vw, 626px\" \/><\/p>\n<p><code>Done-&gt; Save -&gt; Release change -&gt; Release<\/code><\/p>\n<p>The pipeline has run and we see thad first test has succesed and the second test has failed because on the google.com site the wasn&#8217;t &#8220;congratulations&#8221; word.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>References<br \/>\n<\/strong><\/p>\n<ol>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/codepipeline\/latest\/userguide\/reference-pipeline-structure.html#action-requirements\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/codepipeline\/latest\/userguide\/reference-pipeline-structure.html#action-requirements<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/codepipeline\/latest\/userguide\/best-practices.html#use-cases\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/codepipeline\/latest\/userguide\/best-practices.html#use-cases<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/codepipeline\/latest\/userguide\/actions-invoke-lambda-function.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/codepipeline\/latest\/userguide\/actions-invoke-lambda-function.html<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/codepipeline\/latest\/userguide\/actions-create-custom-action.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/codepipeline\/latest\/userguide\/actions-create-custom-action.html<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/codepipeline\/latest\/APIReference\/API_PutJobSuccessResult.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/codepipeline\/latest\/APIReference\/API_PutJobSuccessResult.html<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/continuous-delivery-codepipeline.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/continuous-delivery-codepipeline.html<\/a><\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/codepipeline\/latest\/userguide\/tutorials-cloudformation.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.aws.amazon.com\/codepipeline\/latest\/userguide\/tutorials-cloudformation.html<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/aws-samples\/codepipeline-nested-cfn\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/aws-samples\/codepipeline-nested-cfn<\/a><\/li>\n<li><a href=\"https:\/\/aws.amazon.com\/blogs\/devops\/implementing-gitflow-using-aws-codepipeline-aws-codecommit-aws-codebuild-and-aws-codedeploy\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/aws.amazon.com\/blogs\/devops\/implementing-gitflow-using-aws-codepipeline-aws-codecommit-aws-codebuild-and-aws-codedeploy\/<\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":4012,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[88],"tags":[],"_links":{"self":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts\/4011"}],"collection":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/comments?post=4011"}],"version-history":[{"count":45,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts\/4011\/revisions"}],"predecessor-version":[{"id":4124,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts\/4011\/revisions\/4124"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/media\/4012"}],"wp:attachment":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/media?parent=4011"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/categories?post=4011"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/tags?post=4011"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}