# Day 51: CI/CD Pipeline on AWS - Part 2

Task-01 :

* you have to build the index.html using nginx server
    
* Add buildspec.yaml file to CodeCommit Repository and complete the build process.
    

we will continue from [part 1](https://hashnode.com/post/clj4gep4r000f09l97mszbaxv).

Step-by-Step Guide:

1. Setting up the Build Project in AWS CodeBuild:
    

Navigate to the AWS Console and create a new build project.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1687319238056/bab6981a-3c60-4fa9-a2b4-cf1ab69c6f76.png align="center")

* Provide a meaningful name and description for your project.
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1687319392381/9300e4ec-579e-49d1-bf69-e12ab2a1d7b5.png align="center")

Choose AWS CodeCommit as the source provider and select the repository created in Part 1, along with the desired branch.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1687319424766/1ef3668e-0415-4b8e-8f55-0012d490b0eb.png align="center")

For the environment, select Ubuntu as the operating system and the latest version of the image.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1687319518735/311afc9f-d363-42ba-be08-068485fab790.png align="center")

Create a new service role.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1687319594920/b24679e6-66cd-495b-b31a-041d0ba9f702.png align="center")

Configure the S3 bucket for storing artifacts.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1687319768826/9b472bc8-6600-402a-949a-195bec7a25c9.png align="center")

Then click on create project

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1687319858155/66383913-8f9b-4330-9809-599533fe8dea.png align="center")

1. Creating the buildspec.yaml file:
    

Include the following contents in your buildspec.yaml file:

```bash
version: 0.1

phases:
  install:
    commands:
      - echo Installing NGINX
      - sudo apt-get update
      - sudo apt-get install nginx -y
  build:
    commands:
      - echo Build started on `date`
      - cp index.html /var/www/html/
  post_build:
    commands:
      - echo Configuring NGINX

artifacts: 
  files:
    - /var/www/html/index.html
```

It will install NGINX on our environment and will copy our index.html to /var/www/html/ folder. It also creates artifacts.

1. Pushing to CodeCommit and Initiating the Build:
    

Push both the index.html file and buildspec.yaml to your CodeCommit Repository.

Start the build process and monitor the status and progress in the AWS CodeBuild console.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1687320329624/616beae9-fafe-40a7-8441-8544f497fac5.png align="center")

Go to your phase details and check status of build stages.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1687320376993/857394a5-4e59-4d5e-aa10-7b09c30e581b.png align="center")

Verify the successful creation of artifacts in your designated S3 bucket.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1687320556699/774f7288-c8fe-4c7a-b1c0-3049ecd9bc9e.png align="center")

You've successfully built the index.html file using NGINX server and incorporated the buildspec.yaml file into your CI/CD pipeline. See you in [part -3](https://hashnode.com/post/clj6l301y000209lb3ktranob)
