How to get all CIDRs from VPC using AWS CDK?

0

Hi, I have a vpc that I am accessing through tags. I need to get all CIDRs from this VPC but I am getting only one. Please help with your valuable suggestions on how to get all CIDRs from VPC using AWS CDK? const vpc = Vpc.fromLookup(this, 'MyExistingVPC', { tags:{ 'environment': 'dev', 'feature': 'lambda' } }); const vpcCidr = vpc.vpcCidrBlock; // This will return only one CIDR

1 Answer
0

Hello.
As you are aware, only one VPC is read when using "fromLookup".
As far as I know, there is no way to list the CIDR of an existing VPC in CDK.
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Vpc.html

So, you may need to use the AWS SDK, etc.

profile picture
EXPERT
answered 9 months ago
profile picture
EXPERT
reviewed 9 months ago
profile pictureAWS
EXPERT
reviewed 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions