Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeBuild cannot find the 0.0.0.0/0 destination for the target internet gateway

I've been struggling with this for hours. So, I created my VPC, along with 4 different subnets. The first three are attached to a regular Internet Gateway. The last one is attached to a NAT Gateway (with 0.0.0.0/0 as Destination). My CodeBuild project is set to use this VPC and the last subnet.

When I click "Validate VPC Settings" in the CodeBuild Project Environment, I get this warning:

"The VPC with ID * might not have an internet connection. CodeBuild cannot find the 0.0.0.0/0 destination for the target internet gateway with subnet ID *."

If I try to run the CodeBuild project, it will timeout because it has no internet access and cannot download sources from CodeCommit...

What am I missing here? The Routing Table for my subnet is attached to the NAT Gateway and the Destination is 0.0.0.0/0, so the error message above doesn't make any sense to me.

Thank you!

like image 442
Marian Busoi Avatar asked Nov 19 '19 15:11

Marian Busoi


People also ask

Does CodeBuild have Internet access?

CodeBuild does not have specific requirements for outbound traffic, but you must allow access to any Internet resources required for your build, such as GitHub or Amazon S3.

How do I remove NAT gateway?

To delete a NAT gateway Open the Amazon VPC console at https://console.aws.amazon.com/vpc/ . In the navigation pane, choose NAT Gateways. Select the radio button for the NAT gateway, and then choose Actions, Delete NAT gateway. When prompted for confirmation, enter delete and then choose Delete.

Can NAT gateway be in private subnet?

You can use a network address translation (NAT) gateway to enable instances in a private subnet to connect to the Internet or other AWS services, but prevent the internet from initiating a connection with those instances.


1 Answers

So, in case anyone else has the same issue, the reason was that I mistakenly placed my NAT Gateway on a private subnet instead of a public one.

like image 102
Marian Busoi Avatar answered Sep 28 '22 13:09

Marian Busoi