‫Okay, so now let's talk about Codepipeline, which is a visual workflow tool that will allow you to
‫orchestrate your CICD within AWS so you can show sources such as, Hey, my code is in Codecommit or
‫we have a Docker image in ECR or my code is in Amazon, S3 or even external tools such as Bitbucket
‫or GitHub.
‫Then you can move on to the build phase, which is, hey, now that we have this code, let's build
‫it.
‫So could build Jenkins, CloudBees Teamcity or all options.
‫Then once you have the build phase, you can have the test phase.
‫So again, testing your code.
‫So code build or device farm.
‫If you have an app, for example on iOS or Android app or any third party tools you want.
‫Then once the code is tested, you want to deploy it.
‫So code, deploy, Beanstalk, CloudFormation, S3 or all these options can be handled by codepipeline
‫and invoke to invoke a lambda function or a step function.
‫And then when you have all these building blocks, you can build stages.
‫So each stage can have sequential actions and or parallel actions.
‫So you can do a lot of things.
‫Here is a very simple example.
‫Build and test deploy onto staging, then load testing to make sure staging is doing fine.
‫And then once the load testing is done, maybe deploy again to production.
‫Now there's also a way for you to define manual approval at any stage in your pipeline, really allowing
‫you, for example, just before deploying to prod, to have someone review the results of the load testing,
‫for example, if it was there and make sure it says, yeah, it looks good.
‫Green light deploy to prod.
‫So Codepipeline really is here to orchestrate everything and it gives you a lot of flexibility thanks
‫to all the building blocks as we'll see in the next lectures.
‫Now how does Codepipeline work inside?
‫So let's assume we have a source, a build and deploy phase.
‫So sources code commit build is code build.
‫Even though we haven't seen code build yet and deploy is code deploy, even though we haven't seen code
‫deploy yet.
‫So each pipeline can create artifacts.
‫Artifacts are is whatever is created out of the pipeline and the artifacts are going to be stored in
‫S3 buckets to be passed on to the next stage.
‫And this is how the next stage is going to be able to do what it needs to do.
‫So let's do a concrete example.
‫The developer is going to push some code into code commits, right?
‫And then code commits is going to be orchestrated by code pipeline, which is going to extract all the
‫code and create an artifact out of it and place that artifact into an S3 bucket.
‫Now, when code build is invoked, the the same artifacts that were extracted are going to be inputted
‫directly into codebuild.
‫And that's why Codebuild doesn't need to have straight access into code commit.
‫Actually, it's code pipeline that will be pushing the code to codebuild through Amazon S3.
‫Then what Codebuild is being building the code is going to create some deployment artifacts.
‫So these artifacts are going to be stored yet again in your S3 bucket by Codepipeline and Codepipeline
‫will push these artifacts yet again to code, deploy and code Deploy says, Hey, I have these artifacts.
‫I need to deploy them, let's go ahead and deploy them.
‫So as you can see, these stages interact with each other through Amazon.
‫S3 And this is why we have artifacts in code pipeline.
‫Now some troubleshooting for Codepipeline.
‫So if you need to have a look at all these things, for example, you need to look at like code pipeline
‫action or stage execution state changes.
‫You can use cloudwatch events, Eventbridge to have a look at them.
‫So for example, you can create events for failed pipelines, events for canceled stages, and then
‫receive an email notification, for example.
‫And then if Codepipeline has a failure at a stage, you will see it visually and you can get information
‫through the console.
‫And if there is no way for a pipeline to perform a specific action, for example, to invoke some code
‫in codebuild or to pull the code from code, commit, then check the service role of codepipeline.
‫Make sure it has the right IAM permissions.
‫Also, if you need to have a look at maybe some denied API calls within your infrastructure, you can
‫use cloudtrail which is a service used to audit API calls.
‫So let's say for Codepipeline it will make a lot more sense once we go to the hands on.
‫So I will see you in the next lecture.
‫I hope you liked it and let's get some practice.