Day 51: CI/CD pipeline on AWS - Part 2 ????

Day 51: CI/CD pipeline on AWS - Part 2 ????

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 the Buildspec file for CodeBuild.

The build procedure for your CodeBuild project is specified in a Buildspec file, a YAML file. To build and bundle your program, CodeBuild will run a number of instructions from this file.

Create a simple index.html file in CodeCommit Repository.

you have to build the index.html using nginx server

Create a code commit repository

No alt text provided for this image

Copy clone HTTPS URL

No alt text provided for this image

Use the git clone command in git bash to copy the repository to your computer.

No alt text provided for this image

Create an index.html file inside the code commit repository.

No alt text provided for this image

With the git add and git commit commands, you can save the file and add the modifications to the repository.

git add <file-name>        
No alt text provided for this image
git commit -m "commit message"        
No alt text provided for this image

Using the git push command, add the modifications to the repository.

No alt text provided for this image

A straightforward index.html file can be found in your CodeCommit repository.

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

Task-02 :

Add buildspec.yaml file to CodeCommit Repository and complete the build process.

To build the file with a nginx server, create a Buildspec file.

No alt text provided for this image

Below are the functions of each build step:

  • The version of the Buildspec syntax we're using is stated as version: 0.2.
  • Phases: This lists the stages of construction for our project.
  • install: utilizes the apt-get package manager to install nginx on the built environment.
  • build Places a copy of the index.html file in the nginx default web root directory.
  • post build: If additional nginx settings are required, it is done.
  • Indicates where the index.html file should be included in the build artifact.

With the git add and git commit commands, you can save the file and add the modifications to the repository.

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

Push the changes to the code commit repository

No alt text provided for this image

You have two files in your CodeCommit repository: buildspec.yml and index.html.

No alt text provided for this image

Create a project:

Visit the service for CodeBuild. Choose "Create build project" from the menu.

No alt text provided for this image

Your build project's name, source provider (CodeCommit), repository, and branch should all be entered.

No alt text provided for this image

Choose AWS CodeCommit as the source provider in the source area, then choose the repository you previously created and branch master.

No alt text provided for this image

In the Environment section, choose the operating system, and runtime ad image.

No alt text provided for this image

Choose "Use a buildspec file" in the "Buildspec" section when creating a new service role.

No alt text provided for this image

Click "Create build project" to create your project.

No alt text provided for this image

The project is successfully created.

To begin a fresh build, click the "Start construction" button.

No alt text provided for this image

Verify the status of the successful build.

No alt text provided for this image

Each step of the phase was successful.

No alt text provided for this image

to include artifacts and store them in an S3 bucket as part of a CodeBuild project.

Choose "Artifacts" under "edit" after clicking.

No alt text provided for this image

First, create an S3 bucket.

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

the bucket is successfully created.

No alt text provided for this image

Choose the Amazon S3 type and the bucket name you created in the previous step under Artifacts.

No alt text provided for this image

Choose "Update artifacts."

To begin a new build after updating artifacts, click the "Start build" button once more.

No alt text provided for this image

The built-in S3 bucket location will receive the artifacts after the build is finished.

No alt text provided for this image

The path of the file, which is /var/www/html/index.html, is specified in the artifacts phase of the buildspec.yml file. You can verify that the s3 bucket has folders and an index.html file.

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

Click on 'index.html' file, below you can see the properties of the file.

Click on 'open' on the right-hand side.

No alt text provided for this image

Here is an output of index.html file.

No alt text provided for this image

Thank you for sticking with me; I hope you learned something. ?? ??

Aprajita Gupta

Aspiring Devops Engineer || Linux | AWS | Jenkins |Github | Docker | Kubernetes | Terraform| Ansible

1 年

Nice ??

Sunil Kumar

Senior Cloud Engineer - Nagarro | Google Cloud Certified {"CDI, ACE , PCA, PDE}|Cloud DevOps Specialist | 5x GCP , Azure Certified | Devops | Linux | Docker | Terraform | Jenkins CI/CD | Kubernetes

1 年

Good going !! Vinay Kumar

Sayali Jadhav

DevOps Engineer at BH Mobile Pte Ltd || AWS || Linux || CICD || Jenkins || Git GitHub || Docker || Kubernetes || Terraform ||

1 年

Great work Vinay Kumar

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

Vinay Kumar的更多文章

  • DevOps Project - 4 ????

    DevOps Project - 4 ????

    Project Description The project aims to deploy a web application using Docker Swarm, a container orchestration tool…

    7 条评论
  • DevOps Project 3 ????

    DevOps Project 3 ????

    Project Description The project involves hosting a static website using an AWS S3 bucket. Amazon S3 is an object…

    3 条评论
  • DevOps Project -2 ????

    DevOps Project -2 ????

    Project Description The project is about automating the deployment process of a web application using Jenkins and its…

  • Day 80: DevOps Project 1 ????

    Day 80: DevOps Project 1 ????

    Project Description The project aims to automate the building, testing, and deployment process of a web application…

    2 条评论
  • Day 73 - Setup Grafana on AWS EC2 Instance ????

    Day 73 - Setup Grafana on AWS EC2 Instance ????

    Task: Set up grafana in your local environment on AWS EC2. Go to the AWS console and Launch an EC2 instance To enable…

  • Day 72 - Grafana ????

    Day 72 - Grafana ????

    What is Grafana? No matter where your metrics are kept, Grafana is an open-source data visualization and monitoring…

    4 条评论
  • Day71 - Terraform Interview Questions ????

    Day71 - Terraform Interview Questions ????

    1. What is Terraform and how it is different from other IaaC tools? HashiCorp's Terraform is an Infrastructure as Code…

  • Day 70 - Terraform Modules ????

    Day 70 - Terraform Modules ????

    Modules are containers for multiple resources that are used together. A module consists of a collection of .

    4 条评论
  • Day 69 - Meta-Arguments in Terraform ???

    Day 69 - Meta-Arguments in Terraform ???

    When you define a resource block in Terraform, by default, this specifies one resource that will be created. To manage…

    4 条评论
  • Day 65 - Terraform Resources ????

    Day 65 - Terraform Resources ????

    Understanding Terraform Resources A resource in Terraform represents a component of your infrastructure, such as a…

    2 条评论

社区洞察

其他会员也浏览了