Menu
AWS CloudFormation
User Guide (API Version 2010-05-15)

AWS::CodeBuild::Project

The AWS::CodeBuild::Project resource configures how AWS CodeBuild builds your source code. For example, it tells AWS CodeBuild where to get the source code and which build environment to use.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

Copy
{ "Type" : "AWS::CodeBuild::Project", "Properties" : { "Artifacts" : Artifacts, "Description" : String, "EncryptionKey" : String, "Environment" : Environment, "Name" : String, "ServiceRole" : String, "Source" : Source, "Tags" : [ Resource Tag, ... ], "TimeoutInMinutes" : Integer } }

YAML

Copy
Type: "AWS::CodeBuild::Project" Properties: Artifacts: Artifacts Description: String EncryptionKey: String Environment: Environment Name: String ServiceRole: String Source: Source Tags: - Resource Tag TimeoutInMinutes: Integer

Properties

Artifacts

The output settings for artifacts that the project generates during a build.

Required: Yes

Type: AWS CodeBuild Project Artifacts

Update requires: No interruption

Description

A description of the project. Use the description to identify the purpose of the project.

Required: No

Type: String

Update requires: No interruption

EncryptionKey

The alias or Amazon Resource Name (ARN) of the AWS Key Management Service (AWS KMS) customer master key (CMK) that AWS CodeBuild uses to encrypt the build output. If you don't specify a value, AWS CodeBuild uses the AWS-managed CMK for Amazon Simple Storage Service.

Required: No

Type: String

Update requires: No interruption

Environment

The build environment settings for the project, such as the environment type or the environment variables to use for the build environment.

Required: Yes

Type: AWS CodeBuild Project Environment

Update requires: No interruption

Name

A name for the project. The name must be unique across all of the projects in your AWS account.

Required: Yes

Type: String

Update requires: Replacement

ServiceRole

The ARN of the service role that AWS CodeBuild uses to interact with services on your behalf.

Required: Yes

Type: String

Update requires: No interruption

Source

The source code settings for the project, such as the source code's repository type and location.

Required: Yes

Type: AWS CodeBuild Project Source

Update requires: No interruption

Tags

An arbitrary set of tags (key-value pairs) for the AWS CodeBuild project.

Required: No

Type: AWS CloudFormation Resource Tags

Update requires: No interruption

TimeoutInMinutes

The number of minutes after which AWS CodeBuild stops the build if it's not complete. For valid values, see the timeoutInMinutes field in the AWS CodeBuild User Guide.

Required: No

Type: Integer

Update requires: No interruption

Return Values

Ref

When the logical ID of this resource is provided to the Ref intrinsic function, Ref returns the name of the AWS CodeBuild project, such as myProjectName.

For more information about using the Ref function, see Ref.

Fn::GetAtt

Fn::GetAtt returns a value for a specified attribute of this type. This section lists the available attribute and a sample return value.

Arn

The ARN of the AWS CodeBuild project, such as arn:aws:codebuild:us-west-2:123456789012:project/myProjectName.

For more information about using Fn::GetAtt, see Fn::GetAtt.

Example

The following example creates an AWS CodeBuild project.

JSON

Copy
{ "Project": { "Type": "AWS::CodeBuild::Project", "Properties": { "Name": "myProjectName", "Description": "A description about my project", "ServiceRole": { "Fn::GetAtt": [ "ServiceRole", "Arn" ] }, "Artifacts": { "Type": "no_artifacts" }, "Environment": { "Type": "LINUX_CONTAINER", "ComputeType": "BUILD_GENERAL1_SMALL", "Image": "aws/codebuild/java:openjdk-8", "EnvironmentVariables": [ { "Name": "varName", "Value": "varValue" } ] }, "Source": { "Location": "codebuild-demo-test/0123ab9a371ebf0187b0fe5614fbb72c", "Type": "S3" }, "TimeoutInMinutes": 10, "Tags": [ { "Key": "Key1", "Value": "Value1" }, { "Key": "Key2", "Value": "Value2" } ] } } }

YAML

Copy
Project: Type: AWS::CodeBuild::Project Properties: Name: myProjectName Description: A description about my project ServiceRole: !GetAtt ServiceRole.Arn Artifacts: Type: no_artifacts Environment: Type: LINUX_CONTAINER ComputeType: BUILD_GENERAL1_SMALL Image: aws/codebuild/java:openjdk-8 EnvironmentVariables: - Name: varName Value: varValue Source: Location: codebuild-demo-test/0123ab9a371ebf0187b0fe5614fbb72c Type: S3 TimeoutInMinutes: 10 Tags: - Key: Key1 Value: Value1 - Key: Key2 Value: Value2