1 00:00:00,420 --> 00:00:05,790 ‫Okay, so now let's talk about Codepipeline, which is a visual workflow tool that will allow you to 2 00:00:05,790 --> 00:00:12,480 ‫orchestrate your CICD within AWS so you can show sources such as, Hey, my code is in Codecommit or 3 00:00:12,480 --> 00:00:17,610 ‫we have a Docker image in ECR or my code is in Amazon, S3 or even external tools such as Bitbucket 4 00:00:17,610 --> 00:00:18,180 ‫or GitHub. 5 00:00:18,480 --> 00:00:23,250 ‫Then you can move on to the build phase, which is, hey, now that we have this code, let's build 6 00:00:23,250 --> 00:00:23,370 ‫it. 7 00:00:23,370 --> 00:00:27,100 ‫So could build Jenkins, CloudBees Teamcity or all options. 8 00:00:27,120 --> 00:00:30,090 ‫Then once you have the build phase, you can have the test phase. 9 00:00:30,090 --> 00:00:31,500 ‫So again, testing your code. 10 00:00:31,500 --> 00:00:33,420 ‫So code build or device farm. 11 00:00:33,420 --> 00:00:37,680 ‫If you have an app, for example on iOS or Android app or any third party tools you want. 12 00:00:37,710 --> 00:00:40,110 ‫Then once the code is tested, you want to deploy it. 13 00:00:40,110 --> 00:00:46,860 ‫So code, deploy, Beanstalk, CloudFormation, S3 or all these options can be handled by codepipeline 14 00:00:46,860 --> 00:00:50,310 ‫and invoke to invoke a lambda function or a step function. 15 00:00:50,310 --> 00:00:53,760 ‫And then when you have all these building blocks, you can build stages. 16 00:00:53,760 --> 00:00:57,060 ‫So each stage can have sequential actions and or parallel actions. 17 00:00:57,060 --> 00:00:58,080 ‫So you can do a lot of things. 18 00:00:58,080 --> 00:00:59,610 ‫Here is a very simple example. 19 00:00:59,640 --> 00:01:05,590 ‫Build and test deploy onto staging, then load testing to make sure staging is doing fine. 20 00:01:05,590 --> 00:01:09,700 ‫And then once the load testing is done, maybe deploy again to production. 21 00:01:09,970 --> 00:01:16,840 ‫Now there's also a way for you to define manual approval at any stage in your pipeline, really allowing 22 00:01:16,840 --> 00:01:20,950 ‫you, for example, just before deploying to prod, to have someone review the results of the load testing, 23 00:01:20,950 --> 00:01:24,220 ‫for example, if it was there and make sure it says, yeah, it looks good. 24 00:01:24,220 --> 00:01:25,480 ‫Green light deploy to prod. 25 00:01:25,900 --> 00:01:30,790 ‫So Codepipeline really is here to orchestrate everything and it gives you a lot of flexibility thanks 26 00:01:30,790 --> 00:01:33,430 ‫to all the building blocks as we'll see in the next lectures. 27 00:01:33,610 --> 00:01:36,400 ‫Now how does Codepipeline work inside? 28 00:01:36,400 --> 00:01:39,580 ‫So let's assume we have a source, a build and deploy phase. 29 00:01:39,580 --> 00:01:42,370 ‫So sources code commit build is code build. 30 00:01:42,370 --> 00:01:46,690 ‫Even though we haven't seen code build yet and deploy is code deploy, even though we haven't seen code 31 00:01:46,690 --> 00:01:47,470 ‫deploy yet. 32 00:01:47,500 --> 00:01:49,930 ‫So each pipeline can create artifacts. 33 00:01:49,930 --> 00:01:55,200 ‫Artifacts are is whatever is created out of the pipeline and the artifacts are going to be stored in 34 00:01:55,240 --> 00:01:57,370 ‫S3 buckets to be passed on to the next stage. 35 00:01:57,370 --> 00:02:00,570 ‫And this is how the next stage is going to be able to do what it needs to do. 36 00:02:00,580 --> 00:02:02,760 ‫So let's do a concrete example. 37 00:02:02,770 --> 00:02:05,800 ‫The developer is going to push some code into code commits, right? 38 00:02:05,800 --> 00:02:10,750 ‫And then code commits is going to be orchestrated by code pipeline, which is going to extract all the 39 00:02:10,750 --> 00:02:15,580 ‫code and create an artifact out of it and place that artifact into an S3 bucket. 40 00:02:15,610 --> 00:02:21,910 ‫Now, when code build is invoked, the the same artifacts that were extracted are going to be inputted 41 00:02:21,940 --> 00:02:23,680 ‫directly into codebuild. 42 00:02:23,680 --> 00:02:27,790 ‫And that's why Codebuild doesn't need to have straight access into code commit. 43 00:02:28,180 --> 00:02:33,010 ‫Actually, it's code pipeline that will be pushing the code to codebuild through Amazon S3. 44 00:02:33,340 --> 00:02:37,690 ‫Then what Codebuild is being building the code is going to create some deployment artifacts. 45 00:02:37,690 --> 00:02:43,420 ‫So these artifacts are going to be stored yet again in your S3 bucket by Codepipeline and Codepipeline 46 00:02:43,420 --> 00:02:49,030 ‫will push these artifacts yet again to code, deploy and code Deploy says, Hey, I have these artifacts. 47 00:02:49,030 --> 00:02:51,250 ‫I need to deploy them, let's go ahead and deploy them. 48 00:02:51,250 --> 00:02:55,750 ‫So as you can see, these stages interact with each other through Amazon. 49 00:02:55,750 --> 00:02:59,530 ‫S3 And this is why we have artifacts in code pipeline. 50 00:02:59,650 --> 00:03:01,510 ‫Now some troubleshooting for Codepipeline. 51 00:03:01,510 --> 00:03:07,420 ‫So if you need to have a look at all these things, for example, you need to look at like code pipeline 52 00:03:07,420 --> 00:03:09,610 ‫action or stage execution state changes. 53 00:03:09,610 --> 00:03:12,490 ‫You can use cloudwatch events, Eventbridge to have a look at them. 54 00:03:12,490 --> 00:03:17,380 ‫So for example, you can create events for failed pipelines, events for canceled stages, and then 55 00:03:17,380 --> 00:03:19,300 ‫receive an email notification, for example. 56 00:03:19,480 --> 00:03:24,370 ‫And then if Codepipeline has a failure at a stage, you will see it visually and you can get information 57 00:03:24,370 --> 00:03:25,270 ‫through the console. 58 00:03:25,390 --> 00:03:31,510 ‫And if there is no way for a pipeline to perform a specific action, for example, to invoke some code 59 00:03:31,510 --> 00:03:37,030 ‫in codebuild or to pull the code from code, commit, then check the service role of codepipeline. 60 00:03:37,030 --> 00:03:39,480 ‫Make sure it has the right IAM permissions. 61 00:03:39,490 --> 00:03:44,590 ‫Also, if you need to have a look at maybe some denied API calls within your infrastructure, you can 62 00:03:44,590 --> 00:03:48,630 ‫use cloudtrail which is a service used to audit API calls. 63 00:03:48,640 --> 00:03:51,820 ‫So let's say for Codepipeline it will make a lot more sense once we go to the hands on. 64 00:03:51,820 --> 00:03:53,650 ‫So I will see you in the next lecture. 65 00:03:53,650 --> 00:03:55,840 ‫I hope you liked it and let's get some practice.