SubnetConfiguration

class aws_cdk.aws_ec2.SubnetConfiguration(*, name, subnet_type, cidr_mask=None, ipv6_assign_address_on_creation=None, map_public_ip_on_launch=None, reserved=None)

Bases: object

Specify configuration parameters for a single subnet group in a VPC.

Parameters:
  • name (str) – Logical name for the subnet group. This name can be used when selecting VPC subnets to distinguish between different subnet groups of the same type.

  • subnet_type (SubnetType) – The type of Subnet to configure. The Subnet type will control the ability to route and connect to the Internet.

  • cidr_mask (Union[int, float, None]) – The number of leading 1 bits in the routing mask. The number of available IP addresses in each subnet of this group will be equal to 2^(32 - cidrMask) - 2. Valid values are 16--28. Note this is specific to IPv4 addresses. Default: - Available IP space is evenly divided across subnets.

  • ipv6_assign_address_on_creation (Optional[bool]) – This property is specific to dual stack VPCs. If set to false, then an IPv6 address will not be automatically assigned. Note this is specific to IPv6 addresses. Default: true

  • map_public_ip_on_launch (Optional[bool]) – Controls if a public IPv4 address is associated to an instance at launch. Note this is specific to IPv4 addresses. Default: true in Subnet.Public of IPV4_ONLY VPCs, false otherwise

  • reserved (Optional[bool]) – Controls if subnet IP space needs to be reserved. When true, the IP space for the subnet is reserved but no actual resources are provisioned. This space is only dependent on the number of availability zones and on cidrMask - all other subnet properties are ignored. Default: false

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ec2 as ec2

subnet_configuration = ec2.SubnetConfiguration(
    name="name",
    subnet_type=ec2.SubnetType.PRIVATE_ISOLATED,

    # the properties below are optional
    cidr_mask=123,
    ipv6_assign_address_on_creation=False,
    map_public_ip_on_launch=False,
    reserved=False
)

Attributes

cidr_mask

The number of leading 1 bits in the routing mask.

The number of available IP addresses in each subnet of this group will be equal to 2^(32 - cidrMask) - 2.

Valid values are 16--28.

Note this is specific to IPv4 addresses.

Default:
  • Available IP space is evenly divided across subnets.

ipv6_assign_address_on_creation

This property is specific to dual stack VPCs.

If set to false, then an IPv6 address will not be automatically assigned.

Note this is specific to IPv6 addresses.

Default:

true

map_public_ip_on_launch

Controls if a public IPv4 address is associated to an instance at launch.

Note this is specific to IPv4 addresses.

Default:

true in Subnet.Public of IPV4_ONLY VPCs, false otherwise

name

Logical name for the subnet group.

This name can be used when selecting VPC subnets to distinguish between different subnet groups of the same type.

reserved

Controls if subnet IP space needs to be reserved.

When true, the IP space for the subnet is reserved but no actual resources are provisioned. This space is only dependent on the number of availability zones and on cidrMask - all other subnet properties are ignored.

Default:

false

subnet_type

The type of Subnet to configure.

The Subnet type will control the ability to route and connect to the Internet.