Friday, April 3, 2020

Continuous Integration and Delivery pipeline using Bitbucket, AWS CodeBuild, AWS CodePipline and AWS CodeDeploy - Part 3

This is the third article in the series where I explain how to setup Continuous Integration and Delivery pipeline using Bitbucket, AWS CodeBuild, AWS CodePipline and AWS CodeDeploy. You can read previous two articles here and here.

According to Amazon Web Services website:
AWS CodePipeline is a fully managed continuous delivery service that helps you automate your release pipelines for fast and reliable application and infrastructure updates. CodePipeline automates the build, test, and deploy phases of your release process every time there is a code change, based on the release model you define.
So now, let's see how we can set up AWS CodePipeline.

Once you login to you AWS account, go to AWS CodePipeLine and click on "Create pipeline".
Here, provide the name of the pipleline and select "New Service Role" option.

 Choose all default settings under Advanced Settings and click "Next".

On the next step, select source provider, from where you have stored the input artifacts. Here I have selected S3 as source provider, because that is where I am storing output of the codebuild, which I created in the first article.

Click "Next" to go to the next step which is to add a build step. We will skip this step as we have already build our artifacts using code build. But you can add this step here if your artifacts are not built yet. Currently AWS supports AWS CodeCommit and Jenkins as its build providers.

After skipping the build stage, you will get to the "Deploy" stage where you will need to select deployment provider - which essentially means which tool you want to use to deploy your application. Here AWS CodePipeline gives us lot of flexibility as we can select one of the many deployment tools such as CodeDeploy, CloudFormation, Elastic BeanStalk, ECS, Amazon S3 etc. Here we will select AWS CodeDeploy as we have already created a deployment application and deployment group as mentioned in the second part of this series.

Click "Next" and review your changes and click on "Create Pipeline" button.

Your continuous delivery pipeline is ready and it will start automatically. If any artifact is already available in the S3 bucket which we have selected as source provider, then it will get deployed automatically.

One thing to note here is, in CodePipeline so far we have created only two stage: source and deploy. But you can create as many stages as possible, such as unittest stage, integration test state, staging test etc. This way you can create a full fledge continuous integration, continouos delivery as well as continuous deployment pipeline by using AWS CodePipeline.

No comments: