IVpc

class aws_cdk.aws_ec2.IVpc(*args, **kwargs)

Bases: aws_cdk.core.IResource, typing_extensions.Protocol

__init__(*args, **kwargs)

Methods

add_gateway_endpoint(id, *, service, subnets=None)

Adds a new gateway endpoint to this VPC.

Parameters
  • id (str) –

  • options

  • service (IGatewayVpcEndpointService) – The service to use for this gateway VPC endpoint.

  • subnets (Optional[List[SubnetSelection]]) – Where to add endpoint routing. Default: private subnets

Return type

GatewayVpcEndpoint

add_interface_endpoint(id, *, service, private_dns_enabled=None, security_groups=None, subnets=None)

Adds a new interface endpoint to this VPC.

Parameters
  • id (str) –

  • options

  • service (IInterfaceVpcEndpointService) – The service to use for this interface VPC endpoint.

  • private_dns_enabled (Optional[bool]) – Whether to associate a private hosted zone with the specified VPC. This allows you to make requests to the service using its default DNS hostname. Default: true

  • security_groups (Optional[List[ISecurityGroup]]) – The security groups to associate with this interface VPC endpoint. Default: - a new security group is created

  • subnets (Optional[SubnetSelection]) – The subnets in which to create an endpoint network interface. At most one per availability zone. Default: - private subnets

Return type

InterfaceVpcEndpoint

add_vpn_connection(id, *, ip, asn=None, static_routes=None, tunnel_options=None)

Adds a new VPN connection to this VPC.

Parameters
  • id (str) –

  • options

  • ip (str) – The ip address of the customer gateway.

  • asn (Union[int, float, None]) – The ASN of the customer gateway. Default: 65000

  • static_routes (Optional[List[str]]) – The static routes to be routed from the VPN gateway to the customer gateway. Default: Dynamic routing (BGP)

  • tunnel_options (Optional[List[VpnTunnelOption]]) – The tunnel options for the VPN connection. At most two elements (one per tunnel). Duplicates not allowed. Default: Amazon generated tunnel options

Return type

VpnConnection

select_subnets(*, one_per_az=None, subnet_group_name=None, subnet_name=None, subnets=None, subnet_type=None)

Return information on the subnets appropriate for the given selection strategy.

Requires that at least one subnet is matched, throws a descriptive error message otherwise.

Parameters
  • selection

  • one_per_az (Optional[bool]) – If true, return at most one subnet per AZ. Default: false

  • subnet_group_name (Optional[str]) – Select the subnet group with the given name. Select the subnet group with the given name. This only needs to be used if you have multiple subnet groups of the same type and you need to distinguish between them. Otherwise, prefer subnetType. This field does not select individual subnets, it selects all subnets that share the given subnet group name. This is the name supplied in subnetConfiguration. At most one of subnetType and subnetGroupName can be supplied. Default: - Selection by type instead of by name

  • subnet_name (Optional[str]) – Alias for subnetGroupName. Select the subnet group with the given name. This only needs to be used if you have multiple subnet groups of the same type and you need to distinguish between them.

  • subnets (Optional[List[ISubnet]]) – Explicitly select individual subnets. Use this if you don’t want to automatically use all subnets in a group, but have a need to control selection down to individual subnets. Cannot be specified together with subnetType or subnetGroupName. Default: - Use all subnets in a selected group (all private subnets by default)

  • subnet_type (Optional[SubnetType]) – Select all subnets of the given type. At most one of subnetType and subnetGroupName can be supplied. Default: SubnetType.PRIVATE (or ISOLATED or PUBLIC if there are no PRIVATE subnets)

Return type

SelectedSubnets

Attributes

availability_zones

AZs for this VPC.

Return type

List[str]

internet_connectivity_established

Dependable that can be depended upon to force internet connectivity established on the VPC.

Return type

IDependable

isolated_subnets

List of isolated subnets in this VPC.

Return type

List[ISubnet]

node

The construct node in the tree.

Return type

ConstructNode

private_subnets

List of private subnets in this VPC.

Return type

List[ISubnet]

public_subnets

List of public subnets in this VPC.

Return type

List[ISubnet]

stack

The stack in which this resource is defined.

Return type

Stack

vpc_id

Identifier for this VPC.

attribute: :attribute:: true

Return type

str

vpn_gateway_id

Identifier for the VPN gateway.

Return type

Optional[str]