Run a batch build (Amazon CLI) - 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).

Run a batch build (Amazon CLI)

  1. Run the start-build-batch command in one of the following ways:

    aws codebuild start-build-batch --project-name <project-name>

    Use this if you want to run a build that uses the latest version of the build input artifact and the build project's existing settings.

    aws codebuild start-build-batch --generate-cli-skeleton > <json-file>

    Use this if you want to run a build with an earlier version of the build input artifact or if you want to override the settings for the build output artifacts, environment variables, buildspec, or default build timeout period.

  2. If you run the start-build-batch command with the --project-name option, replace <project-name> with the name of the build project, and then skip to step 6 of this procedure. To get a list of build projects, see View build project names.

  3. If you run the start-build-batch command with the --idempotency-token option, a unique case-sensitive identifier, or token, is included with the start-build-batch request. The token is valid for 5 minutes after the request. If you repeat the start-build-batch request with the same token, but change a parameter, CodeBuild returns a parameter mismatch error.

  4. If you run the start-build-batch command with the --generate-cli-skeleton option, JSON-formatted data is output to the <json-file> file. This file is similar to the skelton produced by the start-build command, with the addition of the following object. For more information about the common objects, see Run a build (Amazon CLI).

    Modify this file to add any build overrides, and save your results.

    "buildBatchConfigOverride": { "combineArtifacts": combineArtifacts, "restrictions": { "computeTypesAllowed": [ allowedComputeTypes ], "maximumBuildsAllowed": maximumBuildsAllowed }, "serviceRole": "batchServiceRole", "timeoutInMins": batchTimeout }

    The buildBatchConfigOverride object is a ProjectBuildBatchConfig structure that contains the batch build configuration overides for this build.

    combineArtifacts

    A boolean that specifies if the build artifacts for the batch build should be combined into a single artifact location.

    allowedComputeTypes

    An array of strings that specify the compute types that are allowed for the batch build. See Build environment compute types for these values.

    maximumBuildsAllowed

    Specifies the maximum number of builds allowed.

    batchServiceRole

    Specifies the service role ARN for the batch build project.

    batchTimeout

    Specifies the maximum amount of time, in minutes, that the batch build must be completed in.

  5. Switch to the directory that contains the file you just saved, and run the start-build-batch command again.

    aws codebuild start-build-batch --cli-input-json file://start-build.json
  6. If successful, the JSON representation of a BuildBatch object appears in the console output. See the StartBuildBatch Response Syntax for an example of this data.