Subnet CIDR as security group rule source
See original GitHub issueHow can you get the CIDR for a subnet created by the same stack and add it to a security group rule?
const vpc = new ec2.VpcNetwork(this, 'VPC', {
subnetConfiguration: [
{
cidrMask: 28,
subnetType: SubnetType.Public,
},
{
cidrMask: 24,
subnetType: SubnetType.Private,
}
],
});
// Something similar to this?
publicSecurityGroup.connections.allowFrom(vpc.publicSubnets[0].cidr, new ec2.TcpPort(443), 'HTTPS ingress from private SG to public SG');
Issue Analytics
- State:
- Created 4 years ago
- Reactions:22
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Control traffic to resources using security groups
Use security groups to control the inbound and outbound traffic for associated resources.
Read more >Security group rules - Amazon Elastic Compute Cloud
The rules of a security group control the inbound traffic that's allowed to reach the instances that are associated with the security group....
Read more >AWS Security Group: Best Practices & Instructions - CoreStack
Learn the most important AWS Security Group best practices and follow ... outbound rules, then set the source and destination as the security...
Read more >AWS EC2 with public subnets with open ports - nOps
For instances provisioned in Public subnets, you must ensure that no inbound rules exist in any security group that allows unrestricted access (i.e., ......
Read more >Configuring security groups and ACLs for use with a VPN server
If you configure security groups and ACLs on the VPN server's subnet, ... which CIDR should be specified when you create the security...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am in same state as this. I have a VPC which is created with subnets (public and private) in 2 AZ’s. I want the CIDR block of the subnet which I was trying to get using this simple logic
for subnet in self.vpc.isolated_subnets:
subnet.cidrblock
only to find out the .cidrblock is not a property that is exposed.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.