Implementation of CI/CD on AWS 
Cloud using AWS CodePipeline

Implementation of CI/CD on AWS Cloud using AWS CodePipeline

Prerequisites

  1. Setup Git Bash on your local system and need to configure to connect with AWS Code Commit.
  2. Create an IAM user with Admin privileges' ( for better understanding) and will generate the credentials under Security Credentials Tab and will go and select HTTPS Git credentials for AWS Code Commit.
  3. Setup two EC2 Linux instances one for Test and other for Production.

No alt text provided for this image

  1. Install SSM agent , Code Deploy agent.
  2. Need to create couple of Roles

  • For AWS Code Deploy to connect to EC2 on your behalf.
  • For AWS EC2 to connect to SSM and AWS Code Deploy on your behalf.

Role for AWS Code Deploy (role_codedeploy_ec2) and attach the policy as mentioned below:
No alt text provided for this image
Role for EC2 instance (ec2_role_codedeploy ) and attach the below policies as mentioned:
No alt text provided for this image

6. Install Code Deploy Agent via AWS SSM.

No alt text provided for this image
Introduction

Once we have developed and deployed the application/product, It needs to be continuously updated based on user feedback or the addition of new features. This process should be automated, as without automation we have to run the same development and deployment steps/commands again and again for every change to the application.

With Continuous Integration and Continuous Delivery Pipeline, we can automate the complete workflow from building, testing, packaging, and deploying, which will be triggered when there are any changes to an existing application or we can say if there is any new commit to an existing code repository.

Advantages of CI CD Pipeline

  • Frequent releases: With CI/CD we can release the changes based on customer feedback or monitoring input
  • Low risk: As the process will be automated, there won’t be any manual intervention and configuration setup
  • Increased Productivity: With a structured process, a product will be released independently of other components, as in the case of multiple microservices we can release changes independently thus increasing developer productivity


Implementation Plan
The Architecture in short
No alt text provided for this image
Go to AWS CodeCommit and create a repository for pushing the code from your local workstation.
No alt text provided for this image
Go to AWS CodeBuild and build a project.

  • Give Project name.
  • Source Should be AWS CodeCommit.
  • Give the repository name which you created in the previous step.
  • Choose Managed instance under Environment image and choose the OS.
  • Under BuildSpec you select "Insert build commands", you can run specific commands to test the code before pushing forward. For Example you can find some particular function which is compulsory inside the code without which the code must be rolled back.

No alt text provided for this image

  • After selecting all options and selecting Create Build Project now a role will be created.

No alt text provided for this image
No alt text provided for this image
Goto AWS CodeDeploy.

  • Create application.

No alt text provided for this image
No alt text provided for this image

  • Goto the application which you created now and select Create Deployment Group.

No alt text provided for this image

  • Select the Role which was created very first role_codedeploy_ec2.
  • Select the rest details as required and create.
  • Deployment group can be created one for Test and one for Production.

No alt text provided for this image
Create a S3 bucket.

  • Create a build in same region and give required permission and it will act as an inventory for code.

No alt text provided for this image
Create AWS CodePipeline.

  • Select the S3 bucket which we created just above.

No alt text provided for this image

  • Give Source provider CodeCommit and select the repository and selct Next keeping all as default.
  • Select Build Provider as AWS CodeBuild and select the project which you created and click Next.
  • Select Deploy provider as AWS CodeDeploy , also select the application and deployment group ( you can choose either production or testing here, so choose testing now).

No alt text provided for this image

  • Review and create pipeline.

No alt text provided for this image
Pipeline looks like this after creation.
No alt text provided for this image
No alt text provided for this image

  • Now after deploy stage ,select Edit from above and select + Add Stage
  • Give stage name Manual approval and then select +Add action group.
  • Choose action provider as Manual approver and select Done.
  • Add another stage now this time we will create a stage for production so once QA Team gives the approval after several testing the code will get finally deployment to production.
  • After creating the stage for production now select +Add action group and now select Action provider AWS CodeDeploy as shown below and select Done.

No alt text provided for this image

  • The 2 stages which we created now looks like this shown below and select Save it everything looks good.

No alt text provided for this image
No alt text provided for this image
" So Finally the entire CI CD Pipeline is created successfully. "

Now go to git bash write your Code and push your code on testing and on approval deploy to production.

"Final Output "
No alt text provided for this image


I have created a Static Website here just for Testing and Have Fun now everything is fully automatic from code build till code deployment.
No alt text provided for this image


" THANK YOU ALL FOR SCROLLING TILL THE END "

要查看或添加评论,请登录

Abhinav Paul的更多文章

社区洞察

其他会员也浏览了