PublicSubnetProps

class aws_cdk.aws_ec2.PublicSubnetProps(*, availability_zone, cidr_block, vpc_id, assign_ipv6_address_on_creation=None, ipv6_cidr_block=None, map_public_ip_on_launch=None)

Bases: SubnetProps

Parameters:
  • availability_zone (str) – The availability zone for the subnet.

  • cidr_block (str) – The CIDR notation for this subnet.

  • vpc_id (str) – The VPC which this subnet is part of.

  • assign_ipv6_address_on_creation (Optional[bool]) – Indicates whether a network interface created in this subnet receives an IPv6 address. If you specify AssignIpv6AddressOnCreation, you must also specify Ipv6CidrBlock. Default: false

  • ipv6_cidr_block (Optional[str]) – The IPv6 CIDR block. If you specify AssignIpv6AddressOnCreation, you must also specify Ipv6CidrBlock. Default: - no IPv6 CIDR block.

  • map_public_ip_on_launch (Optional[bool]) – Controls if a public IP is associated to an instance at launch. Default: true in Subnet.Public, false in Subnet.Private or Subnet.Isolated.

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

public_subnet_props = ec2.PublicSubnetProps(
    availability_zone="availabilityZone",
    cidr_block="cidrBlock",
    vpc_id="vpcId",

    # the properties below are optional
    assign_ipv6_address_on_creation=False,
    ipv6_cidr_block="ipv6CidrBlock",
    map_public_ip_on_launch=False
)

Attributes

assign_ipv6_address_on_creation

Indicates whether a network interface created in this subnet receives an IPv6 address.

If you specify AssignIpv6AddressOnCreation, you must also specify Ipv6CidrBlock.

Default:

false

availability_zone

The availability zone for the subnet.

cidr_block

The CIDR notation for this subnet.

ipv6_cidr_block

The IPv6 CIDR block.

If you specify AssignIpv6AddressOnCreation, you must also specify Ipv6CidrBlock.

Default:
  • no IPv6 CIDR block.

map_public_ip_on_launch

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

Default:

true in Subnet.Public, false in Subnet.Private or Subnet.Isolated.

vpc_id

The VPC which this subnet is part of.