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.

Consider providing CIDR in IVpc

See original GitHub issue

Currently, there’s no easy way to get the CIDR of a VPC from IVpc interface although the Vpc implementation does via getCidr(). Please consider pulling up getCidr() to the interface.

NOTE: Structure out of date. Request still valid

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:8
  • Comments:19 (11 by maintainers)

github_iconTop GitHub Comments

13reactions
alex-bergercommented, Jun 18, 2019

Any progress on this? Actually I often end-up wanting to write something like this:

let sg: SecurityGroup = ...
let vpc = Vpc.fromLookup(this, '...', { tags: { "mytag": "my-value"}} )
for ( let subnet of vpc.privateSubnets ){
      sg.addIngressRule(subnet, new TcpPort(443), 'Allow inbound HTTPS traffic from private subnet')
}

However, not being able to obtain the CIDR(s) of imported IVpc respectively ISubnet makes this impossible. Vpc.fromLookup(this, '...', { tags: { "mytag": "my-value"}} ) implies that we have to lookup facts (attributes like VpcId, …) using AWS API anyway, so we could as well lookup the CIDR ranges.

2reactions
klangcommented, Sep 12, 2019

However I´ve noticed that the defaultChild property is not set when you for instance is looking up a subnet, but if you create the VPC and its subnets it works.

Which brings me back to my point: I may be missing how looking up information for existing infrastructure works.

It’s pretty easy to get yourself in a situation where the VPC and SubNets are given and non-negotiably out of your control (corp delivers those things with a VPN endpoint back to on-prem and don’t want anybody messing with it).

aws-cli has the entire set of describe-* functions and terraform has data resources for pretty much everything.

I’m sure that CDK must have something similar.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Virtual private clouds (VPC) - AWS Documentation
A virtual private cloud (VPC) is a virtual network dedicated to your AWS account. It is logically isolated from other virtual networks in...
Read more >
How to Choose the CIDR Block for Your VPC | MuleSoft Blog
To understand the CIDR block, we must first understand what an IP address is (don't worry, this isn't going to be a networking...
Read more >
Cdk use existing vpc - cattolimonica.it
The CDK CLI will search for the specified VPC in the the stack's region and account, and import the subnet configuration. aws vpc...
Read more >
IPv4, CIDR, and VPC Subnets Made Simple! - YouTube
Please support me on Patreon: https://www.patreon.com/thesimpleengineerhttps://twitter.com/thesimpengineer ...
Read more >
What Is CIDR (Classless Inter-Domain Routing) in MuleSoft VPC
Let's consider, if you provide CIDR Block 192.168.0.0/24, it will give 255 hosts or IP addresses. CIDR Notation, Total Host. 192.168.0.0/24 ...
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