I want to deploy a CodeBuild project with a build environment of compute type LINUX_GPU_CONTAINER.
This is the CDK code specifying the build environment:
codebuild_image_repo = aws_ecr.Repository.from_repository_name(self, "my-codebuild-mirror", "codebuild/amazonlinux2-x86_64-standard")
build_environment = aws_codebuild.BuildEnvironment(
build_image=aws_codebuild.LinuxGpuBuildImage.from_ecr_repository(codebuild_image_repo, "4.0"),
compute_type=codebuild.ComputeType.LARGE,
privileged=True,
)
The cdk deployment fails with
8:30:04 PM | UPDATE_FAILED | AWS::CodeBuild::Project | rjuenglinghfmcilum...ockerbuildC784821B
Failed to call UpdateProject, reason: CodeBuild currently doesn't support VPC in us-east-1a, please select subnets in other availability zones. (Service: AWSCodeBuild; Status Code:
400; Error Code: InvalidInputException; Request ID: e7894cde-5d45-4774-8862-9f070c95c8de; Proxy: null)
In the CodeBuild project I am specifying vpc
, security_groups
and subnet_selection
. If in the code snippet above I use aws_codebuild.LinuxBuildImage
instead of aws_codebuild.LinuxGpuBuildImage
then the deployment succeeds.
The error message does not seem to point to the root cause because deployment succeeds with the same network setup if I change the compute type.
Indeed, using a different subnet for the CodeBuild environment the error went away.