VpcAttributes

class aws_cdk.aws_ec2.VpcAttributes(*, availability_zones, vpc_id, isolated_subnet_ids=None, isolated_subnet_ipv4_cidr_blocks=None, isolated_subnet_names=None, isolated_subnet_route_table_ids=None, private_subnet_ids=None, private_subnet_ipv4_cidr_blocks=None, private_subnet_names=None, private_subnet_route_table_ids=None, public_subnet_ids=None, public_subnet_ipv4_cidr_blocks=None, public_subnet_names=None, public_subnet_route_table_ids=None, region=None, vpc_cidr_block=None, vpn_gateway_id=None)

Bases: object

Properties that reference an external Vpc.

Parameters:
  • availability_zones (Sequence[str]) – List of availability zones for the subnets in this VPC.

  • vpc_id (str) – VPC’s identifier.

  • isolated_subnet_ids (Optional[Sequence[str]]) – List of isolated subnet IDs. Must be undefined or match the availability zones in length and order. Default: - The VPC does not have any isolated subnets

  • isolated_subnet_ipv4_cidr_blocks (Optional[Sequence[str]]) – List of IPv4 CIDR blocks for the isolated subnets. Must be undefined or have an entry for every isolated subnet group. Default: - Retrieving the IPv4 CIDR block of any isolated subnet will fail

  • isolated_subnet_names (Optional[Sequence[str]]) – List of names for the isolated subnets. Must be undefined or have a name for every isolated subnet group. Default: - All isolated subnets will have the name Isolated

  • isolated_subnet_route_table_ids (Optional[Sequence[str]]) – List of IDs of route tables for the isolated subnets. Must be undefined or have a name for every isolated subnet group. Default: - Retrieving the route table ID of any isolated subnet will fail

  • private_subnet_ids (Optional[Sequence[str]]) – List of private subnet IDs. Must be undefined or match the availability zones in length and order. Default: - The VPC does not have any private subnets

  • private_subnet_ipv4_cidr_blocks (Optional[Sequence[str]]) – List of IPv4 CIDR blocks for the private subnets. Must be undefined or have an entry for every private subnet group. Default: - Retrieving the IPv4 CIDR block of any private subnet will fail

  • private_subnet_names (Optional[Sequence[str]]) – List of names for the private subnets. Must be undefined or have a name for every private subnet group. Default: - All private subnets will have the name Private

  • private_subnet_route_table_ids (Optional[Sequence[str]]) – List of IDs of route tables for the private subnets. Must be undefined or have a name for every private subnet group. Default: - Retrieving the route table ID of any private subnet will fail

  • public_subnet_ids (Optional[Sequence[str]]) – List of public subnet IDs. Must be undefined or match the availability zones in length and order. Default: - The VPC does not have any public subnets

  • public_subnet_ipv4_cidr_blocks (Optional[Sequence[str]]) – List of IPv4 CIDR blocks for the public subnets. Must be undefined or have an entry for every public subnet group. Default: - Retrieving the IPv4 CIDR block of any public subnet will fail

  • public_subnet_names (Optional[Sequence[str]]) – List of names for the public subnets. Must be undefined or have a name for every public subnet group. Default: - All public subnets will have the name Public

  • public_subnet_route_table_ids (Optional[Sequence[str]]) – List of IDs of route tables for the public subnets. Must be undefined or have a name for every public subnet group. Default: - Retrieving the route table ID of any public subnet will fail

  • region (Optional[str]) – The region the VPC is in. Default: - The region of the stack where the VPC belongs to

  • vpc_cidr_block (Optional[str]) – VPC’s CIDR range. Default: - Retrieving the CIDR from the VPC will fail

  • vpn_gateway_id (Optional[str]) – VPN gateway’s identifier.

ExampleMetadata:

infused

Example:

vpc = ec2.Vpc.from_vpc_attributes(self, "VPC",
    vpc_id="vpc-1234",
    availability_zones=["us-east-1a", "us-east-1b"],

    # Either pass literals for all IDs
    public_subnet_ids=["s-12345", "s-67890"],

    # OR: import a list of known length
    private_subnet_ids=Fn.import_list_value("PrivateSubnetIds", 2),

    # OR: split an imported string to a list of known length
    isolated_subnet_ids=Fn.split(",", ssm.StringParameter.value_for_string_parameter(self, "MyParameter"), 2)
)

Attributes

availability_zones

List of availability zones for the subnets in this VPC.

isolated_subnet_ids

List of isolated subnet IDs.

Must be undefined or match the availability zones in length and order.

Default:
  • The VPC does not have any isolated subnets

isolated_subnet_ipv4_cidr_blocks

List of IPv4 CIDR blocks for the isolated subnets.

Must be undefined or have an entry for every isolated subnet group.

Default:
  • Retrieving the IPv4 CIDR block of any isolated subnet will fail

isolated_subnet_names

List of names for the isolated subnets.

Must be undefined or have a name for every isolated subnet group.

Default:
  • All isolated subnets will have the name Isolated

isolated_subnet_route_table_ids

List of IDs of route tables for the isolated subnets.

Must be undefined or have a name for every isolated subnet group.

Default:
  • Retrieving the route table ID of any isolated subnet will fail

private_subnet_ids

List of private subnet IDs.

Must be undefined or match the availability zones in length and order.

Default:
  • The VPC does not have any private subnets

private_subnet_ipv4_cidr_blocks

List of IPv4 CIDR blocks for the private subnets.

Must be undefined or have an entry for every private subnet group.

Default:
  • Retrieving the IPv4 CIDR block of any private subnet will fail

private_subnet_names

List of names for the private subnets.

Must be undefined or have a name for every private subnet group.

Default:
  • All private subnets will have the name Private

private_subnet_route_table_ids

List of IDs of route tables for the private subnets.

Must be undefined or have a name for every private subnet group.

Default:
  • Retrieving the route table ID of any private subnet will fail

public_subnet_ids

List of public subnet IDs.

Must be undefined or match the availability zones in length and order.

Default:
  • The VPC does not have any public subnets

public_subnet_ipv4_cidr_blocks

List of IPv4 CIDR blocks for the public subnets.

Must be undefined or have an entry for every public subnet group.

Default:
  • Retrieving the IPv4 CIDR block of any public subnet will fail

public_subnet_names

List of names for the public subnets.

Must be undefined or have a name for every public subnet group.

Default:
  • All public subnets will have the name Public

public_subnet_route_table_ids

List of IDs of route tables for the public subnets.

Must be undefined or have a name for every public subnet group.

Default:
  • Retrieving the route table ID of any public subnet will fail

region

The region the VPC is in.

Default:
  • The region of the stack where the VPC belongs to

vpc_cidr_block

VPC’s CIDR range.

Default:
  • Retrieving the CIDR from the VPC will fail

vpc_id

VPC’s identifier.

vpn_gateway_id

VPN gateway’s identifier.