VpcAttributes

class aws_cdk.aws_ec2.VpcAttributes(*, availability_zones, vpc_id, isolated_subnet_ids=None, isolated_subnet_names=None, isolated_subnet_route_table_ids=None, private_subnet_ids=None, private_subnet_names=None, private_subnet_route_table_ids=None, public_subnet_ids=None, public_subnet_names=None, public_subnet_route_table_ids=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.

  • 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.

  • isolated_subnet_route_table_ids (Optional[Sequence[str]]) – List of IDs of routing tables for the isolated subnets. Must be undefined or have a name for every isolated subnet group.

  • private_subnet_ids (Optional[Sequence[str]]) – List of private subnet IDs. Must be undefined or match the availability zones in length and order.

  • 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.

  • private_subnet_route_table_ids (Optional[Sequence[str]]) – List of IDs of routing tables for the private subnets. Must be undefined or have a name for every private subnet group.

  • public_subnet_ids (Optional[Sequence[str]]) – List of public subnet IDs. Must be undefined or match the availability zones in length and order.

  • 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.

  • public_subnet_route_table_ids (Optional[Sequence[str]]) – List of IDs of routing tables for the public subnets. Must be undefined or have a name for every public subnet group.

  • 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:

sg = ec2.SecurityGroup.from_security_group_id(self, "FsxSecurityGroup", "{SECURITY-GROUP-ID}")
fs = fsx.LustreFileSystem.from_lustre_file_system_attributes(self, "FsxLustreFileSystem",
    dns_name="{FILE-SYSTEM-DNS-NAME}",
    file_system_id="{FILE-SYSTEM-ID}",
    security_group=sg
)

vpc = ec2.Vpc.from_vpc_attributes(self, "Vpc",
    availability_zones=["us-west-2a", "us-west-2b"],
    public_subnet_ids=["{US-WEST-2A-SUBNET-ID}", "{US-WEST-2B-SUBNET-ID}"],
    vpc_id="{VPC-ID}"
)

inst = ec2.Instance(self, "inst",
    instance_type=ec2.InstanceType.of(ec2.InstanceClass.T2, ec2.InstanceSize.LARGE),
    machine_image=ec2.AmazonLinuxImage(
        generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2
    ),
    vpc=vpc,
    vpc_subnets=ec2.SubnetSelection(
        subnet_type=ec2.SubnetType.PUBLIC
    )
)

fs.connections.allow_default_port_from(inst)

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.

isolated_subnet_names

List of names for the isolated subnets.

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

isolated_subnet_route_table_ids

List of IDs of routing tables for the isolated subnets.

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

private_subnet_ids

List of private subnet IDs.

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

private_subnet_names

List of names for the private subnets.

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

private_subnet_route_table_ids

List of IDs of routing tables for the private subnets.

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

public_subnet_ids

List of public subnet IDs.

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

public_subnet_names

List of names for the public subnets.

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

public_subnet_route_table_ids

List of IDs of routing tables for the public subnets.

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

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.