Build environment compute modes and types - AWS CodeBuild

Build environment compute modes and types

In CodeBuild, you can specify the compute and runtime environment image that CodeBuild uses to run your builds. Compute refers to the computing engine (the CPU, memory, and operating system) that is managed and maintained by CodeBuild. A runtime environment image is a container image that runs on top of your chosen compute platform, and includes extra tools that your build might need, such as the AWS CLI.

About compute modes

CodeBuild offers the following compute modes:

  • EC2

  • AWS Lambda

EC2 offers optimized flexibility during your build and AWS Lambda offers optimized start-up speeds. AWS Lambda supports faster builds due to a lower start-up latency. AWS Lambda also automatically scales, so builds aren’t waiting in queue to run. For more information, see Working with AWS Lambda compute in AWS CodeBuild.

About environment types

AWS CodeBuild provides build environments with the following available memory, vCPUs, and disk space for EC2 compute mode:

Compute type Environment computeType value Environment type value Memory vCPUs Disk space
ARM Small ¹ BUILD_GENERAL1_SMALL ARM_CONTAINER 4 GB 2 64 GB
ARM Medium ¹ BUILD_GENERAL1_MEDIUM ARM_CONTAINER 8 GB 4 128 GB
ARM Large ¹ BUILD_GENERAL1_LARGE ARM_CONTAINER 16 GB 8 256 GB
ARM XLarge ¹ BUILD_GENERAL1_XLARGE ARM_CONTAINER 64 GB 32 256 GB
ARM 2XLarge ¹ BUILD_GENERAL1_2XLARGE ARM_CONTAINER 96 GB 48 824 GB
Linux Small ¹ BUILD_GENERAL1_SMALL LINUX_CONTAINER 3 GB 2 64 GB
Linux Medium ¹ BUILD_GENERAL1_MEDIUM LINUX_CONTAINER 7 GB 4 128 GB
Linux Large ¹ BUILD_GENERAL1_LARGE LINUX_CONTAINER 15 GB 8 128 GB
Linux XLarge ¹ BUILD_GENERAL1_XLARGE LINUX_CONTAINER 70 GB 36 256 GB
Linux 2XLarge BUILD_GENERAL1_2XLARGE LINUX_CONTAINER 145 GB 72 824 GB (SSD)
Linux GPU Small BUILD_GENERAL1_SMALL LINUX_GPU_CONTAINER 16 GB 4 220 GB
Linux GPU Large BUILD_GENERAL1_LARGE LINUX_GPU_CONTAINER 255 GB 32 50 GB
Windows Medium ¹ BUILD_GENERAL1_MEDIUM WINDOWS_SERVER_2019_CONTAINER 7 GB 4 128 GB
Windows Large ¹ BUILD_GENERAL1_LARGE WINDOWS_SERVER_2019_CONTAINER 15 GB 8 128 GB

¹ The latest version of this image type is cached. If you specify a more specific version, then CodeBuild provisions that version instead of the cached version. This can result in longer build times. For example, to benefit from caching, specify aws/codebuild/amazonlinux2-x86_64-standard:5.0 instead of a more granular version, such as aws/codebuild/amazonlinux2-x86_64-standard:5.0-1.0.0.

AWS CodeBuild provides build environments with the following available memory and disk space for AWS Lambda compute mode:

Compute type Environment computeType value Environment type value Memory Disk space
ARM Lambda 1GB BUILD_LAMBDA_1GB ARM_LAMBDA_CONTAINER 1 GB 10 GB
ARM Lambda 2GB BUILD_LAMBDA_2GB ARM_LAMBDA_CONTAINER 2 GB 10 GB
ARM Lambda 4GB BUILD_LAMBDA_4GB ARM_LAMBDA_CONTAINER 4 GB 10 GB
ARM Lambda 8GB BUILD_LAMBDA_8GB ARM_LAMBDA_CONTAINER 8 GB 10 GB
ARM Lambda 10GB BUILD_LAMBDA_10GB ARM_LAMBDA_CONTAINER 10 GB 10 GB
Linux Lambda 1GB BUILD_LAMBDA_1GB LINUX_LAMBDA_CONTAINER 1 GB 10 GB
Linux Lambda 2GB BUILD_LAMBDA_2GB LINUX_LAMBDA_CONTAINER 2 GB 10 GB
Linux Lambda 4GB BUILD_LAMBDA_4GB LINUX_LAMBDA_CONTAINER 4 GB 10 GB
Linux Lambda 8GB BUILD_LAMBDA_8GB LINUX_LAMBDA_CONTAINER 8 GB 10 GB
Linux Lambda 10GB BUILD_LAMBDA_10GB LINUX_LAMBDA_CONTAINER 10 GB 10 GB

When using other environment types, it is recommended that you use a cached image to reduce build times.

The disk space listed for each build environment is available only in the directory specified by the CODEBUILD_SRC_DIR environment variable.

To choose a compute type:

Some environment and compute types have Region availability limitations:

  • The compute type Linux GPU Small (LINUX_GPU_CONTAINER) is only available in these Regions:

    • US East (N. Virginia)

    • US West (Oregon)

    • Asia Pacific (Tokyo)

    • Canada (Central)

    • Europe (Frankfurt)

    • Europe (Ireland)

    • Europe (London)

  • The compute type Linux GPU Large (LINUX_GPU_CONTAINER) is only available in these Regions:

    • US East (Ohio)

    • US East (N. Virginia)

    • US West (Oregon)

    • Asia Pacific (Seoul)

    • Asia Pacific (Singapore)

    • Asia Pacific (Sydney)

    • Asia Pacific (Tokyo)

    • Canada (Central)

    • China (Beijing)

    • China (Ningxia)

    • Europe (Frankfurt)

    • Europe (Ireland)

    • Europe (London)

  • The environment type ARM_CONTAINER is only available in these Regions:

    • US East (Ohio)

    • US East (N. Virginia)

    • US West (N. California)

    • US West (Oregon)

    • Asia Pacific (Hong Kong)

    • Asia Pacific (Jakarta)

    • Asia Pacific (Hyderabad)

    • Asia Pacific (Mumbai)

    • Asia Pacific (Osaka)

    • Asia Pacific (Seoul)

    • Asia Pacific (Singapore)

    • Asia Pacific (Sydney)

    • Asia Pacific (Tokyo)

    • Canada (Central)

    • China (Beijing)

    • China (Ningxia)

    • Europe (Frankfurt)

    • Europe (Ireland)

    • Europe (London)

    • Europe (Milan)

    • Europe (Paris)

    • Europe (Spain)

    • Europe (Stockholm)

    • Israel (Tel Aviv)

    • Middle East (Bahrain)

    • Middle East (UAE)

    • South America (São Paulo)

  • The compute type BUILD_GENERAL1_2XLARGE is only available in these Regions:

    • US East (Ohio)

    • US East (N. Virginia)

    • US West (N. California)

    • US West (Oregon)

    • Asia Pacific (Hyderabad)

    • Asia Pacific (Hong Kong)

    • Asia Pacific (Jakarta)

    • Asia Pacific (Melbourne)

    • Asia Pacific (Mumbai)

    • Asia Pacific (Seoul)

    • Asia Pacific (Singapore)

    • Asia Pacific (Sydney)

    • Asia Pacific (Tokyo)

    • Canada (Central)

    • China (Beijing)

    • China (Ningxia)

    • Europe (Frankfurt)

    • Europe (Ireland)

    • Europe (London)

    • Europe (Paris)

    • Europe (Spain)

    • Europe (Stockholm)

    • Europe (Zurich)

    • Israel (Tel Aviv)

    • Middle East (Bahrain)

    • Middle East (UAE)

    • South America (São Paulo)

  • The compute mode AWS Lambda (ARM_LAMBDA_CONTAINER and LINUX_LAMBDA_CONTAINER) is only available in these Regions:

    • US East (N. Virginia)

    • US East (Ohio)

    • US West (Oregon)

    • Asia Pacific (Mumbai)

    • Asia Pacific (Singapore)

    • Asia Pacific (Sydney)

    • Asia Pacific (Tokyo)

    • Europe (Frankfurt)

    • Europe (Ireland)

    • South America (São Paulo)

For the compute type BUILD_GENERAL1_2XLARGE, Docker images up to 100 GB uncompressed are supported.

Note

For custom build environment images, CodeBuild supports Docker images up to 50 GB uncompressed in Linux and Windows, regardless of the compute type. To check your build image's size, use Docker to run the docker images REPOSITORY:TAG command.

You can use Amazon EFS to access more space in your build container. For more information, see Amazon Elastic File System sample for AWS CodeBuild. If you want to manipulate container disk space during a build, then the build must run in privileged mode.

Note

By default, Docker daemon is enabled for non-VPC builds. If you would like to use Docker containers for VPC builds, see Runtime Privilege and Linux Capabilities on the Docker Docs website and enable privileged mode. Also, Windows does not support privileged mode.