1. Packages
  2. AWS Native
  3. API Docs
  4. ec2
  5. Subnet

AWS Native is in preview. AWS Classic is fully supported.

AWS Native v0.102.0 published on Tuesday, Apr 16, 2024 by Pulumi

aws-native.ec2.Subnet

Explore with Pulumi AI

aws-native logo

AWS Native is in preview. AWS Classic is fully supported.

AWS Native v0.102.0 published on Tuesday, Apr 16, 2024 by Pulumi

    Specifies a subnet for the specified VPC. For an IPv4 only subnet, specify an IPv4 CIDR block. If the VPC has an IPv6 CIDR block, you can create an IPv6 only subnet or a dual stack subnet instead. For an IPv6 only subnet, specify an IPv6 CIDR block. For a dual stack subnet, specify both an IPv4 CIDR block and an IPv6 CIDR block. For more information, see Subnets for your VPC in the Amazon VPC User Guide.

    Create Subnet Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Subnet(name: string, args: SubnetArgs, opts?: CustomResourceOptions);
    @overload
    def Subnet(resource_name: str,
               args: SubnetArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Subnet(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               vpc_id: Optional[str] = None,
               ipv6_cidr_block: Optional[str] = None,
               enable_lni_at_device_index: Optional[int] = None,
               ipv6_cidr_blocks: Optional[Sequence[str]] = None,
               enable_dns64: Optional[bool] = None,
               ipv6_ipam_pool_id: Optional[str] = None,
               ipv4_ipam_pool_id: Optional[str] = None,
               ipv4_netmask_length: Optional[int] = None,
               ipv6_native: Optional[bool] = None,
               cidr_block: Optional[str] = None,
               availability_zone_id: Optional[str] = None,
               assign_ipv6_address_on_creation: Optional[bool] = None,
               ipv6_netmask_length: Optional[int] = None,
               map_public_ip_on_launch: Optional[bool] = None,
               outpost_arn: Optional[str] = None,
               private_dns_name_options_on_launch: Optional[PrivateDnsNameOptionsOnLaunchPropertiesArgs] = None,
               tags: Optional[Sequence[_root_inputs.TagArgs]] = None,
               availability_zone: Optional[str] = None)
    func NewSubnet(ctx *Context, name string, args SubnetArgs, opts ...ResourceOption) (*Subnet, error)
    public Subnet(string name, SubnetArgs args, CustomResourceOptions? opts = null)
    public Subnet(String name, SubnetArgs args)
    public Subnet(String name, SubnetArgs args, CustomResourceOptions options)
    
    type: aws-native:ec2:Subnet
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args SubnetArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args SubnetArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args SubnetArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SubnetArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SubnetArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    const subnetResource = new aws_native.ec2.Subnet("subnetResource", {
        vpcId: "string",
        ipv6CidrBlock: "string",
        enableLniAtDeviceIndex: 0,
        ipv6CidrBlocks: ["string"],
        enableDns64: false,
        ipv6IpamPoolId: "string",
        ipv4IpamPoolId: "string",
        ipv4NetmaskLength: 0,
        ipv6Native: false,
        cidrBlock: "string",
        availabilityZoneId: "string",
        assignIpv6AddressOnCreation: false,
        ipv6NetmaskLength: 0,
        mapPublicIpOnLaunch: false,
        outpostArn: "string",
        privateDnsNameOptionsOnLaunch: {
            enableResourceNameDnsARecord: false,
            enableResourceNameDnsAaaaRecord: false,
            hostnameType: "string",
        },
        tags: [{
            key: "string",
            value: "string",
        }],
        availabilityZone: "string",
    });
    
    Coming soon!
    

    Subnet Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Subnet resource accepts the following input properties:

    VpcId string
    The ID of the VPC the subnet is in. If you update this property, you must also update the CidrBlock property.
    AssignIpv6AddressOnCreation bool
    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 an IPv6 CIDR block.
    AvailabilityZone string
    The Availability Zone of the subnet. If you update this property, you must also update the CidrBlock property.
    AvailabilityZoneId string
    The AZ ID of the subnet.
    CidrBlock string
    The IPv4 CIDR block assigned to the subnet. If you update this property, we create a new subnet, and then delete the existing one.
    EnableDns64 bool
    Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. For more information, see DNS64 and NAT64 in the User Guide.
    EnableLniAtDeviceIndex int
    Indicates the device position for local network interfaces in this subnet. For example, 1 indicates local network interfaces in this subnet are the secondary network interface (eth1).
    Ipv4IpamPoolId string
    An IPv4 IPAM pool ID for the subnet.
    Ipv4NetmaskLength int
    An IPv4 netmask length for the subnet.
    Ipv6CidrBlock string
    The IPv6 CIDR block. If you specify AssignIpv6AddressOnCreation, you must also specify an IPv6 CIDR block.
    Ipv6CidrBlocks List<string>
    The IPv6 network ranges for the subnet, in CIDR notation.
    Ipv6IpamPoolId string
    An IPv6 IPAM pool ID for the subnet.
    Ipv6Native bool
    Indicates whether this is an IPv6 only subnet. For more information, see Subnet basics in the User Guide.
    Ipv6NetmaskLength int
    An IPv6 netmask length for the subnet.
    MapPublicIpOnLaunch bool
    Indicates whether instances launched in this subnet receive a public IPv4 address. The default value is false. AWS charges for all public IPv4 addresses, including public IPv4 addresses associated with running instances and Elastic IP addresses. For more information, see the Public IPv4 Address tab on the VPC pricing page.
    OutpostArn string
    The Amazon Resource Name (ARN) of the Outpost.
    PrivateDnsNameOptionsOnLaunch Pulumi.AwsNative.Ec2.Inputs.PrivateDnsNameOptionsOnLaunchProperties
    The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries to the instances should be handled. For more information, see Amazon EC2 instance hostname types in the User Guide. Available options:

    • EnableResourceNameDnsAAAARecord (true | false)
    • EnableResourceNameDnsARecord (true | false)
    • HostnameType (ip-name | resource-name)
    Tags List<Pulumi.AwsNative.Inputs.Tag>
    Any tags assigned to the subnet.
    VpcId string
    The ID of the VPC the subnet is in. If you update this property, you must also update the CidrBlock property.
    AssignIpv6AddressOnCreation bool
    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 an IPv6 CIDR block.
    AvailabilityZone string
    The Availability Zone of the subnet. If you update this property, you must also update the CidrBlock property.
    AvailabilityZoneId string
    The AZ ID of the subnet.
    CidrBlock string
    The IPv4 CIDR block assigned to the subnet. If you update this property, we create a new subnet, and then delete the existing one.
    EnableDns64 bool
    Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. For more information, see DNS64 and NAT64 in the User Guide.
    EnableLniAtDeviceIndex int
    Indicates the device position for local network interfaces in this subnet. For example, 1 indicates local network interfaces in this subnet are the secondary network interface (eth1).
    Ipv4IpamPoolId string
    An IPv4 IPAM pool ID for the subnet.
    Ipv4NetmaskLength int
    An IPv4 netmask length for the subnet.
    Ipv6CidrBlock string
    The IPv6 CIDR block. If you specify AssignIpv6AddressOnCreation, you must also specify an IPv6 CIDR block.
    Ipv6CidrBlocks []string
    The IPv6 network ranges for the subnet, in CIDR notation.
    Ipv6IpamPoolId string
    An IPv6 IPAM pool ID for the subnet.
    Ipv6Native bool
    Indicates whether this is an IPv6 only subnet. For more information, see Subnet basics in the User Guide.
    Ipv6NetmaskLength int
    An IPv6 netmask length for the subnet.
    MapPublicIpOnLaunch bool
    Indicates whether instances launched in this subnet receive a public IPv4 address. The default value is false. AWS charges for all public IPv4 addresses, including public IPv4 addresses associated with running instances and Elastic IP addresses. For more information, see the Public IPv4 Address tab on the VPC pricing page.
    OutpostArn string
    The Amazon Resource Name (ARN) of the Outpost.
    PrivateDnsNameOptionsOnLaunch PrivateDnsNameOptionsOnLaunchPropertiesArgs
    The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries to the instances should be handled. For more information, see Amazon EC2 instance hostname types in the User Guide. Available options:

    • EnableResourceNameDnsAAAARecord (true | false)
    • EnableResourceNameDnsARecord (true | false)
    • HostnameType (ip-name | resource-name)
    Tags TagArgs
    Any tags assigned to the subnet.
    vpcId String
    The ID of the VPC the subnet is in. If you update this property, you must also update the CidrBlock property.
    assignIpv6AddressOnCreation Boolean
    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 an IPv6 CIDR block.
    availabilityZone String
    The Availability Zone of the subnet. If you update this property, you must also update the CidrBlock property.
    availabilityZoneId String
    The AZ ID of the subnet.
    cidrBlock String
    The IPv4 CIDR block assigned to the subnet. If you update this property, we create a new subnet, and then delete the existing one.
    enableDns64 Boolean
    Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. For more information, see DNS64 and NAT64 in the User Guide.
    enableLniAtDeviceIndex Integer
    Indicates the device position for local network interfaces in this subnet. For example, 1 indicates local network interfaces in this subnet are the secondary network interface (eth1).
    ipv4IpamPoolId String
    An IPv4 IPAM pool ID for the subnet.
    ipv4NetmaskLength Integer
    An IPv4 netmask length for the subnet.
    ipv6CidrBlock String
    The IPv6 CIDR block. If you specify AssignIpv6AddressOnCreation, you must also specify an IPv6 CIDR block.
    ipv6CidrBlocks List<String>
    The IPv6 network ranges for the subnet, in CIDR notation.
    ipv6IpamPoolId String
    An IPv6 IPAM pool ID for the subnet.
    ipv6Native Boolean
    Indicates whether this is an IPv6 only subnet. For more information, see Subnet basics in the User Guide.
    ipv6NetmaskLength Integer
    An IPv6 netmask length for the subnet.
    mapPublicIpOnLaunch Boolean
    Indicates whether instances launched in this subnet receive a public IPv4 address. The default value is false. AWS charges for all public IPv4 addresses, including public IPv4 addresses associated with running instances and Elastic IP addresses. For more information, see the Public IPv4 Address tab on the VPC pricing page.
    outpostArn String
    The Amazon Resource Name (ARN) of the Outpost.
    privateDnsNameOptionsOnLaunch PrivateDnsNameOptionsOnLaunchProperties
    The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries to the instances should be handled. For more information, see Amazon EC2 instance hostname types in the User Guide. Available options:

    • EnableResourceNameDnsAAAARecord (true | false)
    • EnableResourceNameDnsARecord (true | false)
    • HostnameType (ip-name | resource-name)
    tags List<Tag>
    Any tags assigned to the subnet.
    vpcId string
    The ID of the VPC the subnet is in. If you update this property, you must also update the CidrBlock property.
    assignIpv6AddressOnCreation boolean
    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 an IPv6 CIDR block.
    availabilityZone string
    The Availability Zone of the subnet. If you update this property, you must also update the CidrBlock property.
    availabilityZoneId string
    The AZ ID of the subnet.
    cidrBlock string
    The IPv4 CIDR block assigned to the subnet. If you update this property, we create a new subnet, and then delete the existing one.
    enableDns64 boolean
    Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. For more information, see DNS64 and NAT64 in the User Guide.
    enableLniAtDeviceIndex number
    Indicates the device position for local network interfaces in this subnet. For example, 1 indicates local network interfaces in this subnet are the secondary network interface (eth1).
    ipv4IpamPoolId string
    An IPv4 IPAM pool ID for the subnet.
    ipv4NetmaskLength number
    An IPv4 netmask length for the subnet.
    ipv6CidrBlock string
    The IPv6 CIDR block. If you specify AssignIpv6AddressOnCreation, you must also specify an IPv6 CIDR block.
    ipv6CidrBlocks string[]
    The IPv6 network ranges for the subnet, in CIDR notation.
    ipv6IpamPoolId string
    An IPv6 IPAM pool ID for the subnet.
    ipv6Native boolean
    Indicates whether this is an IPv6 only subnet. For more information, see Subnet basics in the User Guide.
    ipv6NetmaskLength number
    An IPv6 netmask length for the subnet.
    mapPublicIpOnLaunch boolean
    Indicates whether instances launched in this subnet receive a public IPv4 address. The default value is false. AWS charges for all public IPv4 addresses, including public IPv4 addresses associated with running instances and Elastic IP addresses. For more information, see the Public IPv4 Address tab on the VPC pricing page.
    outpostArn string
    The Amazon Resource Name (ARN) of the Outpost.
    privateDnsNameOptionsOnLaunch PrivateDnsNameOptionsOnLaunchProperties
    The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries to the instances should be handled. For more information, see Amazon EC2 instance hostname types in the User Guide. Available options:

    • EnableResourceNameDnsAAAARecord (true | false)
    • EnableResourceNameDnsARecord (true | false)
    • HostnameType (ip-name | resource-name)
    tags Tag[]
    Any tags assigned to the subnet.
    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 bool
    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 an IPv6 CIDR block.
    availability_zone str
    The Availability Zone of the subnet. If you update this property, you must also update the CidrBlock property.
    availability_zone_id str
    The AZ ID of the subnet.
    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.
    enable_dns64 bool
    Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. For more information, see DNS64 and NAT64 in the User Guide.
    enable_lni_at_device_index int
    Indicates the device position for local network interfaces in this subnet. For example, 1 indicates local network interfaces in this subnet are the secondary network interface (eth1).
    ipv4_ipam_pool_id str
    An IPv4 IPAM pool ID for the subnet.
    ipv4_netmask_length int
    An IPv4 netmask length for the subnet.
    ipv6_cidr_block str
    The IPv6 CIDR block. If you specify AssignIpv6AddressOnCreation, you must also specify an IPv6 CIDR block.
    ipv6_cidr_blocks Sequence[str]
    The IPv6 network ranges for the subnet, in CIDR notation.
    ipv6_ipam_pool_id str
    An IPv6 IPAM pool ID for the subnet.
    ipv6_native bool
    Indicates whether this is an IPv6 only subnet. For more information, see Subnet basics in the User Guide.
    ipv6_netmask_length int
    An IPv6 netmask length for the subnet.
    map_public_ip_on_launch bool
    Indicates whether instances launched in this subnet receive a public IPv4 address. The default value is false. AWS charges for all public IPv4 addresses, including public IPv4 addresses associated with running instances and Elastic IP addresses. For more information, see the Public IPv4 Address tab on the VPC pricing page.
    outpost_arn str
    The Amazon Resource Name (ARN) of the Outpost.
    private_dns_name_options_on_launch PrivateDnsNameOptionsOnLaunchPropertiesArgs
    The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries to the instances should be handled. For more information, see Amazon EC2 instance hostname types in the User Guide. Available options:

    • EnableResourceNameDnsAAAARecord (true | false)
    • EnableResourceNameDnsARecord (true | false)
    • HostnameType (ip-name | resource-name)
    tags Sequence[TagArgs]
    Any tags assigned to the subnet.
    vpcId String
    The ID of the VPC the subnet is in. If you update this property, you must also update the CidrBlock property.
    assignIpv6AddressOnCreation Boolean
    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 an IPv6 CIDR block.
    availabilityZone String
    The Availability Zone of the subnet. If you update this property, you must also update the CidrBlock property.
    availabilityZoneId String
    The AZ ID of the subnet.
    cidrBlock String
    The IPv4 CIDR block assigned to the subnet. If you update this property, we create a new subnet, and then delete the existing one.
    enableDns64 Boolean
    Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. For more information, see DNS64 and NAT64 in the User Guide.
    enableLniAtDeviceIndex Number
    Indicates the device position for local network interfaces in this subnet. For example, 1 indicates local network interfaces in this subnet are the secondary network interface (eth1).
    ipv4IpamPoolId String
    An IPv4 IPAM pool ID for the subnet.
    ipv4NetmaskLength Number
    An IPv4 netmask length for the subnet.
    ipv6CidrBlock String
    The IPv6 CIDR block. If you specify AssignIpv6AddressOnCreation, you must also specify an IPv6 CIDR block.
    ipv6CidrBlocks List<String>
    The IPv6 network ranges for the subnet, in CIDR notation.
    ipv6IpamPoolId String
    An IPv6 IPAM pool ID for the subnet.
    ipv6Native Boolean
    Indicates whether this is an IPv6 only subnet. For more information, see Subnet basics in the User Guide.
    ipv6NetmaskLength Number
    An IPv6 netmask length for the subnet.
    mapPublicIpOnLaunch Boolean
    Indicates whether instances launched in this subnet receive a public IPv4 address. The default value is false. AWS charges for all public IPv4 addresses, including public IPv4 addresses associated with running instances and Elastic IP addresses. For more information, see the Public IPv4 Address tab on the VPC pricing page.
    outpostArn String
    The Amazon Resource Name (ARN) of the Outpost.
    privateDnsNameOptionsOnLaunch Property Map
    The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries to the instances should be handled. For more information, see Amazon EC2 instance hostname types in the User Guide. Available options:

    • EnableResourceNameDnsAAAARecord (true | false)
    • EnableResourceNameDnsARecord (true | false)
    • HostnameType (ip-name | resource-name)
    tags List<Property Map>
    Any tags assigned to the subnet.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Subnet resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    NetworkAclAssociationId string
    SubnetId string
    Id string
    The provider-assigned unique ID for this managed resource.
    NetworkAclAssociationId string
    SubnetId string
    id String
    The provider-assigned unique ID for this managed resource.
    networkAclAssociationId String
    subnetId String
    id string
    The provider-assigned unique ID for this managed resource.
    networkAclAssociationId string
    subnetId string
    id str
    The provider-assigned unique ID for this managed resource.
    network_acl_association_id str
    subnet_id str
    id String
    The provider-assigned unique ID for this managed resource.
    networkAclAssociationId String
    subnetId String

    Supporting Types

    PrivateDnsNameOptionsOnLaunchProperties, PrivateDnsNameOptionsOnLaunchPropertiesArgs

    Tag, TagArgs

    Key string
    The key name of the tag
    Value string
    The value of the tag
    Key string
    The key name of the tag
    Value string
    The value of the tag
    key String
    The key name of the tag
    value String
    The value of the tag
    key string
    The key name of the tag
    value string
    The value of the tag
    key str
    The key name of the tag
    value str
    The value of the tag
    key String
    The key name of the tag
    value String
    The value of the tag

    Package Details

    Repository
    AWS Native pulumi/pulumi-aws-native
    License
    Apache-2.0
    aws-native logo

    AWS Native is in preview. AWS Classic is fully supported.

    AWS Native v0.102.0 published on Tuesday, Apr 16, 2024 by Pulumi