CfnSubnetProps

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

Bases: object

Properties for defining a CfnSubnet.

Parameters
  • cidr_block (str) – The IPv4 CIDR block assigned to the subnet. If you update this property, we create a new subnet, and then delete the existing one.

  • vpc_id (str) – The ID of the VPC the subnet is in. If you update this property, you must also update the CidrBlock property.

  • assign_ipv6_address_on_creation (Union[bool, IResolvable, None]) – Indicates whether a network interface created in this subnet receives an IPv6 address. The default value is false . If you specify AssignIpv6AddressOnCreation , you must also specify Ipv6CidrBlock . If you specify AssignIpv6AddressOnCreation , you cannot specify MapPublicIpOnLaunch .

  • availability_zone (Optional[str]) – The Availability Zone of the subnet. If you update this property, you must also update the CidrBlock property.

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

  • map_public_ip_on_launch (Union[bool, IResolvable, None]) – Indicates whether instances launched in this subnet receive a public IPv4 address. The default value is false . If you specify MapPublicIpOnLaunch , you cannot specify AssignIpv6AddressOnCreation .

  • outpost_arn (Optional[str]) – The Amazon Resource Name (ARN) of the Outpost.

  • tags (Optional[Sequence[CfnTag]]) – Any tags assigned to the subnet.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html

ExampleMetadata

fixture=_generated

Example:

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

cfn_subnet_props = ec2.CfnSubnetProps(
    cidr_block="cidrBlock",
    vpc_id="vpcId",

    # the properties below are optional
    assign_ipv6_address_on_creation=False,
    availability_zone="availabilityZone",
    ipv6_cidr_block="ipv6CidrBlock",
    map_public_ip_on_launch=False,
    outpost_arn="outpostArn",
    tags=[CfnTag(
        key="key",
        value="value"
    )]
)

Attributes

assign_ipv6_address_on_creation

Indicates whether a network interface created in this subnet receives an IPv6 address. The default value is false .

If you specify AssignIpv6AddressOnCreation , you must also specify Ipv6CidrBlock .

If you specify AssignIpv6AddressOnCreation , you cannot specify MapPublicIpOnLaunch .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-assignipv6addressoncreation

Return type

Union[bool, IResolvable, None]

availability_zone

The Availability Zone of the subnet.

If you update this property, you must also update the CidrBlock property.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-availabilityzone

Return type

Optional[str]

cidr_block

The IPv4 CIDR block assigned to the subnet.

If you update this property, we create a new subnet, and then delete the existing one.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-cidrblock

Return type

str

ipv6_cidr_block

The IPv6 CIDR block.

If you specify AssignIpv6AddressOnCreation , you must also specify Ipv6CidrBlock .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-ipv6cidrblock

Return type

Optional[str]

map_public_ip_on_launch

Indicates whether instances launched in this subnet receive a public IPv4 address. The default value is false .

If you specify MapPublicIpOnLaunch , you cannot specify AssignIpv6AddressOnCreation .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-mappubliciponlaunch

Return type

Union[bool, IResolvable, None]

outpost_arn

The Amazon Resource Name (ARN) of the Outpost.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-outpostarn

Return type

Optional[str]

tags

Any tags assigned to the subnet.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-tags

Return type

Optional[List[CfnTag]]

vpc_id

The ID of the VPC the subnet is in.

If you update this property, you must also update the CidrBlock property.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-awsec2subnet-prop-vpcid

Return type

str