---
title: AWS CodeBuild
description: >-
  AWS CodeBuild compiles source code, runs tests, and prepares software packages
  for deployment.
breadcrumbs: Docs > Integrations > AWS CodeBuild
---

# AWS CodeBuild
Integration version1.0.0
## Overview{% #overview %}

AWS CodeBuild is a build service that compiles source code, runs tests, and produces software packages that are ready to deploy.

Install the Datadog AWS CodeBuild integration to:

- Track your builds by project
- Collect metrics on your builds
- Correlate builds with the rest of your Datadog metrics

## Setup{% #setup %}

### Installation{% #installation %}

If you haven't already, set up the [Amazon Web Services integration](https://docs.datadoghq.com/integrations/amazon_web_services/) first.

### Metric collection{% #metric-collection %}

1. In the [AWS integration page](https://app.datadoghq.com/integrations/amazon-web-services), ensure that `CodeBuild` is enabled under the `Metric Collection` tab.

1. Install the [Datadog - AWS CodeBuild integration](https://app.datadoghq.com/integrations/amazon-codebuild).

### Log collection{% #log-collection %}

#### Enable logging{% #enable-logging %}

Configure AWS CodeBuild to send logs either to a S3 bucket or to CloudWatch.

**Note**: If you log to a S3 bucket, make sure that `amazon_codebuild` is set as *Target prefix*.

#### Send logs to Datadog{% #send-logs-to-datadog %}

1. If you haven't already, set up the [Datadog Forwarder Lambda function](https://docs.datadoghq.com/logs/guide/forwarder/).

1. Once the Lambda function is installed, manually add a trigger on the S3 bucket or CloudWatch log group that contains your AWS CodeBuild logs in the AWS console:

   - [Add a manual trigger on the S3 bucket](https://docs.datadoghq.com/logs/guide/send-aws-services-logs-with-the-datadog-lambda-function/#collecting-logs-from-s3-buckets)
   - [Add a manual trigger on the CloudWatch Log Group](https://docs.datadoghq.com/logs/guide/send-aws-services-logs-with-the-datadog-lambda-function/#collecting-logs-from-cloudwatch-log-group)

## Data Collected{% #data-collected %}

### Metrics{% #metrics %}

|  |
|  |
| **aws.codebuild.builds**(count)                      | Measures the number of builds triggered.*Shown as build*                                  |
| **aws.codebuild.duration**(gauge)                    | Measures the total duration of all builds over time.*Shown as second*                     |
| **aws.codebuild.duration.maximum**(gauge)            | Measures the maximum duration of all the builds over time.*Shown as second*               |
| **aws.codebuild.duration.minimum**(gauge)            | Measures the minimum duration of all the builds over time.*Shown as second*               |
| **aws.codebuild.failed\_builds**(count)              | Measures the number of failed builds because of client error or timeouts.*Shown as build* |
| **aws.codebuild.succeeded\_builds**(count)           | Measures the number of successful builds.*Shown as build*                                 |
| **aws.codebuild.build\_duration**(gauge)             | Measures the duration of the build's BUILD phase.*Shown as second*                        |
| **aws.codebuild.download\_source\_duration**(gauge)  | Measures the duration of the build's DOWNLOAD_SOURCE phase.*Shown as second*              |
| **aws.codebuild.finalizing\_duration**(gauge)        | Measures the duration of the build's FINALIZING phase.*Shown as second*                   |
| **aws.codebuild.install\_duration**(gauge)           | Measures the duration of the build's INSTALL phase.*Shown as second*                      |
| **aws.codebuild.post\_build\_duration**(gauge)       | Measures the duration of the build's POST_BUILD phase*Shown as second*                    |
| **aws.codebuild.pre\_build\_duration**(gauge)        | Measures the duration of the build's PRE_BUILD phase.*Shown as second*                    |
| **aws.codebuild.provisioning\_duration**(gauge)      | Measures the duration of the build's PROVISIONING phase.*Shown as second*                 |
| **aws.codebuild.queued\_duration**(gauge)            | Measures the duration of the build's QUEUED phase.*Shown as second*                       |
| **aws.codebuild.submitted\_duration**(gauge)         | Measures the duration of the build's SUBMITTED phase.*Shown as second*                    |
| **aws.codebuild.upload\_artifacts\_duration**(gauge) | Measures the duration of the build's UPLOAD_ARTIFACTS phase.*Shown as second*             |

### Events{% #events %}

The AWS CodeBuild integration does not include any events.

### Service Checks{% #service-checks %}

The AWS CodeBuild integration does not include any service checks.

## Troubleshooting{% #troubleshooting %}

Need help? Contact [Datadog support](https://docs.datadoghq.com/help/).
