VpcV2Attributes

class aws_cdk.aws_ec2_alpha.VpcV2Attributes(*, vpc_cidr_block, vpc_id, owner_account_id=None, region=None, secondary_cidr_blocks=None, subnets=None, vpn_gateway_id=None)

Bases: object

(experimental) Options to import a VPC created outside of CDK stack.

Parameters:
  • vpc_cidr_block (str) – (experimental) Primary VPC CIDR Block of the imported VPC Can only be IPv4.

  • vpc_id (str) – (experimental) The VPC ID Refers to physical Id of the resource.

  • owner_account_id (Optional[str]) – (experimental) The ID of the AWS account that owns the imported VPC required in case of cross account VPC as given value will be used to set field account for imported VPC, which then later can be used for establishing VPC peering connection. Default: - constructed with stack account value

  • region (Optional[str]) – (experimental) Region in which imported VPC is hosted required in case of cross region VPC as given value will be used to set field region for imported VPC, which then later can be used for establishing VPC peering connection. Default: - constructed with stack region value

  • secondary_cidr_blocks (Optional[Sequence[Union[VPCCidrBlockattributes, Dict[str, Any]]]]) – (experimental) Import Secondary CIDR blocks associated with VPC. Default: - No secondary IP address

  • subnets (Optional[Sequence[Union[SubnetV2Attributes, Dict[str, Any]]]]) – (experimental) Subnets associated with imported VPC. Default: - no subnets provided to be imported

  • vpn_gateway_id (Optional[str]) – (experimental) A VPN Gateway is attached to the VPC. Default: - No VPN Gateway

Stability:

experimental

ExampleMetadata:

infused

Example:

stack = Stack()

acceptor_vpc = VpcV2.from_vpc_v2_attributes(self, "acceptorVpc",
    vpc_id="vpc-XXXX",
    vpc_cidr_block="10.0.0.0/16",
    region="us-east-2",
    owner_account_id="111111111111"
)

acceptor_role_arn = "arn:aws:iam::111111111111:role/VpcPeeringRole"

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

peering_connection = requestor_vpc.create_peering_connection("crossAccountCrossRegionPeering",
    acceptor_vpc=acceptor_vpc,
    peer_role_arn=acceptor_role_arn
)

Attributes

owner_account_id

(experimental) The ID of the AWS account that owns the imported VPC required in case of cross account VPC as given value will be used to set field account for imported VPC, which then later can be used for establishing VPC peering connection.

Default:
  • constructed with stack account value

Stability:

experimental

region

(experimental) Region in which imported VPC is hosted required in case of cross region VPC as given value will be used to set field region for imported VPC, which then later can be used for establishing VPC peering connection.

Default:
  • constructed with stack region value

Stability:

experimental

secondary_cidr_blocks

(experimental) Import Secondary CIDR blocks associated with VPC.

Default:
  • No secondary IP address

Stability:

experimental

subnets

(experimental) Subnets associated with imported VPC.

Default:
  • no subnets provided to be imported

Stability:

experimental

vpc_cidr_block

(experimental) Primary VPC CIDR Block of the imported VPC Can only be IPv4.

Stability:

experimental

vpc_id

(experimental) The VPC ID Refers to physical Id of the resource.

Stability:

experimental

vpn_gateway_id

(experimental) A VPN Gateway is attached to the VPC.

Default:
  • No VPN Gateway

Stability:

experimental