I am experimenting with CodeBuild but have reached a dead-end. My build always fails with the error message:
Build does not have internet connectivity. Please check subnet network configuration.
I checked the VPC configuration (subnet, security groups), and they seem okay. To test internet connectivity, I launched an EC2 instance in the same subnet, and it is able to communicate with external services (I tried a ping and some HTTP GETs).
How do I resolve this 'internet connectivity' issue?
When you are assigning the CodeBuild project to a subnet, it must be a private subnet with a NAT gateway that is connected to the internet gateway.
I had this same issue, but I was quite early in the project so I could tear it down and start again.
From the VPC Dashboard I used the 'Start VPC Wizard' button where I could select a template named 'VPC with Public and Private Subnets'. I still had to create the security groups and assign an elastic IP.
Once the new VPC was generated and configured I reconfigured my CodeBuild project to use the private subnet in the new VPC and the provisioning step succeeded.
I hope this helps.