Day 53: CI/CD pipeline on AWS - Part 4 ☁ ☁
On your journey of making a CI/CD pipeline on AWS with these tools, you completed AWS CodeCommit, CodeBuild & CodeDeploy.
Finish Off in style with AWS CodePipeline🚀
What is CodePipeline ?
AWS CodePipeline is a fully managed continuous delivery service provided by Amazon Web Services (AWS). It helps you automate and streamline the process of building, testing, and deploying your applications. CodePipeline allows you to create and manage pipelines that orchestrate the release of your software from source code to production.
Here are some key aspects and features of CodePipeline:
Pipeline Creation: CodePipeline allows you to create pipelines, which represent the workflow for your application release process. A pipeline consists of a series of stages, each representing a different phase of the software delivery process, such as source code retrieval, build, test, and deployment.
Source Integration: CodePipeline integrates with various source code repositories like AWS CodeCommit, GitHub, and Bitbucket. It can detect changes in the source code repository and trigger the pipeline to initiate the release process automatically.
Build and Test Automation: CodePipeline integrates with AWS CodeBuild, enabling you to automate the build and test stages of your application. CodeBuild can compile your code, run unit tests, and generate artifacts that are ready for deployment.
Deployment Automation: CodePipeline integrates with other AWS deployment services like AWS CodeDeploy, AWS Elastic Beanstalk, and AWS CloudFormation. You can configure the pipeline to automatically deploy your application to different environments, such as development, staging, and production, using these deployment services.
Manual Approval Actions: CodePipeline supports manual approval actions, allowing you to introduce manual gates in your release process. You can configure a stage in the pipeline to pause and wait for manual approval before proceeding to the next stage. This provides control and validation points in the deployment process.
Flexible Pipeline Execution: CodePipeline allows you to define the execution order and parallelism of stages within a pipeline. You can configure sequential or parallel execution of stages based on your application's requirements.
Visualization and Monitoring: CodePipeline provides a visual representation of your pipeline, allowing you to view the status and progress of each stage. You can monitor the execution of your pipeline, track changes, and view detailed logs and metrics to identify any issues during the release process.
Integration with Third-Party Tools: CodePipeline supports integration with a wide range of third-party tools and services through its extensible architecture. You can incorporate external tools for code analysis, security scanning, and other custom actions into your pipeline.
Benefits Of Using AWS CodePipeline
AWS CodePipeline enables you to easily build end-to-end continuous integration and continuous deployment (CICD) pipelines using AWS native services - external dependencies can be avoided.
AWS CodePiple already has integrations with many AWS services like AWS ECR, AWS S3, AWS CloudFormation, etc.
AWS CodePipeline does offer compatibility with other third-party vendors if required, like Jenkins and TeamCity.
AWS CodePipeline allows you to easily track the progress and history of your deployment pipelines.
Task-1
Create a Deployment group of Ec2 Instance.
🔎Step 1: Navigate in AWS Console, Search for CodeDeploy,
📁Step2: Go to Applications and click on 'Create application'.
🛠Step3: Select compute platform ‘EC2/on premises’ and click on ‘Create application’.
✔Step4: The application is successfully created.
📑Step5: Create a 'service role' for enabling communication between code deployment and other AWS services.
🔑Step6: Select permissions for 'code-deploy-service-role'
✏Step7: Create an Ubuntu EC2 instance
🔏Step8: Create a deployment group
📚Step9: Create a deployment group name and choose 'Service role'
🖌Step10: Create a instance name. Click on create deployment group button
🍀Step11: Deployment group is successfully Created
📒 Step12: Install the CodeDeploy agent in the ec2 instance:
You can install the CodeDeploy agent by running the following script on your EC2 instance:
#!/bin/bash # This installs the CodeDeploy agent and its prerequisites on Ubuntu 22.04. sudo apt-get update sudo apt-get install ruby-full ruby-webrick wget -y cd /tmp wget https://aws-codedeploy-ap-south-1.s3.ap-south-1.amazonaws.com/releases/codedeploy-agent_1.3.2-1902_all.deb mkdir codedeploy-agent_1.3.2-1902_ubuntu22 dpkg-deb -R codedeploy-agent_1.3.2-1902_all.deb codedeploy-agent_1.3.2-1902_ubuntu22 sed 's/Depends:.*/Depends:ruby3.0/' -i ./codedeploy-agent_1.3.2-1902_ubuntu22/DEBIAN/control dpkg-deb -b codedeploy-agent_1.3.2-1902_ubuntu22/ sudo dpkg -i codedeploy-agent_1.3.2-1902_ubuntu22.deb systemctl list-units --type=service | grep codedeploy sudo service codedeploy-agent status
Create a CodePipeline that gets the code from CodeCommit
Builds the code using CodeBuild and deploys it to a Deployment Group.
Go to the CodePipeline console. Click "Create pipeline."
Enter a name for your pipeline.
Under "Source provider," choose "AWS CodeCommit." Select the repository and branch you want to deploy and Click "Next " button
Under "Build provider," choose "AWS CodeBuild." Select "build project name."
Click on "Next button".
Under "Deploy provider," choose "AWS CodeDeploy."
- Select the deployment group you created earlier and Click "Next."
Review the pipeline settings and click "Create pipeline."
The pipeline will automatically trigger a build and deploy the new code to the EC2 instance.
Successfully created a CodePipeline that automates the deployment process.
Conclusion:
AWS CodePipeline is a powerful tool for automating the build, test, and deployment of your applications. Its integration with other AWS services and ease of use make it an essential tool for any team looking to improve the speed and reliability of their software delivery process.
Thank you for 📖reading my blog, 👍Like it and share it 🔄 with your friends.
Happy learning😊😊
Subscribe to my newsletter
Read articles from Siri Chandana directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by