What is CodePipeline?
- CodePipeline builds, tests, and deploys your code every time there is a code change, based on the release process models you define. Think of it as a CI/CD Pipeline service
Task-01
Create a Deployment group of Ec2 Instance.
Create a CodeDeploy application:
In CodeDeploy, go to Applications and click on 'Create application'.
Select compute platform âEC2/on premisesâ and click on âCreate applicationâ.
The application is successfully created.
Create a 'service role' for enabling communication between code deployment and other AWS services. Create 'code-deploy-service-role' with the below permissions.
Create an Ubuntu EC2 instance:
Create a deployment group:
Add a deployment group name and choose 'Service role'
Add instance name.
A deployment group is created
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
The code agent is running.
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.
Click "Next."
Under "Build provider," choose "AWS CodeBuild."
Select "build project name."
Click "Next.
Under "Deploy provider," choose "AWS CodeDeploy."
Select the deployment group you created earlier.
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.
Thankyou...