Working with Amazon Lambda compute in Amazon CodeBuild - Amazon CodeBuild
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Working with Amazon Lambda compute in Amazon CodeBuild

Amazon Lambda compute offers optimized start-up speeds for your builds. Amazon Lambda supports faster builds due to a lower start-up latency. Amazon Lambda also automatically scales, so builds aren’t waiting in queue to run. However, there are some use-cases which Amazon Lambda does not support, and if they impact you, use the EC2 compute. For more information, see Limitations of Amazon Lambda compute.

Which tools and runtimes will be included in the curated runtime environment docker images which run on Amazon Lambda?

Amazon Lambda supports the following tools: Amazon CLI v2, Amazon SAM CLI, git, go, Java, Node.js, Python, pip, Ruby, and .NET.

What if the curated image doesn't include the tools I need?

If the curated image doesn't include the tools you need, you can provide a custom environment Docker image that includes the necessary tools.

Note that you require the following Amazon ECR permissions to use custom images for Lambda compute:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ecr:GetAuthorizationToken" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "ecr:BatchCheckLayerAvailability", "ecr:GetDownloadUrlForLayer", "ecr:BatchGetImage" ], "Resource": "arn:aws:ecr:image-region:image-account-id:repository/image-repo" } ] }

Also note that curl or wget must be installed in order to use custom images.

Which regions support Amazon Lambda compute in CodeBuild?

In CodeBuild, Amazon Lambda compute is supported in the following Amazon Web Services 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), and South America (São Paulo). For more information about Amazon Web Services Regions where CodeBuild is available, see Amazon Services by Region.

Limitations of Amazon Lambda compute

There are some use-cases which Amazon Lambda does not support, and if they impact you, use the EC2 compute:

  • Amazon Lambda doesn't support tools that require root permissions. For tools such as yum or rpm, use the EC2 compute type or other tools that don't require root permissions.

  • Amazon Lambda doesn't support Docker builds or runs. You can use alternatives that don’t require root permissions, such as Podman.

  • Amazon Lambda doesn't support writing to files outside /tmp. The included package managers are configured to use the /tmp directory by default for downloading and referencing packages.

  • Amazon Lambda doesn't support the environment type LINUX_GPU_CONTAINER and isn't supported on Windows Server Core 2019.

  • Amazon Lambda doesn't support caching, batch builds, custom build timeouts, queue timeout, build badges, privileged mode, custom runtime environments, or runtimes longer than 15 minutes.

  • Amazon Lambda doesn't support VPC connectivity, a fixed range of CodeBuild source IP addresses, EFS, semantic versioning, installing certificates, or SSH access with Session Manager.