Skip to content
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

feat(ec2): allow private non-nat subnets #21699

Merged
merged 2 commits into from
Sep 3, 2022

Conversation

jmortlock
Copy link
Contributor

@jmortlock jmortlock commented Aug 22, 2022


Closes: #21697 and might close #21699

Not all private subnets need to have a NAT gateway for egress; an example would be when using Transit Gateway.

I have incorporated the idea expressed in #21189 to add a more generic PRIVATE_WITH_EGRESS subnet type.

This PR is largely a rename and a small logic change in determineNatGatewayCount

All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Aug 22, 2022

@github-actions github-actions bot added the p2 label Aug 22, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team August 22, 2022 07:47
@jmortlock jmortlock force-pushed the private-with-egress branch 2 times, most recently from 470449b to 48ac4a2 Compare August 22, 2022 08:36
DEPRECATED_APIs.md Outdated Show resolved Hide resolved
*/
PRIVATE_WITH_NAT = 'Private',
PRIVATE_WITH_NAT = 'Deprecated_Private_NAT',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this have the potential to cause breaking changes for users?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not believe it will and these constants have been through a rename cycle before in v1.
You can see an earlier PR which renamed it originally
#19320

This actually caused an issue with VPC resources being recreated which you can see was ultimately fixed in
#21140

I have added similar tests to what was done in that last pull requests to get the same behavior.

@TheRealAmazonKendra TheRealAmazonKendra changed the title feat(aws-ec2): Allow private "Non Nat" subnets feat(ec2): allow private non-nat subnets Sep 3, 2022
@TheRealAmazonKendra
Copy link
Contributor

With the force push, I can't see what was changed in this revision. Please use merge commits instead. Can you provide a summary of what's been changed?

@jmortlock
Copy link
Contributor Author

Apologies; I rebased to the latest main branch and I dropped the unnecessary changes to the v1 deprecation list

@mergify
Copy link
Contributor

mergify bot commented Sep 3, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 21b2410
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit e1794e3 into aws:main Sep 3, 2022
@mergify
Copy link
Contributor

mergify bot commented Sep 3, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@dlcoffee
Copy link

hi, i was wondering if the logic for context lookup needs to be updated as well. it looks like we might want to check for transit gateways in addition to nat gateways to categorize it as a SubnetType.Private subnet instead of SubnetType.Isolated.

https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk/lib/context-providers/vpcs.ts#L72-L77

mergify bot pushed a commit that referenced this pull request Jun 15, 2023
When I do Vpc.fromLookup in a VPC that has subnets with a default route to a TransitGateway the subnet is detected as `PRIVATE_ISOLATED` instead of `PRIVATE_WITH_EGRESS`
This PR adds the detection of subnets with TGW routes as `PRIVATE_WITH_EGRESS` instead of `PRIVATE_ISOLATED`.

This is potentially a breaking change depending on what is the expected behaviour. To me it seemed rather missed accidentally given that this [previous PR](#21699) mentions that `PRIVATE_WITH_EGRESS` was introduced also for Transit Gateways.

Closes #25626

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(aws-ec2): Private subnets without Nat Gateway
4 participants