Я разобрался, как это сделать. Ниже приведен код, где проект - это объект проекта CodeBuild.
// associate the VPC, securitygroup and subnets with the codebuild
const projectVpc = project.node.findChild('Resource') as codebuild.CfnProject;
projectVpc.propertyOverrides.vpcConfig = {
vpcId: "vpc-xxxxxx",
securityGroupIds: ["sg-xxxxxx],
subnets: ["subnet-xxxxx1","subnet-xxxxx2"]
}