---
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 version2.0.0
{% callout %}
# Important note for users on the following Datadog sites: us2.ddog-gov.com

{% alert level="info" %}
To find out if this integration is available in your organization, see your [Datadog Integrations](https://app.datadoghq.com/integrations) page or ask your organization administrator.

To initiate an exception request to enable this integration for your organization, email [support@ddog-gov.com](mailto:support@ddog-gov.com).
{% /alert %}

{% /callout %}

## 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.md) 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.md).

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.md#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.md#collecting-logs-from-cloudwatch-log-group)

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

### Metrics{% #metrics %}

|  |
|  |
| **aws.codebuild.build\_duration**(gauge)             | The elapsed time of the build's BUILD phase.*Shown as second*                     |
| **aws.codebuild.builds**(count)                      | The number of builds triggered.*Shown as build*                                   |
| **aws.codebuild.cpuutilized**(gauge)                 | The number of CPU units used by the build container.*Shown as core*               |
| **aws.codebuild.cpuutilized\_percent**(gauge)        | The percentage of CPU units used by the build container.*Shown as percent*        |
| **aws.codebuild.download\_source\_duration**(gauge)  | The elapsed time of the build's DOWNLOAD_SOURCE phase.*Shown as second*           |
| **aws.codebuild.duration**(gauge)                    | The elapsed time of all builds.*Shown as second*                                  |
| **aws.codebuild.duration.maximum**(gauge)            | The maximum elapsed time across all builds.*Shown as second*                      |
| **aws.codebuild.duration.minimum**(gauge)            | The minimum elapsed time across all builds.*Shown as second*                      |
| **aws.codebuild.failed\_builds**(count)              | The number of builds that failed due to client error or timeout.*Shown as build*  |
| **aws.codebuild.finalizing\_duration**(gauge)        | The elapsed time of the build's FINALIZING phase.*Shown as second*                |
| **aws.codebuild.initialized\_duration**(gauge)       | The elapsed time of the build's INITIALIZED phase.*Shown as second*               |
| **aws.codebuild.install\_duration**(gauge)           | The elapsed time of the build's INSTALL phase.*Shown as second*                   |
| **aws.codebuild.memory\_utilized**(gauge)            | The number of megabytes of memory used by the build container.*Shown as megabyte* |
| **aws.codebuild.memory\_utilized\_percent**(gauge)   | The percentage of memory used by the build container.*Shown as percent*           |
| **aws.codebuild.post\_build\_duration**(gauge)       | The elapsed time of the build's POST_BUILD phase.*Shown as second*                |
| **aws.codebuild.pre\_build\_duration**(gauge)        | The elapsed time of the build's PRE_BUILD phase.*Shown as second*                 |
| **aws.codebuild.provisioning\_duration**(gauge)      | The elapsed time of the build's PROVISIONING phase.*Shown as second*              |
| **aws.codebuild.queued\_duration**(gauge)            | The elapsed time of the build's QUEUED phase.*Shown as second*                    |
| **aws.codebuild.storage\_read\_bytes**(gauge)        | The storage read throughput of the build container.*Shown as byte*                |
| **aws.codebuild.storage\_write\_bytes**(gauge)       | The storage write throughput of the build container.*Shown as byte*               |
| **aws.codebuild.submitted\_duration**(gauge)         | The elapsed time of the build's SUBMITTED phase.*Shown as second*                 |
| **aws.codebuild.succeeded\_builds**(count)           | The number of successful builds.*Shown as build*                                  |
| **aws.codebuild.upload\_artifacts\_duration**(gauge) | The elapsed time 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/).
