AWS Project Part 1 :CI/CD Pipeline Integration with AWS CodeCommit and CodeBuild.

AWS Project Part 1 :CI/CD Pipeline Integration with AWS CodeCommit and CodeBuild.

ยท

2 min read

Connecting IAM and Code Commit

IAM

Inorder to use code commit, use need IAM user because you cant configure HTTP/HTTPS using root account. So let's create a User.

Create a User in IAM service.

Add code commit access permissions using add permissions tab and give Code Commit access to this IAM user by generating credentials and store it.

Create a repository:

We will use this repo URL and clone it in our local system.

Open your any terminal and create was project repo where we will do our project and clone the repo which we copied above into the terminal

My repo is cloned now. I will go into my my-app folder and add index.html file

 git status
 git add .
 git commit -m "added index.html file"

So far I have created my index.html in my local server. Now I will push this file into AWS repository.

 git push origin master

Our file is successfully pushed into was repo

Let's create a new branch and merge.

This is how we created a user who can access AWS code commit and we integrated our AWS Code commit with our local server and performed PUSH, MERGE operations.


Code Build

buildspec.yml file :

version: 0.2
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:
    - '**/*'

CodeBuild compiles your source code, runs unit tests, and produces artifacts that are ready to deploy.

Let's make use of S3 where our output artifacts will be stored inside it

Add s3 to artifacts

But before that create a folder as object in the created bucket

Our build is succeeded and artifacts were stores in s3

ย