Tuesday, October 29, 2019

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

In the previous post we looked at how to configure AWS Codebuild for CI/CD pipeline.
In this post we will look at configuring AWS CodeDeploy.
First Let's see what is CodeDeploy.
According to Amazon Web Services website, 
AWS CodeDeploy is a fully managed deployment service that automates software deployments to compute services such as Amazon EC2, AWS Lambda, and your on-premises servers.
So now let's see how we can set up AWS CodeDeploy.
Once you login to your AWS account, go to AWS CodeDeploy and click on "Create Application".
You need to first provide Application name (such as "MyFirstDeployment") and choose your compute platform (EC2, AWS Lambda, Amazon ECS). Here we will choose EC2 Instance as our comput platform.

Then click "Create Application".

Once the application is created you must create a deployment group. You can have multiple deployment group per application. Deployment group allows to have different deployment settings per different environment such as Production, Staging,Development or different deployment settings per different types of application in save environments such as Frontend Web application vs backend microservices.
Click  on the "Create Deployment Group" button.
Here first provide the deployment group name and choose an existing service role which has required deployment permissions (such as EC2 access permission, cloudwatch log creation permission, S3 permission if you are going to download artifacts from S3).

Now, in the "Deployment Type" section choose how you want to deployment to happen. "In-place" means every time you deploy the application, previous version of the application will be removed and new one will be deployed. This means that your application will not be available during the duration of the deployment.
In the "Blue/Green" deployment, each revision of the application is deployed to a different instance(existing or new), which then brought online after the deployment. Existing instance keeps running during the course of deployment and taken offline after the deployment. This way your application is always available even during the deployment.

Here we will stick to In-Place deployment for now.
After this you need to provide the Tags to select the environment in which you want to deploy.

Next you need to provide Deployment Settings and if you use Load Balancer.

We can skip the Trigger and Alarm section and create the deployment group.

In next post we will look at how to setup the AWS Codepipeline and connect the AWS CodeBuild, which we setup previously and AWS CodeDeploy which we setup in this post.


No comments: