5
votes

I created 2 VPCs using aws-cdk. cdk is creating route tables dynamically when cloudformation stack is created. I created a peering connection between the two VPCs I created using CfnVPCPeeringConnection but I am not sure how to add route to vpc peering connection as I do not know what would be the RouteTableId.

1
Stackoverflow expects that you come to us with specific questions. Please edit your question to provide context on what exactly you are struggling with, as opposed to asking general how do I do this questions. - Xenology

1 Answers

9
votes

You probably mean the peering connection id. Once you know it you can modify the routing tables.

In typescript, you get it this way

import ec2 = require("@aws-cdk/aws-ec2");
....
const vpc_peering = new ec2.CfnVPCPeeringConnection (...)
const vpc_peering_id = vpc_peering.ref