Day 51: CI/CD pipeline pt 2

What is CodeBuild?
• AWS CodeBuild is a fully managed continuous integration service.
• It compiles source code, runs tests, and produces deployable artifacts.
• No need to manage build servers — AWS handles scaling and infrastructure for y…


This content originally appeared on DEV Community and was authored by Udoh Deborah

What is CodeBuild?
• AWS CodeBuild is a fully managed continuous integration service.
• It compiles source code, runs tests, and produces deployable artifacts.
• No need to manage build servers — AWS handles scaling and infrastructure for you.
• Commonly used with CodeCommit, CodePipeline, and CodeDeploy.

Tasks for Day 51

Task 01 — Learn & Prep
A. Read about buildspec.yml:
• This file defines all the build commands and settings for CodeBuild.
• Written in YAML, placed at the root of your repo.

version: 0.2

phases:
  install:
    commands:
      - echo Installing dependencies...
  build:
    commands:
      - echo Build started on `date`
      - echo Compiling the application
  post_build:
    commands:
      - echo Build completed on `date`

artifacts:
  files:
    - '**/*'

B. In your CodeCommit repo, create a simple index.html file:

<!DOCTYPE html>
<html>
<head>
    <title>Day 51 - CodeBuild Demo</title>
</head>
<body>
    <h1>Hello from AWS CodeBuild </h1>
</body>
</html>

C. Plan to build it using nginx server inside CodeBuild.

Task 02 — Build with CodeBuild
1. Create a buildspec.yml file in your repo:

version: 0.2

phases:
  install:
    runtime-versions:
      docker: 18
    commands:
      - echo Installing Nginx...
      - yum install -y nginx
  build:
    commands:
      - echo Build started on `date`
      - mkdir -p /usr/share/nginx/html
      - cp index.html /usr/share/nginx/html/index.html
  post_build:
    commands:
      - echo Build completed on `date`
      - echo Artifacts ready for deployment

artifacts:
  files:
    - index.html

D. Push changes to CodeCommit

git add index.html buildspec.yml
git commit -m "Add index.html and buildspec for CodeBuild"
git push origin main

In AWS Console → CodeBuild:

  • Create a new project.
  • Connect it to your CodeCommit repo.
  • Choose environment: Managed image → Amazon Linux 2 → Standard runtime.
  • Use the buildspec.yml you committed.
    1. Start the build → You should see the process install Nginx, copy index.html, and output artifacts.


This content originally appeared on DEV Community and was authored by Udoh Deborah


Print Share Comment Cite Upload Translate Updates
APA

Udoh Deborah | Sciencx (2025-09-17T18:39:58+00:00) Day 51: CI/CD pipeline pt 2. Retrieved from https://www.scien.cx/2025/09/17/day-51-ci-cd-pipeline-pt-2/

MLA
" » Day 51: CI/CD pipeline pt 2." Udoh Deborah | Sciencx - Wednesday September 17, 2025, https://www.scien.cx/2025/09/17/day-51-ci-cd-pipeline-pt-2/
HARVARD
Udoh Deborah | Sciencx Wednesday September 17, 2025 » Day 51: CI/CD pipeline pt 2., viewed ,<https://www.scien.cx/2025/09/17/day-51-ci-cd-pipeline-pt-2/>
VANCOUVER
Udoh Deborah | Sciencx - » Day 51: CI/CD pipeline pt 2. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/09/17/day-51-ci-cd-pipeline-pt-2/
CHICAGO
" » Day 51: CI/CD pipeline pt 2." Udoh Deborah | Sciencx - Accessed . https://www.scien.cx/2025/09/17/day-51-ci-cd-pipeline-pt-2/
IEEE
" » Day 51: CI/CD pipeline pt 2." Udoh Deborah | Sciencx [Online]. Available: https://www.scien.cx/2025/09/17/day-51-ci-cd-pipeline-pt-2/. [Accessed: ]
rf:citation
» Day 51: CI/CD pipeline pt 2 | Udoh Deborah | Sciencx | https://www.scien.cx/2025/09/17/day-51-ci-cd-pipeline-pt-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.