VPCPeeringConnectionOptions

class aws_cdk.aws_ec2_alpha.VPCPeeringConnectionOptions(*, acceptor_vpc, peer_role_arn=None, vpc_peering_connection_name=None)

Bases: object

(experimental) Options to define a VPC peering connection.

Parameters:
  • acceptor_vpc (IVpcV2) – (experimental) The VPC that is accepting the peering connection.

  • peer_role_arn (Optional[str]) – (experimental) The role arn created in the acceptor account. Default: - no peerRoleArn needed if not cross account connection

  • vpc_peering_connection_name (Optional[str]) – (experimental) The resource name of the peering connection. Default: - peering connection provisioned without any name

Stability:

experimental

ExampleMetadata:

infused

Example:

stack = Stack()

acceptor_vpc = VpcV2(self, "VpcA",
    primary_address_block=IpAddresses.ipv4("10.0.0.0/16")
)

requestor_vpc = VpcV2(self, "VpcB",
    primary_address_block=IpAddresses.ipv4("10.1.0.0/16")
)

peering_connection = requestor_vpc.create_peering_connection("peeringConnection",
    acceptor_vpc=acceptor_vpc
)

route_table = RouteTable(self, "RouteTable",
    vpc=requestor_vpc
)

route_table.add_route("vpcPeeringRoute", "10.0.0.0/16", {"gateway": peering_connection})

Attributes

acceptor_vpc

(experimental) The VPC that is accepting the peering connection.

Stability:

experimental

peer_role_arn

(experimental) The role arn created in the acceptor account.

Default:
  • no peerRoleArn needed if not cross account connection

Stability:

experimental

vpc_peering_connection_name

(experimental) The resource name of the peering connection.

Default:
  • peering connection provisioned without any name

Stability:

experimental