Day 51 Task: Your CI/CD pipeline on AWS Part- 2
On your journey of making a CI/CD pipeline on AWS with these tools, we completed AWS CodeCommit.
Next few days you'll learn these tools/services:
CodeBuild
CodeDeploy
CodePipeline
S3
๐ถ 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 build servers.
๐ถ Task-01: Buildspec file for Codebuild.
Read about the Buildspec file for Codebuild.
Create a simple index.html file in the CodeCommit Repository.
Log in to AWS Management Console and go to CodeCommit.
Create or select an existing secure repository to store and share your code.
Clone the Repository
Open the terminal and navigate to the directory where you want to clone the CodeCommit repository.
Run the following command, replacing
<repository-url>
with the URL of your CodeCommit repository:
git clone https://<repository-url>
When prompted, enter the Git credentials (username and password) you generated in the IAM user. This will authenticate your local Git client with CodeCommit.
You have to build the index.html using the nginx server.
๐ถ Task-02: Add the buildspec.yaml file to CodeCommit Repository and complete the build process.
Create a
buildspec.yaml
file:version: 0.2 phases: pre_build: commands: - echo "Installing NGINX..." - sudo apt-get update - sudo apt-get -y install nginx - echo "NGINX installed." build: commands: - echo "build started on 'date'" - cp index.hmtl /var/www/html post_build: commands: - echo "Configuring NGINX.." artifacts: files: - '**/*'
Push the
buildspec.yaml
to CodeCommit:Use the
git
command to push thebuildspec.yaml
file to your CodeCommit repository:git add . git commit -m "Adding index.hmt and buildspec.yaml" git push origin master
Set up CodeBuild:
In the AWS Management Console, navigate to AWS CodeBuild.
Create a new build project.
Configure your source provider (CodeCommit).
Select source provider AWS CodeCommit, Repository and Branch master.Configure Environment:
Choose the build environment, and specify the buildspec file location (
buildspec.yaml
in the root directory), and set environment variables as needed.Create the build project.
Start the build.
Check the logs and phases steps:
Now Create an S3 bucket.
Now Add Artifacts to a Codebuild and store them in the S3 bucket.
Now Start building again.
Now go to your S3 bucket and check for the index.html file under your bucket object.
Now Select the open button to open the html file in the browser.
For more details watch this video.
Happy Learning :)
Stay in the loop with my latest insights and articles on cloud โ๏ธ and DevOps โพ๏ธ by following me on Hashnode, LinkedIn (https://www.linkedin.com/in/chandreshpatle28/), and GitHub (https://github.com/Chandreshpatle28).
Thank you for reading! Your support means the world to me. Let's keep learning, growing, and making a positive impact in the tech world together.
#Git #Linux Devops #Devopscommunity #90daysofdevopschallenge #python #docker #Jenkins #Kubernetes #Terraform #AWS
Subscribe to my newsletter
Read articles from CHANDRESH PATLE directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
CHANDRESH PATLE
CHANDRESH PATLE
Hi, I'm Chandresh Patle, an aspiring DevOps Engineer with a diverse background in field supervision, manufacturing, and service consulting. With a strong foundation in engineering and project management, I bring a unique perspective to my work. I recently completed a Post Graduate Diploma in Advanced Computing (PG-DAC), where I honed my skills in web development, frontend and backend technologies, databases, and DevOps practices. My proficiency extends to Core Java, Oracle, MySQL, SDLC, AWS, Docker, Kubernetes, Ansible, Linux, GitHub, Terraform, Grafana, Selenium, and Jira. I am passionate about leveraging technology to drive efficient and reliable software delivery. With a focus on DevOps principles and automation, I strive to optimize workflows and enhance collaboration among teams. I am constantly seeking new opportunities to expand my knowledge and stay up-to-date with the latest industry trends. If you have any questions, collaboration ideas, or professional opportunities, feel free to reach out to me at patle269@gmail.com. I'm always open to connecting with fellow tech enthusiasts and exploring ways to contribute to the DevOps community. Let's build a better future through innovation and continuous improvement!