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

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.getSubnet

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.

    Using getSubnet

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getSubnet(args: GetSubnetArgs, opts?: InvokeOptions): Promise<GetSubnetResult>
    function getSubnetOutput(args: GetSubnetOutputArgs, opts?: InvokeOptions): Output<GetSubnetResult>
    def get_subnet(subnet_id: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetSubnetResult
    def get_subnet_output(subnet_id: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetSubnetResult]
    func LookupSubnet(ctx *Context, args *LookupSubnetArgs, opts ...InvokeOption) (*LookupSubnetResult, error)
    func LookupSubnetOutput(ctx *Context, args *LookupSubnetOutputArgs, opts ...InvokeOption) LookupSubnetResultOutput

    > Note: This function is named LookupSubnet in the Go SDK.

    public static class GetSubnet 
    {
        public static Task<GetSubnetResult> InvokeAsync(GetSubnetArgs args, InvokeOptions? opts = null)
        public static Output<GetSubnetResult> Invoke(GetSubnetInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSubnetResult> getSubnet(GetSubnetArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws-native:ec2:getSubnet
      arguments:
        # arguments dictionary

    The following arguments are supported:

    SubnetId string
    SubnetId string
    subnetId String
    subnetId string
    subnetId String

    getSubnet Result

    The following output properties are available:

    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.
    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.
    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.
    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.
    NetworkAclAssociationId string
    PrivateDnsNameOptionsOnLaunch Pulumi.AwsNative.Ec2.Outputs.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)
    SubnetId string
    Tags List<Pulumi.AwsNative.Outputs.Tag>
    Any tags assigned to the subnet.
    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.
    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.
    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.
    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.
    NetworkAclAssociationId string
    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)
    SubnetId string
    Tags Tag
    Any tags assigned to the subnet.
    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.
    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.
    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.
    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.
    networkAclAssociationId String
    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)
    subnetId String
    tags List<Tag>
    Any tags assigned to the subnet.
    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.
    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.
    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.
    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.
    networkAclAssociationId string
    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)
    subnetId string
    tags Tag[]
    Any tags assigned to the subnet.
    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.
    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.
    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.
    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.
    network_acl_association_id str
    private_dns_name_options_on_launch 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)
    subnet_id str
    tags Sequence[root_Tag]
    Any tags assigned to the subnet.
    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.
    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.
    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.
    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.
    networkAclAssociationId String
    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)
    subnetId String
    tags List<Property Map>
    Any tags assigned to the subnet.

    Supporting Types

    PrivateDnsNameOptionsOnLaunchProperties

    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 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