Skip to content

Commit dbe5615

Browse files
authored
chore(codebuild): improve the doc for subnetSelection (#26592)
If `vpc` is specified with `subnetSelection` undefined, according to this: https://github.com/aws/aws-cdk/blob/d5c64cba9aa8af8e92af4893657d144ef8e4f873/packages/aws-cdk-lib/aws-ec2/lib/vpc.ts#L655-L660 CDK will look for `PRIVATE_WITH_EGRESS`, `PRIVATE_ISOLATED`, and `PUBLIC` in order. If customer does not have `PRIVATE_WITH_EGRESS` subnets, they will need to have vpc endpoints if they need to access AWS services such as AWS Secrets Manager or Amazon ECR. This PR improves the doc to clarify. Closes #<issue number here>. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent e78e355 commit dbe5615

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packages/aws-cdk-lib/aws-codebuild/lib/project.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -616,9 +616,18 @@ export interface CommonProjectProps {
616616
/**
617617
* Where to place the network interfaces within the VPC.
618618
*
619-
* Only used if 'vpc' is supplied.
619+
* To access AWS services, your CodeBuild project needs to be in one of the following types of subnets:
620+
*
621+
* 1. Subnets with access to the internet (of type PRIVATE_WITH_EGRESS).
622+
* 2. Private subnets unconnected to the internet, but with [VPC endpoints](https://docs.aws.amazon.com/codebuild/latest/userguide/use-vpc-endpoints-with-codebuild.html) for the necessary services.
623+
*
624+
* If you don't specify a subnet selection, the default behavior is to use PRIVATE_WITH_EGRESS subnets first if they exist,
625+
* then PRIVATE_WITHOUT_EGRESS, and finally PUBLIC subnets. If your VPC doesn't have PRIVATE_WITH_EGRESS subnets but you need
626+
* AWS service access, add VPC Endpoints to your private subnets.
627+
*
628+
* @see https://docs.aws.amazon.com/codebuild/latest/userguide/vpc-support.html for more details.
620629
*
621-
* @default - All private subnets.
630+
* @default - private subnets if available else public subnets
622631
*/
623632
readonly subnetSelection?: ec2.SubnetSelection;
624633

0 commit comments

Comments
 (0)