You can use the AWS CodeBuild console, AWS CLI, or AWS SDKs to create a build project.
Before creating a build project, answer the questions inPlan a build.
Open the AWS CodeBuild console athttps://console.aws.amazon.com/codesuite/codebuild/home.
If a CodeBuild information page is displayed, chooseCreate build project. Otherwise, on the navigation pane, expandBuild, chooseBuild projects, and then chooseCreate build project.
ChooseCreate build project.
Fill in the following sections. Once complete, chooseCreate build project at the bottom of the page.
Enter a name for this build project. Build project names must be unique across each AWS account.
Enter an optional description of the build project to help other users understand what this project is used for.
(Optional) SelectEnable build badge to make your project's build status visible and embeddable. For more information, seeBuild badges sample.
Build badge does not apply if your source provider is Amazon S3.
(Optional) If you want to limit the number of concurrent builds for this project, perform the following steps:
SelectRestrict number of concurrent builds this project can start.
InConcurrent build limit, enter the maximum number of concurrent builds that are allowed for this project. This limit cannot be greater than the concurrent build limit set for the account. If you try to enter a number greater than the account limit, an error message is displayed.
New builds are only started if the current number of builds is less than or equal to this limit. If the current build count meets this limit, new builds are throttled and are not run.
(Optional) ForTags, enter the name and value of any tags that you want supporting AWS services to use. UseAdd row to add a tag. You can add up to 50 tags.
Choose the source code provider type. Use the following lists to make selections appropriate for your source provider:
CodeBuild does not support Bitbucket Server.
Choose the name of the input bucket that contains the source code.
Enter the name of the ZIP file or the path to the folder that contains the source code. Enter a forward slash (/) to download everything in the S3 bucket.
Enter the version ID of the object that represents the build of your input file. For more information, seeSource version sample with AWS CodeBuild.
Choose the repository you want to use.
ChooseBranch,Git tag, orCommit ID to specify the version of your source code. For more information, seeSource version sample with AWS CodeBuild.
We recommend that you choose Git branch names that don't look like commit IDs, such as811dd1ba1aba14473856cee38308caed7190c0d
or5392f7
. This helps you avoid Git checkout collisions with actual commits.
Choose to create a shallow clone with a history truncated to the specified number of commits. If you want a full clone, chooseFull.
SelectUse Git submodules if you want to include Git submodules in your repository.
ChooseDefault source credential orCustom source credential and follow the instructions to manage the default source credential or customize the source credential.
ChooseCodeConnections,OAuth,App password, orPersonal access token to connect to CodeBuild.
Select a Bitbucket connection or a Secrets Manager secret to connect through your specified connection type.
ChooseRepository in my Bitbucket account orPublic repository and enter the repository URL.
Enter a branch, commit ID, tag, or reference and a commit ID. For more information, seeSource version sample with AWS CodeBuild
We recommend that you choose Git branch names that don't look like commit IDs, such as811dd1ba1aba14473856cee38308caed7190c0d
or5392f7
. This helps you avoid Git checkout collisions with actual commits.
ChooseGit clone depth to create a shallow clone with a history truncated to the specified number of commits. If you want a full clone, chooseFull.
SelectUse Git submodules if you want to include Git submodules in your repository.
SelectReport build statuses to source provider when your builds start and finish if you want the status of your build's start and completion reported to your source provider.
To be able to report the build status to the source provider, the user associated with the source provider must have write access to the repo. If the user does not have write access, the build status cannot be updated. For more information, seeSource provider access.
ForStatus context, enter the value to be used for thename
parameter in the Bitbucket commit status. For more information, seebuild in the Bitbucket API documentation.
ForTarget URL, enter the value to be used for theurl
parameter in the Bitbucket commit status. For more information, seebuild in the Bitbucket API documentation.
The status of a build triggered by a webhook is always reported to the source provider. To have the status of a build that is started from the console or an API call reported to the source provider, you must select this setting.
If your project's builds are triggered by a webhook, you must push a new commit to the repo for a change to this setting to take effect.
InPrimary source webhook events, selectRebuild every time a code change is pushed to this repository if you want CodeBuild to build the source code every time a code change is pushed to this repository. For more information about webhooks and filter groups, seeBitbucket webhook events.
ChooseDefault source credential orCustom source credential and follow the instructions to manage the default source credential or customize the source credential.
ChooseGitHub App,OAuth, orPersonal access token to connect to CodeBuild.
Select a GitHub connection or a Secrets Manager secret to connect through your specified connection type.
ChooseRepository in my GitHub account,Public repository, orGitHub scoped webhook and enter the repository URL.
Enter a branch, commit ID, tag, or reference and a commit ID. For more information, seeSource version sample with AWS CodeBuild
We recommend that you choose Git branch names that don't look like commit IDs, such as811dd1ba1aba14473856cee38308caed7190c0d
or5392f7
. This helps you avoid Git checkout collisions with actual commits.
ChooseGit clone depth to create a shallow clone with a history truncated to the specified number of commits. If you want a full clone, chooseFull.
SelectUse Git submodules if you want to include Git submodules in your repository.
SelectReport build statuses to source provider when your builds start and finish if you want the status of your build's start and completion reported to your source provider.
To be able to report the build status to the source provider, the user associated with the source provider must have write access to the repo. If the user does not have write access, the build status cannot be updated. For more information, seeSource provider access.
ForStatus context, enter the value to be used for thecontext
parameter in the GitHub commit status. For more information, seeCreate a commit status in the GitHub developer guide.
ForTarget URL, enter the value to be used for thetarget_url
parameter in the GitHub commit status. For more information, seeCreate a commit status in the GitHub developer guide.
The status of a build triggered by a webhook is always reported to the source provider. To have the status of a build that is started from the console or an API call reported to the source provider, you must select this setting.
If your project's builds are triggered by a webhook, you must push a new commit to the repo for a change to this setting to take effect.
InPrimary source webhook events, selectRebuild every time a code change is pushed to this repository if you want CodeBuild to build the source code every time a code change is pushed to this repository. For more information about webhooks and filter groups, seeGitHub webhook events.
ChooseDefault source credential orCustom source credential and follow the instructions to manage the default source credential or customize the source credential.
ChooseCodeConnections orPersonal access token to connect to CodeBuild.
Select a GitHub Enterprise connection or a Secrets Manager secret to connect through your specified connection type.
ChooseRepository in my GitHub Enterprise account orGitHub Enterprise scoped webhook and enter the repository URL.
Enter a pull request, branch, commit ID, tag, or reference and a commit ID. For more information, seeSource version sample with AWS CodeBuild.
We recommend that you choose Git branch names that don't look like commit IDs, such as811dd1ba1aba14473856cee38308caed7190c0d
or5392f7
. This helps you avoid Git checkout collisions with actual commits.
ChooseGit clone depth to create a shallow clone with a history truncated to the specified number of commits. If you want a full clone, chooseFull.
SelectUse Git submodules if you want to include Git submodules in your repository.
SelectReport build statuses to source provider when your builds start and finish if you want the status of your build's start and completion reported to your source provider.
To be able to report the build status to the source provider, the user associated with the source provider must have write access to the repo. If the user does not have write access, the build status cannot be updated. For more information, seeSource provider access.
ForStatus context, enter the value to be used for thecontext
parameter in the GitHub commit status. For more information, seeCreate a commit status in the GitHub developer guide.
ForTarget URL, enter the value to be used for thetarget_url
parameter in the GitHub commit status. For more information, seeCreate a commit status in the GitHub developer guide.
The status of a build triggered by a webhook is always reported to the source provider. To have the status of a build that is started from the console or an API call reported to the source provider, you must select this setting.
If your project's builds are triggered by a webhook, you must push a new commit to the repo for a change to this setting to take effect.
SelectEnable insecure SSL to ignore SSL warnings while connecting to your GitHub Enterprise project repository.
InPrimary source webhook events, selectRebuild every time a code change is pushed to this repository if you want CodeBuild to build the source code every time a code change is pushed to this repository. For more information about webhooks and filter groups, seeGitHub webhook events.
ChooseDefault source credential orCustom source credential and follow the instructions to manage the default source credential or customize the source credential.
CodeConnections is used to connect GitLab to CodeBuild.
Select a GitLab connection to connect through CodeConnections.
Choose the repository you want to use.
Enter a pull request ID, branch, commit ID, tag, or reference and a commit ID. For more information, seeSource version sample with AWS CodeBuild.
We recommend that you choose Git branch names that don't look like commit IDs, such as811dd1ba1aba14473856cee38308caed7190c0d
or5392f7
. This helps you avoid Git checkout collisions with actual commits.
ChooseGit clone depth to create a shallow clone with a history truncated to the specified number of commits. If you want a full clone, chooseFull.
SelectReport build statuses to source provider when your builds start and finish if you want the status of your build's start and completion reported to your source provider.
To be able to report the build status to the source provider, the user associated with the source provider must have write access to the repo. If the user does not have write access, the build status cannot be updated. For more information, seeSource provider access.
ChooseDefault source credential orCustom source credential and follow the instructions to manage the default source credential or customize the source credential.
CodeConnections is used to connect GitLab Self Managed to CodeBuild.
Select a GitLab Self Managed connection to connect through CodeConnections.
Choose the repository you want to use.
Enter a pull request ID, branch, commit ID, tag, or reference and a commit ID. For more information, seeSource version sample with AWS CodeBuild.
We recommend that you choose Git branch names that don't look like commit IDs, such as811dd1ba1aba14473856cee38308caed7190c0d
or5392f7
. This helps you avoid Git checkout collisions with actual commits.
ChooseGit clone depth to create a shallow clone with a history truncated to the specified number of commits. If you want a full clone, chooseFull.
SelectReport build statuses to source provider when your builds start and finish if you want the status of your build's start and completion reported to your source provider.
To be able to report the build status to the source provider, the user associated with the source provider must have write access to the repo. If the user does not have write access, the build status cannot be updated. For more information, seeSource provider access.
Do one of the following:
To use on-demand fleets managed by AWS CodeBuild, chooseOn-demand. With on-demand fleets, CodeBuild provides compute for your builds. The machines are destroyed when the build finishes. On-demand fleets are fully managed, and includes automatic scaling capabilities to handle spikes in demand.
To use reserved capacity fleets managed by AWS CodeBuild, chooseReserved capacity, and then select aFleet name. With reserved capacity fleets, you configure a set of dedicated instances for your build environment. These machines remain idle, ready to process builds or tests immediately and reduces build durations. With reserved capacity fleets, your machines are always running and will continue to incur costs as long they're provisioned.
For information, seeRun builds on reserved capacity fleets.
Do one of the following:
To use a Docker image managed by AWS CodeBuild, chooseManaged image, and then make selections fromOperating system,Runtime(s),Image, andImage version. Make a selection fromEnvironment type if it is available.
To use another Docker image, chooseCustom image. ForEnvironment type, chooseARM,Linux,Linux GPU, orWindows. If you chooseOther registry, forExternal registry URL, enter the name and tag of the Docker image in Docker Hub, using the format
. If you chooseAmazon ECR, useAmazon ECR repository andAmazon ECR image to choose the Docker image in your AWS account.docker repository
/docker image name
To use a private Docker image, chooseCustom image. ForEnvironment type, chooseARM,Linux,Linux GPU, orWindows. ForImage registry, chooseOther registry, and then enter the ARN of the credentials for your private Docker image. The credentials must be created by Secrets Manager. For more information, seeWhat Is AWS Secrets Manager? in theAWS Secrets Manager User Guide.
CodeBuild overrides theENTRYPOINT
for custom Docker images.
Do one of the following:
To use EC2 compute, chooseEC2. EC2 compute offers optimized flexibility during action runs.
To use Lambda compute, chooseLambda. Lambda compute offers optimized start-up speeds for your builds. Lambda supports faster builds due to a lower start-up latency. Lambda also automatically scales, so builds aren’t waiting in queue to run. For information, seeRun builds on AWS Lambda compute.
Do one of the following:
If you do not have a CodeBuild service role, chooseNew service role. InRole name, enter a name for the new role.
If you have a CodeBuild service role, chooseExisting service role. InRole ARN, choose the service role.
When you use the console to create a build project, you can create a CodeBuild service role at the same time. By default, the role works with that build project only. If you use the console to associate this service role with another build project, the role is updated to work with the other build project. A service role can work with up to 10 build projects.
Specify the number of additional automatic retries after a failed build. For example, if the auto-retry limit is set to 2, CodeBuild will call theRetryBuild
API to automatically retry your build for up to 2 additional times.
Specify a value, between 5 minutes and 36 hours, after which CodeBuild stops the build if it is not complete. Ifhours andminutes are left blank, the default value of 60 minutes is used.
(Optional) SelectEnable this flag if you want to build Docker images or want your builds to get elevated privileges only if you plan to use this build project to build Docker images. Otherwise, all associated builds that attempt to interact with the Docker daemon fail. You must also start the Docker daemon so that your builds can interact with it. One way to do this is to initialize the Docker daemon in theinstall
phase of your build spec by running the following build commands. Do not run these commands if you chose a build environment image provided by CodeBuild with Docker support.
By default, Docker daemon is enabled for non-VPC builds. If you would like to use Docker containers for VPC builds, seeRuntime Privilege and Linux Capabilities on the Docker Docs website and enable privileged mode. Also, Windows does not support privileged mode.
- nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 &- timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
If you want CodeBuild to work with your VPC:
ForVPC, choose the VPC ID that CodeBuild uses.
ForVPC Subnets, choose the subnets that include resources that CodeBuild uses.
ForVPC Security groups, choose the security groups that CodeBuild uses to allow access to resources in the VPCs.
For more information, seeUse AWS CodeBuild with Amazon Virtual Private Cloud.
Choose one of the available options.
Specify a registry credential when the project is configured with a non-private registry image.
This credential will only be utilized if the images are overridden with those from private registries.
Enter the name and value, and then choose the type of each environment variable for builds to use.
CodeBuild sets the environment variable for your AWS Region automatically. You must set the following environment variables if you haven't added them to your buildspec.yml:
AWS_ACCOUNT_ID
IMAGE_REPO_NAME
IMAGE_TAG
Console and AWS CLI users can see environment variables. If you have no concerns about the visibility of your environment variable, set theName andValue fields, and then setType toPlaintext.
We recommend that you store an environment variable with a sensitive value, such as an AWS access key ID, an AWS secret access key, or a password as a parameter in Amazon EC2 Systems Manager Parameter Store or AWS Secrets Manager.
If you use Amazon EC2 Systems Manager Parameter Store, then forType, chooseParameter. ForName, enter an identifier for CodeBuild to reference. ForValue, enter the parameter's name as stored in Amazon EC2 Systems Manager Parameter Store. Using a parameter named/CodeBuild/dockerLoginPassword
as an example, forType, chooseParameter. ForName, enterLOGIN_PASSWORD
. ForValue, enter/CodeBuild/dockerLoginPassword
.
If you use Amazon EC2 Systems Manager Parameter Store, we recommend that you store parameters with parameter names that start with/CodeBuild/
(for example,/CodeBuild/dockerLoginPassword
). You can use the CodeBuild console to create a parameter in Amazon EC2 Systems Manager. ChooseCreate parameter, and then follow the instructions in the dialog box. (In that dialog box, forKMS key, you can specify the ARN of an AWS KMS key in your account. Amazon EC2 Systems Manager uses this key to encrypt the parameter's value during storage and decrypt it during retrieval.) If you use the CodeBuild console to create a parameter, the console starts the parameter name with/CodeBuild/
as it is being stored. For more information, seeSystems Manager Parameter Store andSystems Manager Parameter Store Console Walkthrough in theAmazon EC2 Systems Manager User Guide.
If your build project refers to parameters stored in Amazon EC2 Systems Manager Parameter Store, the build project's service role must allow thessm:GetParameters
action. If you choseNew service role earlier, CodeBuild includes this action in the default service role for your build project. However, if you choseExisting service role, you must include this action to your service role separately.
If your build project refers to parameters stored in Amazon EC2 Systems Manager Parameter Store with parameter names that do not start with/CodeBuild/
, and you choseNew service role, you must update that service role to allow access to parameter names that do not start with/CodeBuild/
. This is because that service role allows access only to parameter names that start with/CodeBuild/
.
If you chooseNew service role, the service role includes permission to decrypt all parameters under the/CodeBuild/
namespace in the Amazon EC2 Systems Manager Parameter Store.
Environment variables you set replace existing environment variables. For example, if the Docker image already contains an environment variable namedMY_VAR
with a value ofmy_value
, and you set an environment variable namedMY_VAR
with a value ofother_value
, thenmy_value
is replaced byother_value
. Similarly, if the Docker image already contains an environment variable namedPATH
with a value of/usr/local/sbin:/usr/local/bin
, and you set an environment variable namedPATH
with a value of$PATH:/usr/share/ant/bin
, then/usr/local/sbin:/usr/local/bin
is replaced by the literal value$PATH:/usr/share/ant/bin
.
Do not set any environment variable with a name that begins withCODEBUILD_
. This prefix is reserved for internal use.
If an environment variable with the same name is defined in multiple places, the value is determined as follows:
The value in the start build operation call takes highest precedence.
The value in the build project definition takes next precedence.
The value in the buildspec declaration takes lowest precedence.
If you use Secrets Manager, forType, chooseSecrets Manager. ForName, enter an identifier for CodeBuild to reference. ForValue, enter areference-key
using the pattern
. For information, seeSecrets Manager reference-key in the buildspec file.secret-id
:json-key
:version-stage
:version-id
If you use Secrets Manager, we recommend that you store secrets with names that start with/CodeBuild/
(for example,/CodeBuild/dockerLoginPassword
). For more information, seeWhat Is AWS Secrets Manager? in theAWS Secrets Manager User Guide.
If your build project refers to secrets stored in Secrets Manager, the build project's service role must allow thesecretsmanager:GetSecretValue
action. If you choseNew service role earlier, CodeBuild includes this action in the default service role for your build project. However, if you choseExisting service role, you must include this action to your service role separately.
If your build project refers to secrets stored in Secrets Manager with secret names that do not start with/CodeBuild/
, and you choseNew service role, you must update the service role to allow access to secret names that do not start with/CodeBuild/
. This is because the service role allows access only to secret names that start with/CodeBuild/
.
If you chooseNew service role, the service role includes permission to decrypt all secrets under the/CodeBuild/
namespace in the Secrets Manager.
Do one of the following:
If your source code includes a buildspec file, chooseUse a buildspec file. By default, CodeBuild looks for a file namedbuildspec.yml
in the source code root directory. If your buildspec file uses a different name or location, enter its path from the source root inBuildspec name (for example,buildspec-two.yml
orconfiguration/buildspec.yml
. If the buildspec file is in an S3 bucket, it must be in the same AWS Region as your build project. Specify the buildspec file using its ARN (for example,arn:aws:s3:::
).<my-codebuild-sample2>
/buildspec.yml
If your source code does not include a buildspec file, or if you want to run build commands different from the ones specified for thebuild
phase in thebuildspec.yml
file in the source code's root directory, chooseInsert build commands. ForBuild commands, enter the commands you want to run in thebuild
phase. For multiple commands, separate each command by&&
(for example,mvn test && mvn package
). To run commands in other phases, or if you have a long list of commands for thebuild
phase, add abuildspec.yml
file to the source code root directory, add the commands to the file, and then chooseUse the buildspec.yml in the source code root directory.
For more information, see theBuildspec reference.
You can run a group of builds as a single operation. For more information, seeRun builds in batches.
Select to allow batch builds in this project.
Provides the service role for batch builds.
Choose one of the following:
If you do not have a batch service role, chooseNew service role. InService role, enter a name for the new role.
If you have a batch service role, chooseExisting service role. InService role, choose the service role.
Batch builds introduce a new security role in the batch configuration. This new role is required as CodeBuild must be able to call theStartBuild
,StopBuild
, andRetryBuild
actions on your behalf to run builds as part of a batch. Customers should use a new role, and not the same role they use in their build, for two reasons:
Giving the build roleStartBuild
,StopBuild
, andRetryBuild
permissions would allow a single build to start more builds via the buildspec.
CodeBuild batch builds provide restrictions that restrict the number of builds and compute types that can be used for the builds in the batch. If the build role has these permissions, it is possible the builds themselves could bypass these restrictions.
Select the compute types allowed for the batch. Select all that apply.
Select the fleets allowed for the batch. Select all that apply.
Enter the maximum number of builds allowed in the batch. If a batch exceeds this limit, the batch will fail.
Enter the maximum amount of time for the batch build to complete.
SelectCombine all artifacts from batch into a single location to have all of the artifacts from the batch combined into a single location.
Select the desired build status report mode for batch builds.
This field is only available when the project source is Bitbucket, GitHub, or GitHub Enterprise, andReport build statuses to source provider when your builds start and finish is selected underSource.
Select to have the statuses for all builds in the batch combined into a single status report.
Select to have the build statuses for all builds in the batch reported separately.
Do one of the following:
If you do not want to create any build output artifacts, chooseNo artifacts. You might want to do this if you're only running build tests or you want to push a Docker image to an Amazon ECR repository.
To store the build output in an S3 bucket, chooseAmazon S3, and then do the following:
If you want to use your project name for the build output ZIP file or folder, leaveName blank. Otherwise, enter the name. (If you want to output a ZIP file, and you want the ZIP file to have a file extension, be sure to include it after the ZIP file name.)
SelectEnable semantic versioning if you want a name specified in the buildspec file to override any name that is specified in the console. The name in a buildspec file is calculated at build time and uses the Shell command language. For example, you can append a date and time to your artifact name so that it is always unique. Unique artifact names prevent artifacts from being overwritten. For more information, seeBuildspec syntax.
ForBucket name, choose the name of the output bucket.
If you choseInsert build commands earlier in this procedure, then forOutput files, enter the locations of the files from the build that you want to put into the build output ZIP file or folder. For multiple locations, separate each location with a comma (for example,appspec.yml, target/my-app.jar
). For more information, see the description offiles
inBuildspec syntax.
If you do not want your build artifacts encrypted, selectRemove artifacts encryption.
For each secondary set of artifacts you want:
ForArtifact identifier, enter a value that is fewer than 128 characters and contains only alphanumeric characters and underscores.
ChooseAdd artifact.
Follow the previous steps to configure your secondary artifacts.
ChooseSave artifact.
(Optional) Do one of the following:
To use the AWS managed key for Amazon S3 in your account to encrypt the build output artifacts, leaveEncryption key blank. This is the default.
To use a customer managed key to encrypt the build output artifacts, inEncryption key, enter the ARN of the KMS key. Use the formatarn:aws:kms:
.region-ID
:account-ID
:key/key-ID
ForCache type, choose one of the following:
If you do not want to use a cache, chooseNo cache.
If you want to use an Amazon S3 cache, chooseAmazon S3, and then do the following:
ForBucket, choose the name of the S3 bucket where the cache is stored.
(Optional) ForCache path prefix, enter an Amazon S3 path prefix. TheCache path prefix value is similar to a directory name. It makes it possible for you to store the cache under the same directory in a bucket.
Do not append a trailing slash (/) to the end of the path prefix.
If you want to use a local cache, chooseLocal, and then choose one or more local cache modes.
Docker layer cache mode is available for Linux only. If you choose it, your project must run in privileged mode.
Using a cache saves considerable build time because reusable pieces of the build environment are stored in the cache and used across builds. For information about specifying a cache in the buildspec file, seeBuildspec syntax. For more information about caching, seeCache builds to improve performance.
Choose the logs you want to create. You can create Amazon CloudWatch Logs, Amazon S3 logs, or both.
If you want Amazon CloudWatch Logs logs:
SelectCloudWatch logs.
Enter the name of your Amazon CloudWatch Logs log group.
Enter your Amazon CloudWatch Logs log stream name.
If you want Amazon S3 logs:
SelectS3 logs.
Choose the name of the S3 bucket for your logs.
Enter the prefix for your logs.
Select if you do not want your S3 logs encrypted.
For more information about using the AWS CLI with CodeBuild, see theCommand line reference.
To create a CodeBuild build project using the AWS CLI, you create a JSON-formattedProject structure, fill in the structure, and call thecreate-project
command to create the project.
Create a skeleton JSON file with thecreate-project
command, using the--generate-cli-skeleton
option:
aws codebuild create-project --generate-cli-skeleton ><json-file>
This creates a JSON file with the path and file name specified by<json-file>
.
Modify the JSON data as follows and save your results.
{ "name": "<project-name>
", "description": "<description>
", "source":{ "type": "CODECOMMIT" | "CODEPIPELINE" | "GITHUB" | "GITHUB_ENTERPRISE" | "GITLAB" | "GITLAB_SELF_MANAGED" | "BITBUCKET" | "S3" | "NO_SOURCE", "location": "<source-location>
", "gitCloneDepth": "<git-clone-depth>
", "buildspec": "<buildspec>
", "InsecureSsl": "<insecure-ssl>
", "reportBuildStatus": "<report-build-status>
", "buildStatusConfig":{ "context": "<context>
", "targetUrl": "<target-url>
" }, "gitSubmodulesConfig":{ "fetchSubmodules": "<fetch-submodules>
" }, "auth":{ "type": "<auth-type>
", "resource": "<auth-resource>
" }, "sourceIdentifier": "<source-identifier>
" }, "secondarySources": [{ "type": "CODECOMMIT" | "CODEPIPELINE" | "GITHUB" | "GITHUB_ENTERPRISE" | "GITLAB" | "GITLAB_SELF_MANAGED" | "BITBUCKET" | "S3" | "NO_SOURCE", "location": "<source-location>
", "gitCloneDepth": "<git-clone-depth>
", "buildspec": "<buildspec>
", "InsecureSsl": "<insecure-ssl>
", "reportBuildStatus": "<report-build-status>
", "auth":{ "type": "<auth-type>
", "resource": "<auth-resource>
" }, "sourceIdentifier": "<source-identifier>
" } ], "secondarySourceVersions": [{ "sourceIdentifier": "<secondary-source-identifier>
", "sourceVersion": "<secondary-source-version>
" } ], "sourceVersion": "<source-version>"
, "artifacts":{ "type": "CODEPIPELINE" | "S3" | "NO_ARTIFACTS", "location": "<artifacts-location>
", "path": "<artifacts-path>
", "namespaceType": "<artifacts-namespacetype>
", "name": "<artifacts-name>
", "overrideArtifactName": "<override-artifact-name>
", "packaging": "<artifacts-packaging>
" }, "secondaryArtifacts": [{ "type": "CODEPIPELINE" | "S3" | "NO_ARTIFACTS", "location": "<secondary-artifact-location>
", "path": "<secondary-artifact-path>
", "namespaceType": "<secondary-artifact-namespaceType>
", "name": "<secondary-artifact-name>
", "packaging": "<secondary-artifact-packaging>
", "artifactIdentifier": "<secondary-artifact-identifier>
" } ], "cache":{ "type": "<cache-type>
", "location": "<cache-location>
", "mode": [ "<cache-mode>
" ] }, "environment":{ "type": "LINUX_CONTAINER" | "LINUX_GPU_CONTAINER" | "ARM_CONTAINER" | "WINDOWS_SERVER_2019_CONTAINER" | "WINDOWS_SERVER_2022_CONTAINER", "image": "<image>
", "computeType": "BUILD_GENERAL1_SMALL" | "BUILD_GENERAL1_MEDIUM" | "BUILD_GENERAL1_LARGE" | "BUILD_GENERAL1_2XLARGE", "certificate": "<certificate>
", "environmentVariables": [{ "name": "<environmentVariable-name>
", "value": "<environmentVariable-value>
", "type": "<environmentVariable-type>
" } ], "registryCredential": [{ "credential": "<credential-arn-or-name>
", "credentialProvider": "<credential-provider>
" } ], "imagePullCredentialsType": "CODEBUILD" | "SERVICE_ROLE", "privilegedMode": "<privileged-mode>
" }, "serviceRole": "<service-role>
", "autoRetryLimit":<auto-retry-limit>
, "timeoutInMinutes":<timeout>
, "queuedTimeoutInMinutes":<queued-timeout>
, "encryptionKey": "<encryption-key>
", "tags": [{ "key": "<tag-key>
", "value": "<tag-value>
" } ], "vpcConfig":{ "securityGroupIds": [ "<security-group-id>
" ], "subnets": [ "<subnet-id>
" ], "vpcId": "<vpc-id>
" }, "badgeEnabled": "<badge-enabled>
", "logsConfig":{ "cloudWatchLogs":{ "status": "<cloudwatch-logs-status>
", "groupName": "<group-name>
", "streamName": "<stream-name>
" }, "s3Logs":{ "status": "<s3-logs-status>
", "location": "<s3-logs-location>
", "encryptionDisabled": "<s3-logs-encryption-disabled>
" } }, "fileSystemLocations": [{ "type": "EFS", "location": "<EFS-DNS-name-1>
:/<directory-path>
", "mountPoint": "<mount-point>
", "identifier": "<efs-identifier>
", "mountOptions": "<efs-mount-options>
" } ], "buildBatchConfig":{ "serviceRole": "<batch-service-role>
", "combineArtifacts":<combine-artifacts>
, "restrictions":{ "maximumBuildsAllowed":<max-builds>
, "computeTypesAllowed": [ "<compute-type>
" ], "fleetsAllowed": [ "<fleet-name>
" ] }, "timeoutInMins":<batch-timeout>
, "batchReportMode": "REPORT_AGGREGATED_BATCH" | "REPORT_INDIVIDUAL_BUILDS" }, "concurrentBuildLimit":<concurrent-build-limit>
}
Replace the following:
Required. The name for this build project. This name must be unique across all of the build projects in your AWS account.
Optional. The description for this build project.
Required. AProjectSource object that contains information about this build project's source code settings. After you add asource
object, you can add up to 12 more sources using thesecondarySources. These settings include the following:
Required. The type of repository that contains the source code to build. Valid values include:
CODECOMMIT
CODEPIPELINE
GITHUB
GITHUB_ENTERPRISE
GITLAB
GITLAB_SELF_MANAGED
BITBUCKET
S3
NO_SOURCE
If you useNO_SOURCE
, the buildspec cannot be a file because the project does not have a source. Instead, you must use thebuildspec
attribute to specify a YAML-formatted string for your buildspec. For more information, seeCreate a build project without a source.
Required unless you set<source-type>
toCODEPIPELINE
. The location of the source code for the specified repository type.
For CodeCommit, the HTTPS clone URL to the repository that contains the source code and the buildspec file (for example,https://git-codecommit.
).<region-id>
.amazonaws.com/v1/repos/<repo-name>
For Amazon S3, the build input bucket name, followed by the path and name of the ZIP file that contains the source code and the buildspec. For example:
For a ZIP file located at the root of the input bucket:
.<bucket-name>
/<object-name>
.zip
For a ZIP file located in a subfolder in the input bucket:
.<bucket-name>
/<subfoler-path>
/<object-name>
.zip
For GitHub, the HTTPS clone URL to the repository that contains the source code and the buildspec file. The URL must contain github.com. You must connect your AWS account to your GitHub account. To do this, use the CodeBuild console to create a build project.
ChooseAuthorize application. (After you have connected to your GitHub account, you do not need to finish creating the build project. You can close the CodeBuild console.)
For GitHub Enterprise Server, the HTTP or HTTPS clone URL to the repository that contains the source code and the buildspec file. You must also connect your AWS account to your GitHub Enterprise Server account. To do this, use the CodeBuild console to create a build project.
Create a personal access token in GitHub Enterprise Server.
Copy this token to your clipboard so you can use it when you create your CodeBuild project. For more information, seeCreating a personal access token for the command line on the GitHub Help website.
When you use the console to create your CodeBuild project, inSource, forSource provider, chooseGitHub Enterprise.
ForPersonal Access Token, paste the token that was copied to your clipboard. ChooseSave Token. Your CodeBuild account is now connected to your GitHub Enterprise Server account.
For GitLab and GitLab self-managed, the HTTPS clone URL to the repository that contains the source code and the buildspec file. Note that if you use GitLab, the URL must contain gitlab.com. If you use GitLab self-managed, the URL does not need to contain gitlab.com. You must connect your AWS account to your GitLab or GitLab self-managed account. To do this, use the CodeBuild console to create a build project.
In the Developer Tools navigation pane, chooseSettings,Connections, and thenCreate connection. On this page, create either a GitLab or GitLab self-managed connection, and then chooseConnect to GitLab.
For Bitbucket, the HTTPS clone URL to the repository that contains the source code and the buildspec file. The URL must contain bitbucket.org. You must also connect your AWS account to your Bitbucket account. To do this, use the CodeBuild console to create a build project.
When you use the console to connect (or reconnect) with Bitbucket, on the BitbucketConfirm access to your account page, chooseGrant access. (After you have connected to your Bitbucket account, you do not need to finish creating the build project. You can close the CodeBuild console.)
For AWS CodePipeline, do not specify alocation
value forsource
. CodePipeline ignores this value because when you create a pipeline in CodePipeline, you specify the source code location in the Source stage of the pipeline.
Optional. The depth of history to download. Minimum value is 0. If this value is 0, greater than 25, or not provided, then the full history is downloaded with each build project. If your source type is Amazon S3, this value is not supported.
Optional. The build specification definition or file to use. If this value is not provided or is set to an empty string, the source code must contain abuildspec.yml
file in its root directory. If this value is set, it can be either an inline buildspec definition, the path to an alternate buildspec file relative to the root directory of your primary source, or the path to an S3 bucket. The bucket must be in the same AWS Region as the build project. Specify the buildspec file using its ARN (for example,arn:aws:s3:::
). For more information, seeBuildspec file name and storage location.<my-codebuild-sample2>
/buildspec.yml
Contains information about the authorization settings for CodeBuild to access the source code to be built.
Required. The authorization type to use. Valid values are:
OAUTH
CODECONNECTIONS
SECRETS_MANAGER
Optional. The resource value that applies to the specified authorization type. This can be the Secrets Manager ARN or the CodeConnections ARN.
Specifies whether to send your source provider the status of a build's start and completion. If you set this with a source provider other than GitHub, GitHub Enterprise Server, or Bitbucket, aninvalidInputException
is thrown.
To be able to report the build status to the source provider, the user associated with the source provider must have write access to the repo. If the user does not have write access, the build status cannot be updated. For more information, seeSource provider access.
Contains information that defines how the CodeBuild build project reports the build status to the source provider. This option is only used when the source type isGITHUB
,GITHUB_ENTERPRISE
, orBITBUCKET
.
For Bitbucket sources, this parameter is used for thename
parameter in the Bitbucket commit status. For GitHub sources, this parameter is used for thecontext
parameter in the GitHub commit status.
For example, you can have thecontext
contain the build number and the webhook trigger using the CodeBuild environment variables:
AWS CodeBuild sample-project Build #$CODEBUILD_BUILD_NUMBER - $CODEBUILD_WEBHOOK_TRIGGER
This results in the context appearing like this for build #24 triggered by a webhook pull request event:
AWS CodeBuild sample-project Build #24 - pr/8
For Bitbucket sources, this parameter is used for theurl
parameter in the Bitbucket commit status. For GitHub sources, this parameter is used for thetarget_url
parameter in the GitHub commit status.
For example, you can set thetargetUrl
tohttps://aws.amazon.com/codebuild/
and the commit status will link to this URL.<path to build>
You can also include CodeBuild environment variables in thetargetUrl
to add additional information to the URL. For example, to add the build region to the URL, set thetargetUrl
to:
"targetUrl": "https://aws.amazon.com/codebuild/<path to build>
?region=$AWS_REGION"
If the build region isus-east-2
, this will expand to:
https://aws.amazon.com/codebuild/<path to build>
?region=us-east-2
Optional. Information about the Git submodules configuration. Used with CodeCommit, GitHub, GitHub Enterprise Server, and Bitbucket only.
SetfetchSubmodules
totrue
if you want to include the Git submodules in your repository. Git submodules that are included must be configured as HTTPS.
Optional. Used with GitHub Enterprise Server only. Set this value totrue
to ignore TLS warnings while connecting to your GitHub Enterprise Server project repository. The default value isfalse
.InsecureSsl
should be used for testing purposes only. It should not be used in a production environment.
A user-defined identifier for the project source. Optional for the primary source. Required for secondary sources.
Optional. An array ofProjectSource objects that contain information about the secondary sources for a build project. You can add up to 12 secondary sources. ThesecondarySources
objects use the same properties used by thesource object. In a secondary source object, thesourceIdentifier
is required.
Optional. An array ofProjectSourceVersion objects. IfsecondarySourceVersions
is specified at the build level, then they take precedence over this.
Optional. The version of the build input to be built for this project. If not specified, the latest version is used. If specified, it must be one of:
For CodeCommit, the commit ID, branch, or Git tag to use.
For GitHub, the commit ID, pull request ID, branch name, or tag name that corresponds to the version of the source code you want to build. If a pull request ID is specified, it must use the formatpr/pull-request-ID
(for examplepr/25
). If a branch name is specified, the branch's HEAD commit ID is used. If not specified, the default branch's HEAD commit ID is used.
For GitLab, the commit ID, pull request ID, branch name, tag name, or reference and a commit ID. For more information, seeSource version sample with AWS CodeBuild.
For Bitbucket, the commit ID, branch name, or tag name that corresponds to the version of the source code you want to build. If a branch name is specified, the branch's HEAD commit ID is used. If not specified, the default branch's HEAD commit ID is used.
For Amazon S3, the version ID of the object that represents the build input ZIP file to use.
IfsourceVersion
is specified at the build level, then that version takes precedence over thissourceVersion
(at the project level). For more information, seeSource version sample with AWS CodeBuild.
Required. AProjectArtifacts object that contains information about this build project's output artifact settings. After you add anartifacts
object, you can add up to 12 more artifacts using thesecondaryArtifacts. These settings include the following:
Required. The type of build output artifact. Valid values are:
CODEPIPELINE
NO_ARTIFACTS
S3
Only used with theS3
artifact type. Not used for other artifact types.
The name of the output bucket you created or identified in the prerequisites.
Only used with theS3
artifact type. Not used for other artifact types.
The path in of the output bucket to place ZIP file or folder. If you do not specify a value forpath
, CodeBuild usesnamespaceType
(if specified) andname
to determine the path and name of the build output ZIP file or folder. For example, if you specifyMyPath
forpath
andMyArtifact.zip
forname
, the path and name would beMyPath/MyArtifact.zip
.
Only used with theS3
artifact type. Not used for other artifact types.
The namespace of the build output ZIP file or folder. Valid values includeBUILD_ID
andNONE
. UseBUILD_ID
to insert the build ID into the path of the build output ZIP file or folder. Otherwise, useNONE
. If you do not specify a value fornamespaceType
, CodeBuild usespath
(if specified) andname
to determine the path and name of the build output ZIP file or folder. For example, if you specifyMyPath
forpath
,BUILD_ID
fornamespaceType
, andMyArtifact.zip
forname
, the path and name would beMyPath/
.build-ID
/MyArtifact.zip
Only used with theS3
artifact type. Not used for other artifact types.
The name of the build output ZIP file or folder inside oflocation
. For example, if you specifyMyPath
forpath
andMyArtifact.zip
forname
, the path and name would beMyPath/MyArtifact.zip
.
Only used with the S3 artifact type. Not used for other artifact types.
Optional. If set totrue
, the name specified in theartifacts
block of the buildspec file overridesname
. For more information, seeBuild specification reference for CodeBuild.
Only used with theS3
artifact type. Not used for other artifact types.
Optional. Specifies how to package the artifacts. Allowed values are:
Create a folder that contains the build artifacts. This is the default value.
Create a ZIP file that contains the build artifacts.
Optional. An array ofProjectArtifacts objects that contain information about the secondary artifacts settings for a build project. You can add up to 12 secondary artifacts. ThesecondaryArtifacts
uses many of the same settings used by theartifacts object.
Required. AProjectCache object that contains information about this build project's cache settings. For more information, seeCache builds.
Required. AProjectEnvironment object that contains information about this project's build environment settings. These settings include:
Required. The type of build environment. For more information, seetype in theCodeBuild API Reference.
Required. The Docker image identifier used by this build environment. Typically, this identifier is expressed asimage-name
:tag
. For example, in the Docker repository that CodeBuild uses to manage its Docker images, this could beaws/codebuild/standard:5.0
. In Docker Hub,maven:3.3.9-jdk-8
. In Amazon ECR,
. For more information, seeDocker images provided by CodeBuild.account-id
.dkr.ecr.region-id
.amazonaws.com/your-Amazon-ECR-repo-name
:tag
Required. Specifies the compute resources used by this build environment. For more information, seecomputeType in theCodeBuild API Reference.
Optional. The ARN of the Amazon S3 bucket, path prefix, and object key that contains the PEM-encoded certificate. The object key can be either just the .pem file or a .zip file containing the PEM-encoded certificate. For example, if your Amazon S3 bucket name is
, your path prefix is<my-bucket>
, and your object key name is<cert>
, then acceptable formats for<certificate.pem>
certificate
are
or<my-bucket/cert/certificate.pem>
arn:aws:s3:::
.<my-bucket/cert/certificate.pem>
Optional. An array ofEnvironmentVariable objects that contains the environment variables you want to specify for this build environment. Each environment variable is expressed as an object that contains aname
,value
, andtype
ofname
,value
, andtype
.
Console and AWS CLI users can see all environment variables. If you have no concerns about the visibility of your environment variable, setname
andvalue
, and settype
toPLAINTEXT
.
We recommend you store environment variables with sensitive values, such as an AWS access key ID, an AWS secret access key, or a password, as a parameter in Amazon EC2 Systems Manager Parameter Store or AWS Secrets Manager. Forname
, for that stored parameter, set an identifier for CodeBuild to reference.
If you use Amazon EC2 Systems Manager Parameter Store, forvalue
, set the parameter's name as stored in the Parameter Store. Settype
toPARAMETER_STORE
. Using a parameter named/CodeBuild/dockerLoginPassword
as an example, setname
toLOGIN_PASSWORD
. Setvalue
to/CodeBuild/dockerLoginPassword
. Settype
toPARAMETER_STORE
.
If you use Amazon EC2 Systems Manager Parameter Store, we recommend that you store parameters with parameter names that start with/CodeBuild/
(for example,/CodeBuild/dockerLoginPassword
). You can use the CodeBuild console to create a parameter in Amazon EC2 Systems Manager. ChooseCreate parameter, and then follow the instructions in the dialog box. (In that dialog box, forKMS key, you can specify the ARN of an AWS KMS key in your account. Amazon EC2 Systems Manager uses this key to encrypt the parameter's value during storage and decrypt it during retrieval.) If you use the CodeBuild console to create a parameter, the console starts the parameter name with/CodeBuild/
as it is being stored. For more information, seeSystems Manager Parameter Store andSystems Manager Parameter Store Console Walkthrough in theAmazon EC2 Systems Manager User Guide.
If your build project refers to parameters stored in Amazon EC2 Systems Manager Parameter Store, the build project's service role must allow thessm:GetParameters
action. If you choseNew service role earlier, CodeBuild includes this action in the default service role for your build project. However, if you choseExisting service role, you must include this action to your service role separately.
If your build project refers to parameters stored in Amazon EC2 Systems Manager Parameter Store with parameter names that do not start with/CodeBuild/
, and you choseNew service role, you must update that service role to allow access to parameter names that do not start with/CodeBuild/
. This is because that service role allows access only to parameter names that start with/CodeBuild/
.
If you chooseNew service role, the service role includes permission to decrypt all parameters under the/CodeBuild/
namespace in the Amazon EC2 Systems Manager Parameter Store.
Environment variables you set replace existing environment variables. For example, if the Docker image already contains an environment variable namedMY_VAR
with a value ofmy_value
, and you set an environment variable namedMY_VAR
with a value ofother_value
, thenmy_value
is replaced byother_value
. Similarly, if the Docker image already contains an environment variable namedPATH
with a value of/usr/local/sbin:/usr/local/bin
, and you set an environment variable namedPATH
with a value of$PATH:/usr/share/ant/bin
, then/usr/local/sbin:/usr/local/bin
is replaced by the literal value$PATH:/usr/share/ant/bin
.
Do not set any environment variable with a name that begins withCODEBUILD_
. This prefix is reserved for internal use.
If an environment variable with the same name is defined in multiple places, the value is determined as follows:
The value in the start build operation call takes highest precedence.
The value in the build project definition takes next precedence.
The value in the buildspec declaration takes lowest precedence.
If you use Secrets Manager, forvalue
, set the parameter's name as stored in Secrets Manager. Settype
toSECRETS_MANAGER
. Using a secret named/CodeBuild/dockerLoginPassword
as an example, setname
toLOGIN_PASSWORD
. Setvalue
to/CodeBuild/dockerLoginPassword
. Settype
toSECRETS_MANAGER
.
If you use Secrets Manager, we recommend that you store secrets with names that start with/CodeBuild/
(for example,/CodeBuild/dockerLoginPassword
). For more information, seeWhat Is AWS Secrets Manager? in theAWS Secrets Manager User Guide.
If your build project refers to secrets stored in Secrets Manager, the build project's service role must allow thesecretsmanager:GetSecretValue
action. If you choseNew service role earlier, CodeBuild includes this action in the default service role for your build project. However, if you choseExisting service role, you must include this action to your service role separately.
If your build project refers to secrets stored in Secrets Manager with secret names that do not start with/CodeBuild/
, and you choseNew service role, you must update the service role to allow access to secret names that do not start with/CodeBuild/
. This is because the service role allows access only to secret names that start with/CodeBuild/
.
If you chooseNew service role, the service role includes permission to decrypt all secrets under the/CodeBuild/
namespace in the Secrets Manager.
Optional. ARegistryCredential object that specifies the credentials that provide access to a private Docker registry.
Specifies the ARN or name of credentials created using AWS Managed Services. You can use the name of the credentials only if they exist in your current Region.
The only valid value isSECRETS_MANAGER
.
When this is set:
imagePullCredentials
must be set toSERVICE_ROLE
.
The image cannot be a curated image or an Amazon ECR image.
Optional. The type of credentials CodeBuild uses to pull images in your build. There are two valid values:
CODEBUILD
specifies that CodeBuild uses its own credentials. You must edit your Amazon ECR repository policy to trust the CodeBuild service principal.
Specifies that CodeBuild uses your build project's service role.
When you use a cross-account or private registry image, you must useSERVICE_ROLE
credentials. When you use a CodeBuild curated image, you must useCODEBUILD
credentials.
Set totrue
only if you plan to use this build project to build Docker images. Otherwise, all associated builds that attempt to interact with the Docker daemon fail. You must also start the Docker daemon so that your builds can interact with it. One way to do this is to initialize the Docker daemon in theinstall
phase of your buildspec file by running the following build commands. Do not run these commands if you specified a build environment image provided by CodeBuild with Docker support.
By default, Docker daemon is enabled for non-VPC builds. If you would like to use Docker containers for VPC builds, seeRuntime Privilege and Linux Capabilities on the Docker Docs website and enable privileged mode. Also, Windows does not support privileged mode.
- nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2 &- timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
Required. The ARN of the service role CodeBuild uses to interact with services on behalf of the user (for example,arn:aws:iam::
).account-id
:role/role-name
Optional. The number of additional automatic retries after a failed build. For example, if the auto-retry limit is set to 2, CodeBuild will call theRetryBuild
API to automatically retry your build for up to 2 additional times.
Optional. The number of minutes, between 5 to 2160 (36 hours), after which CodeBuild stops the build if it is not complete. If not specified, the default of 60 is used. To determine if and when CodeBuild stopped a build due to a timeout, run thebatch-get-builds
command. To determine if the build has stopped, look in the output for abuildStatus
value ofFAILED
. To determine when the build timed out, look in the output for theendTime
value associated with aphaseStatus
value ofTIMED_OUT
.
Optional. The number of minutes, between 5 to 480 (8 hours), after which CodeBuild stops the build if it is is still queued. If not specified, the default of 60 is used.
Optional. The alias or ARN of the AWS KMS key used by CodeBuild to encrypt the build output. If you specify an alias, use the formatarn:aws:kms:
or, if an alias exists, use the formatregion-ID
:account-ID
:key/key-ID
alias/
. If not specified, the AWS-managed KMS key for Amazon S3 is used.key-alias
Optional. An array ofTag objects that provide the tags you want to associate with this build project. You can specify up to 50 tags. These tags can be used by any AWS service that supports CodeBuild build project tags. Each tag is expressed as an object with akey
and avalue
.
Optional. AVpcConfig object that contains information information about the VPC configuration for your project. For more information, seeUse AWS CodeBuild with Amazon Virtual Private Cloud.
These properties include:
Required. The VPC ID that CodeBuild uses. Run this command to get a list of all VPC IDs in your Region:
aws ec2 describe-vpcs --region<region-ID>
Required. An array of subnet IDs that include resources used by CodeBuild. Run this command to get these IDs:
aws ec2 describe-subnets --filters "Name=vpc-id,Values=<vpc-id>" --region<region-ID>
Required. An array of security group IDs used by CodeBuild to allow access to resources in the VPC. Run this command to get these IDs:
aws ec2 describe-security-groups --filters "Name=vpc-id,Values=<vpc-id>
" --<region-ID>
Optional. Specifies whether to include build badges with your CodeBuild project. Set totrue
to enable build badges, orfalse
otherwise. For more information, seeBuild badges sample with CodeBuild.
ALogsConfig object that contains information about where this build's logs are located.
ACloudWatchLogsConfig object that contains information about pushing logs to CloudWatch Logs.
AnS3LogsConfig object that contains information about pushing logs to Amazon S3.
Optional. An array ofProjectFileSystemsLocation objects that contains informationabout your Amazon EFS configuration.
Optional. ThebuildBatchConfig
object is aProjectBuildBatchConfig structure that contains the batch build configuration information for the project.
The service role ARN for the batch build project.
A Boolean value that specifies whether to combine the build artifacts for the batch build into a single artifact location.
The maximum number of builds allowed.
An array of strings that specify the compute types that are allowed for the batch build. SeeBuild environment compute types for these values.
An array of strings that specify the fleets that are allowed for the batch build. SeeRun builds on reserved capacity fleets for more information.
The maximum amount of time, in minutes, that the batch build must be completed in.
Specifies how build status reports are sent to the source provider for the batch build. Valid values include:
REPORT_AGGREGATED_BATCH
(Default) Aggregate all of the build statuses into a single status report.
REPORT_INDIVIDUAL_BUILDS
Send a separate status report for each individual build.
The maximum number of concurrent builds that are allowed for this project.
New builds are only started if the current number of builds is less than or equal to this limit. If the current build count meets this limit, new builds are throttled and are not run.
To create the project, run thecreate-project
command again, passing your JSON file:
aws codebuild create-project --cli-input-json file://<json-file>
If successful, the JSON representation of aProject object appears in the console output. See theCreateProject Response Syntax for an example of this data.
Except for the build project name, you can change any of the build project's settings later. For more information, seeChange a build project's settings (AWS CLI).
To start running a build, seeRun a build (AWS CLI).
If your source code is stored in a GitHub repository, and you want CodeBuild to rebuild the source code every time a code change is pushed to the repository, seeStart running builds automatically (AWS CLI).
For information about using AWS CodeBuild with the AWS SDKs, see theAWS SDKs and tools reference.
For information about using AWS CodeBuild with AWS CloudFormation, seethe AWS CloudFormation template for CodeBuild in theAWS CloudFormation User Guide.