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.109.0 published on Wednesday, Jun 26, 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.109.0 published on Wednesday, Jun 26, 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
    The ID of the subnet.
    SubnetId string
    The ID of the subnet.
    subnetId String
    The ID of the subnet.
    subnetId string
    The ID of the subnet.
    subnet_id str
    The ID of the subnet.
    subnetId String
    The ID of the subnet.

    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
    The ID of the network ACL that is associated with the subnet's VPC, such as acl-5fb85d36 .
    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
    The ID of the subnet.
    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
    The ID of the network ACL that is associated with the subnet's VPC, such as acl-5fb85d36 .
    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
    The ID of the subnet.
    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
    The ID of the network ACL that is associated with the subnet's VPC, such as acl-5fb85d36 .
    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
    The ID of the subnet.
    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
    The ID of the network ACL that is associated with the subnet's VPC, such as acl-5fb85d36 .
    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
    The ID of the subnet.
    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
    The ID of the network ACL that is associated with the subnet's VPC, such as acl-5fb85d36 .
    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
    The ID of the subnet.
    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
    The ID of the network ACL that is associated with the subnet's VPC, such as acl-5fb85d36 .
    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
    The ID of the subnet.
    tags List<Property Map>
    Any tags assigned to the subnet.

    Supporting Types

    PrivateDnsNameOptionsOnLaunchProperties

    EnableResourceNameDnsARecord bool
    Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
    EnableResourceNameDnsAaaaRecord bool
    Indicates whether to respond to DNS queries for instance hostname with DNS AAAA records.
    HostnameType string
    The type of hostname for EC2 instances. For IPv4 only subnets, an instance DNS name must be based on the instance IPv4 address. For IPv6 only subnets, an instance DNS name must be based on the instance ID. For dual-stack subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID.
    EnableResourceNameDnsARecord bool
    Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
    EnableResourceNameDnsAaaaRecord bool
    Indicates whether to respond to DNS queries for instance hostname with DNS AAAA records.
    HostnameType string
    The type of hostname for EC2 instances. For IPv4 only subnets, an instance DNS name must be based on the instance IPv4 address. For IPv6 only subnets, an instance DNS name must be based on the instance ID. For dual-stack subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID.
    enableResourceNameDnsARecord Boolean
    Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
    enableResourceNameDnsAaaaRecord Boolean
    Indicates whether to respond to DNS queries for instance hostname with DNS AAAA records.
    hostnameType String
    The type of hostname for EC2 instances. For IPv4 only subnets, an instance DNS name must be based on the instance IPv4 address. For IPv6 only subnets, an instance DNS name must be based on the instance ID. For dual-stack subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID.
    enableResourceNameDnsARecord boolean
    Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
    enableResourceNameDnsAaaaRecord boolean
    Indicates whether to respond to DNS queries for instance hostname with DNS AAAA records.
    hostnameType string
    The type of hostname for EC2 instances. For IPv4 only subnets, an instance DNS name must be based on the instance IPv4 address. For IPv6 only subnets, an instance DNS name must be based on the instance ID. For dual-stack subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID.
    enable_resource_name_dns_a_record bool
    Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
    enable_resource_name_dns_aaaa_record bool
    Indicates whether to respond to DNS queries for instance hostname with DNS AAAA records.
    hostname_type str
    The type of hostname for EC2 instances. For IPv4 only subnets, an instance DNS name must be based on the instance IPv4 address. For IPv6 only subnets, an instance DNS name must be based on the instance ID. For dual-stack subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID.
    enableResourceNameDnsARecord Boolean
    Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
    enableResourceNameDnsAaaaRecord Boolean
    Indicates whether to respond to DNS queries for instance hostname with DNS AAAA records.
    hostnameType String
    The type of hostname for EC2 instances. For IPv4 only subnets, an instance DNS name must be based on the instance IPv4 address. For IPv6 only subnets, an instance DNS name must be based on the instance ID. For dual-stack subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID.

    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.109.0 published on Wednesday, Jun 26, 2024 by Pulumi