-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(aws-ec2): imported VPC subnets never recognized as PRIVATE_ISOLATED #17496
fix(aws-ec2): imported VPC subnets never recognized as PRIVATE_ISOLATED #17496
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Sorry for the delay in response.
Can you add just one more test for the ISOLATED case? Given that's the new behavior here, it would be good to have a test capturing it.
…on' into fix-looked-up-vpc-subnet-selection
No worries, thanks for the review!
Makes sense indeed, I've added extra test cases for an Isolated subnet. Also updated the in-line comment to better explain the process of determining the subnet type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
…ED (aws#17496) fixes aws#17035 I do want to note that this does not cover all cases. For example, it could also be that there is a NAT instance used for internet routing instead of a NAT gateway. It's however near impossible to figure out if a route to an instance is a route to a NAT instance or just a random EC2 instance. Next to that, it can also be that the NAT gateway is running in a private subnet to do routing between different VPCs instead of the internet. In that case, the subnet would not match any of the current "variations" that are defined in the `aws-cdk` documentation (https://docs.aws.amazon.com/cdk/api/latest/docs/aws-ec2-readme.html). But since the types are referred to as `PRIVATE_WITH_NAT` and `PRIVATE_WITHOUT_NAT`, I assume this implementation to be sufficient. I did add an extra check on the destination CIDR block being `0.0.0.0/0` since that is what someone would commonly use if the purpose of the NAT gateway is internet routing in any case. See f.e. https://docs.aws.amazon.com/vpc/latest/userguide/route-table-options.html#route-tables-nat. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
fixes #17035
I do want to note that this does not cover all cases. For example, it could also be that there is a NAT instance used for internet routing instead of a NAT gateway. It's however near impossible to figure out if a route to an instance is a route to a NAT instance or just a random EC2 instance.
Next to that, it can also be that the NAT gateway is running in a private subnet to do routing between different VPCs instead of the internet. In that case, the subnet would not match any of the current "variations" that are defined in the
aws-cdk
documentation (https://docs.aws.amazon.com/cdk/api/latest/docs/aws-ec2-readme.html).But since the types are referred to as
PRIVATE_WITH_NAT
andPRIVATE_WITHOUT_NAT
, I assume this implementation to be sufficient. I did add an extra check on the destination CIDR block being0.0.0.0/0
since that is what someone would commonly use if the purpose of the NAT gateway is internet routing in any case. See f.e. https://docs.aws.amazon.com/vpc/latest/userguide/route-table-options.html#route-tables-nat.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license