Use AWS CodeBuild with Amazon Virtual Private Cloud (original) (raw)

Typically, AWS CodeBuild cannot access resources in a VPC. To enable access, you must provide additional VPC-specific configuration information in your CodeBuild project configuration. This includes the VPC ID, the VPC subnet IDs, and the VPC security group IDs. VPC-enabled builds can then access resources inside your VPC. For more information about setting up a VPC in Amazon VPC, see the Amazon VPC User Guide.

Topics

Use cases

VPC connectivity from AWS CodeBuild builds makes it possible to:

Your builds can access any resource that's hosted in your VPC.

Best practices for VPCs

Use this checklist when you set up a VPC to work with CodeBuild.

Important

You need a NAT gateway or NAT instance to use CodeBuild with your VPC so that CodeBuild can reach public endpoints (for example, to run CLI commands when running builds). You cannot use the internet gateway instead of a NAT gateway or a NAT instance because CodeBuild does not support assigning Elastic IP addresses to the network interfaces that it creates, and auto-assigning a public IP address is not supported by Amazon EC2 for any network interfaces created outside of Amazon EC2 instance launches.

For more information about setting up a VPC in Amazon VPC, see the Amazon VPC User Guide.

For more information about using AWS CloudFormation to configure a VPC to use the CodeBuild VPC feature, see the AWS CloudFormation VPC template.

Limitations of VPCs