question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(aws-ec2): Why are NAT gateways required for private subnets?

See original GitHub issue

❓ General Issue

The Question

I’m very curious why this check is in place: https://github.com/aws/aws-cdk/blob/283ed02c64f827161edba3e11c3cead3b54b7ee9/packages/%40aws-cdk/aws-ec2/lib/vpc.ts#L2036-L2039

NAT gateways are, if I’m not mistaken, only required if resources within your private subnets need to access the Internet through an Internet gateway. In this case, I’m unable to use CDK to create a ServerlessCluster, because the SubnetGroup can’t be defined without giving it a VPC with private subnets, which strangely require NAT Gateways. If I try to create a SubnetGroup using a VPC with public & isolated subnets, it complains and says I need to use private subnets: Error: There are no 'Private' subnet groups in this VPC. Available types: Isolated,Public

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
njlynchcommented, Sep 2, 2021

@ffxsam:

It’s a fair criticism that our concept of ISOLATED may cause unintentional confusion. I’ve submitted a PR to rename PRIVATE and ISOLATED to PRIVATE_WITH_NAT and PRIVATE_ISOLATED to hopefully make this clearer.

3reactions
ffxsamcommented, Aug 25, 2021

Case in point:

CleanShot 2021-08-19 at 09 33 29

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set up NAT gateway for private subnet in Amazon VPC
A network address translation (NAT) gateway allows EC2 instances to establish outbound connections to resources on internet without allowing ...
Read more >
Create a VPC in AWS with Public and Private Subnets & ...
The purpose of this lab is to demonstrate how create a custom VPC with public subnet and an Internet gateway that will access...
Read more >
AWS Quick Tips: Internet Gateways, NAT ...
While the NAT Gateway is needed for private subnets to have ... for when using an EC2 instance to perform NAT Gateway-like functionality....
Read more >
AWS: NAT Gateway in public subnet. Why? - Server Fault
Usually, the default route for a private subnet points to a NAT device, ... to a NAT-gateway, so you can consider NAT-gateway as...
Read more >
NAT Gateway and private subnets routing
The private subnets in your VPC should have access to Internet only through an AWS feature called NAT Gateway. The NAT Gateway configuration...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found