Step 5: Create the build project - Amazon CodeBuild
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Step 5: Create the build project

(Previous step: Step 4: Upload the source code and the buildspec file)

In this step, you create a build project that Amazon CodeBuild uses to run the build. A 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. A build environment represents a combination of operating system, programming language runtime, and tools that CodeBuild uses to run a build. The build environment is expressed as a Docker image. For more information, see Docker overview on the Docker Docs website.

For this build environment, you instruct CodeBuild to use a Docker image that contains a version of the Java Development Kit (JDK) and Apache Maven.

To create the build project
  1. Sign in to the Amazon Web Services Management Console and open the Amazon CodeBuild console at https://console.amazonaws.cn/codesuite/codebuild/home.

  2. Use the Amazon region selector to choose an Amazon Region where CodeBuild is supported. For more information, see Amazon CodeBuild endpoints and quotas in the Amazon Web Services General Reference.

  3. If a CodeBuild information page is displayed, choose Create build project. Otherwise, on the navigation pane, expand Build, choose Build projects, and then choose Create build project.

  4. On the Create build project page, in Project configuration, for Project name, enter a name for this build project (in this example, codebuild-demo-project). Build project names must be unique across each Amazon account. If you use a different name, be sure to use it throughout this tutorial.

    Note

    On the Create build project page, you might see an error message similar to the following: You are not authorized to perform this operation.. This is most likely because you signed in to the Amazon Web Services Management Console as an user who does not have permissions to create a build project.. To fix this, sign out of the Amazon Web Services Management Console, and then sign back in with credentials belonging to one of the following IAM entities:

    • An administrator user in your Amazon account. For more information, see Creating your first Amazon Web Services account root user and group in the user Guide.

    • An user in your Amazon account with the AWSCodeBuildAdminAccess, AmazonS3ReadOnlyAccess, and IAMFullAccess managed policies attached to that user or to an IAM group that the user belongs to. If you do not have an user or group in your Amazon account with these permissions, and you cannot add these permissions to your user or group, contact your Amazon account administrator for assistance. For more information, see Amazon managed (predefined) policies for Amazon CodeBuild.

    Both options include administrator permissions that allow you to create a build project so you can complete this tutorial. We recommend that you always use the minimum permissions required to accomplish your task. For more information, see Amazon CodeBuild permissions reference.

  5. In Source, for Source provider, choose Amazon S3.

  6. For Bucket, choose codebuild-region-ID-account-ID-input-bucket.

  7. For S3 object key, enter MessageUtil.zip.

  8. In Environment, for Environment image, leave Managed image selected.

  9. For Operating system, choose Amazon Linux 2.

  10. For Runtime(s), choose Standard.

  11. For Image, choose aws/codebuild/amazonlinux2-x86_64-standard:4.0.

  12. In Service role, leave New service role selected, and leave Role name unchanged.

  13. For Buildspec, leave Use a buildspec file selected.

  14. In Artifacts, for Type, choose Amazon S3.

  15. For Bucket name, choose codebuild-region-ID-account-ID-output-bucket.

  16. Leave Name and Path blank.

  17. Choose Create build project.

Next step

Step 6: Run the build