CI/CD pipeline on AWS - Part-1
Now that we're acquainted with AWS, let's dive into crafting our CI/CD pipeline on AWS using these essential tools:
CodeCommit
CodeBuild
CodeDeploy
CodePipeline
S3
What is CodeCommit ?
CodeCommit is a managed source control service by AWS that allows users to store, manage, and version their source code and artifacts securely and at scale. It supports Git, integrates with other AWS services, enables collaboration through branch and merge workflows, and provides audit logs and compliance reports to meet regulatory requirements and track changes. Overall, CodeCommit provides developers with a reliable and efficient way to manage their codebase and set up a CI/CD pipeline for their software development projects.
Task-01 :
Set up a code repository on CodeCommit and clone it on your local.
You need to setup GitCredentials in your AWS IAM.
Use those credentials in your local and then clone the repository from CodeCommit
Solution:
Step 1 :create user and grant IAM role.
Adding AWSCodeCommitPoweruser policy to user.
Step 2: Create demo-test repository.
Step 3: Need to setup Git Credentials in your AWS IAM.
Go to IAM->Select User->Security credentials tab-> HTTPS Git credentials for AWS CodeCommit ->generate credetials.
Step 4: Using above credentials we can work on code-commit repository on local system
Go to codecommit repository and copy URL for HTTPS clone.
As soon as you hit clone repository URL in local terminal it will prompt for credentials. Provide credentials which we are generated in previous step.
Task-02 :
Add a new file from local and commit to your local branch
Push the local changes to CodeCommit repository.
Solution:
Step 1: creating sample file in folder.
We have commited the change and we could see file added in local.
Step 2: Push the local changes to CodeCommit repository.
git push origin master
Step 3: verify file in codeComit repo.
We have successfully pushed file from local to codeCommit repository.
What is CodeBuild ?
AWS CodeBuild is a fully managed build service in the cloud. CodeBuild compiles your source code, runs unit tests, and produces artifacts that are ready to deploy. CodeBuild eliminates the need to provision, manage, and scale your own build servers.
Task-01 :
Read about Buildspec file for Codebuild.
create a simple index.html file in CodeCommit Repository
you have to build the index.html using nginx server
Solution:
Step 1:
A Buildspec file, written in YAML, outlines the build process for your CodeBuild project. It comprises a sequence of commands executed by CodeBuild to build and package your application.
Step 2: Lets create simple index.html file in local and pushed it to codecommit repo.
verify the files in codecommit repository.
Step 3:
Lets create a Buildspec file to build the file using an nginx server.
Push buildspec file codecommit repo.
Buildspec file has been added to code-commit repo.
Lets build file using code-build.
Goto code build-> Create Build.
Hit create build project button and we could see build in dashbaord
Hit on start build button.
Post fixing few syntax error, I am bale to build file successfully..
In next session will work on code-deploy and code pipeline in more details.
Thanks
Kishor Chavan
Subscribe to my newsletter
Read articles from Kishor Chavan directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Kishor Chavan
Kishor Chavan
With a rich history spanning decades in Industrial IT, I currently serve as a Technical Consultant at onshore. My career has been defined by my unwavering commitment to DevOps and leadership in database administration projects. Cloud Expertise: I possess extensive knowledge and hands-on experience in the realms of Microsoft Azure and AWS Cloud. I've played a pivotal role in architecting and optimizing cloud solutions that enable businesses to scale, innovate, and thrive. Cloud DB and DevOps Advocate: My pursuit of excellence never stops. I'm on a constant quest to acquire deep knowledge in Cloud Database solutions and DevOps tools. From Azure DevOps to Jenkins, Ansible to GitHub, Terraform to Docker and Kubernetes, I'm committed to staying at the forefront of industry trends. I'm passionate about leveraging technology to drive success in industrial IT. Let's connect and explore how my decades of experience and expertise can contribute to your organization's growth and transformation.