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.
Amazon Virtual Private Cloud (Amazon VPC) enables you to launch AWS resources into a virtual network that you've defined. A VPC peering connection is a networking connection between two VPCs that enables you to route traffic between them using private IPv4 addresses or IPv6 addresses.
Functionally, VPC peering is similar to site-to-site VPN, in that it allows communications between two otherwise isolated environments. The biggest difference between VPC peering and site-to-site VPN, however, is that no VPN connection is required.
There is no charge for setting up or running a VPC peering connection. Data transferred across peering connections is charged at $0.01/GB for send and receive, regardless of the Availability Zones involved.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With