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): select subnets that contain IP address(es) #8526

Conversation

flemjame-at-amazon
Copy link
Contributor

@flemjame-at-amazon flemjame-at-amazon commented Jun 12, 2020


feat(ec2): select subnets that contain IP address(es)

It is currently not possible to search for subnets that contain a particular IP address or range of addresses, because ISubnet does not expose the CIDR blocks. Users with fixed-ip resources in a VPC cannot then determine what the associated subnet is.

This commit exposes the CIDR block for ISubnet, and adds a feature to SubnetSelection that allows a user to select subnets based on whether they contain any of a set of IPv4 addresses.

  new BastionHostLinux(stack, 'Bastion', {
    vpc,
    subnetSelection: {
      containsIPv4Addr: ['10.0.160.0'],
    },
  });

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 63892b9
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 3f3859a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: d6cdc2a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

Copy link
Contributor

@rix0rrr rix0rrr left a comment

Choose a reason for hiding this comment

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

I'm going to put my foot down and say no to this. We should have stopped adding random J selector for everyone's use case to this interface a long time ago.

Please turn this into a protocol with an interface that people can implement in their own projects (mark the interface @subclassable), and then use that protocol to solve your use case in your app code.

@flemjame-at-amazon
Copy link
Contributor Author

I'm going to put my foot down and say no to this. We should have stopped adding random J selector for everyone's use case to this interface a long time ago.

Please turn this into a protocol with an interface that people can implement in their own projects (mark the interface @subclassable), and then use that protocol to solve your use case in your app code.

To clarify -- a user would instantiate an object which implements this protocol, and the user passes to subnet selection?

Also, I assume we leave support for existing subnet selection options?

@rix0rrr
Copy link
Contributor

rix0rrr commented Jul 8, 2020

To clarify -- a user would instantiate an object which implements this protocol, and the user passes to subnet selection?

Yes, exactly that.

Also, I assume we leave support for existing subnet selection options?

Yes we can't take those away without breaking compatibility.

@flemjame-at-amazon
Copy link
Contributor Author

Resolving in favor of #10112

mergify bot pushed a commit that referenced this pull request Sep 16, 2020
Continuation of #8526

This change adds a feature to SubnetSelection which lets the user provide objects that implements the new `ISubnetSelector` interface. These objects will be used by the VPC class to choose the subnets from the VPC.

This commit also provides an implementation of an ISubnetSelector that lets the user select subnets that contain IP addresses.

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@flemjame-at-amazon flemjame-at-amazon deleted the filter-subnets-by-ip-addr branch October 27, 2020 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants