Getting Started with AWS

Create Continuous Delivery Pipeline

Set up a git repo, deploy a sample web app, and create a continuous delivery pipeline

Module 3: Create Build Project

In this module you will configure and execute the application build process using AWS CodeBuild.

Introduction

In this module, you will use AWS CodeBuild to build the source code previously stored in your GitHub repository. AWS CodeBuild is a fully managed continuous integration service that compiles source code, runs tests, and produces software packages that are ready to deploy.

What You Will Learn

  • Create a build project with AWS CodeBuild
  • Set up GitHub as the source provider for a build project
  • Run a build on AWS CodeBuild

Key Concepts

Build Process Process that converts source code files into an executable software artifact. It may include the following steps: compiling source code, running tests, and packaging software for deployment.

Continuous Integration Software development practice of regularly pushing changes to a hosted repository, after which automated builds and tests are run.

Build Environment Represents a combination of the operating system, programming language runtime, and tools that CodeBuild uses to run a build.

Buildspec Collection of build commands and related settings, in YAML format, that CodeBuild uses to run a build.

Build Project Includes information about how to run a build, including where to get the source code, which build environment to use, which build commands to run, and where to store the build output.

OAuth Open protocol for secure authorization. OAuth enables you to connect your GitHub account to third-party applications, including AWS CodeBuild.

 Time to Complete

5 minutes

 Services Used

Implementation

  • Configure the AWS CodeBuild project
    1. In a new browser tab open the AWS CodeBuild Console.
    2. Click the orange "Create project" button.
    3. In the "Project name" field type "Build-DevOpsGettingStarted."
    4. Select "GitHub" from the "Source provider" dropdown menu.
    5. Visually confirm that the "Connect using OAuth" radio button is selected.
    6. Click the white "Connect to GitHub" button. After clicking this button, a new browser tab will open asking you to give AWS CodeBuild access to your GitHub repo.
    7. Click the green "Authorize aws-codesuite" button.
    8. Type in your GitHub password.
    9. Click the orange "Confirm" button.
    10. Select "Repository in my GitHub account."
    11. Type "aws-elastic-beanstalk-express-js-sample" in the search field.
    12. Click on the repo you forked in Module 1. After clicking your repo, your screen should look like this:
    Module 3 - CodeBuild_Source

    13. Visually confirm that "Managed Image" is selected.

    14. Select "Amazon Linux 2" from the "Operating system" dropdown menu.

    15. Select "Standard" from the "Runtime(s)" dropdown menu.

    16. Select "aws/codebuild/amazonlinux2-x86_64-standard:3.0" from the "Image" dropdown menu.

    17. Visually confirm that "Always use the latest image for this runtime version" is selected for "Image version."

    18. Visually confirm that "Linux" is selected for "Environment type."

    19. Visually confirm that "New service role" is selected.

  • Create a Buildspec file for the project
    1. Select "Insert build commands."
    2. Click on "Switch to editor."
    3. Replace the Buildspec in the editor with the code below:
    version: 0.2
    phases:
        build:
            commands:
                - npm i --save
    artifacts:
        files:
            - '**/*'

    4. Click the orange "Create build project" button. You should now see a dashboard for your project.

  • Test the CodeBuild project
    1. Click the orange "Start build" button. This will load a page to configure the build process.
    2. Confirm that the loaded page references the correct GitHub repo.
    3. Click the orange "Start build" button.
    4. Wait for the build to complete. As you are waiting you should see a green bar at the top of the page with the message "Build started," the progress for your build under 'Build log," and, after a couple minutes, a green check mark and a "Succeeded" message confirming the build worked.

Application Architecture

Here's what our architecture looks like now:

Module-3

We have created a build project on AWS CodeBuild to run the build process of the Hello World! web app from our GitHub repository. We will be using this build project as the build step in our continuous delivery pipeline, which we will create in the next module.

Was this module helpful?

Thank you
Please let us know what you liked.
Close
Sorry to disappoint you
Is something out-of-date, confusing or inaccurate? Please help us improve this tutorial by providing feedback.
Close

Create Delivery Pipeline