AWS Native is in preview. AWS Classic is fully supported.
aws-native.ec2.getSubnet
Explore with Pulumi AI
AWS Native is in preview. AWS Classic is fully supported.
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 dictionaryThe 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:
- AssignIpv6Address boolOn Creation 
- Indicates whether a network interface created in this subnet receives an IPv6 address. The default value is false. If you specifyAssignIpv6AddressOnCreation, 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.
- MapPublic boolIp On Launch 
- 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.
- NetworkAcl stringAssociation Id 
- The ID of the network ACL that is associated with the subnet's VPC, such as acl-5fb85d36.
- PrivateDns Pulumi.Name Options On Launch Aws Native. Ec2. Outputs. Private Dns Name Options On Launch Properties 
- 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.
- 
List<Pulumi.Aws Native. Outputs. Tag> 
- Any tags assigned to the subnet.
- AssignIpv6Address boolOn Creation 
- Indicates whether a network interface created in this subnet receives an IPv6 address. The default value is false. If you specifyAssignIpv6AddressOnCreation, 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.
- MapPublic boolIp On Launch 
- 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.
- NetworkAcl stringAssociation Id 
- The ID of the network ACL that is associated with the subnet's VPC, such as acl-5fb85d36.
- PrivateDns PrivateName Options On Launch Dns Name Options On Launch Properties 
- 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.
- Tag
- Any tags assigned to the subnet.
- assignIpv6Address BooleanOn Creation 
- Indicates whether a network interface created in this subnet receives an IPv6 address. The default value is false. If you specifyAssignIpv6AddressOnCreation, 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.
- mapPublic BooleanIp On Launch 
- 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.
- networkAcl StringAssociation Id 
- The ID of the network ACL that is associated with the subnet's VPC, such as acl-5fb85d36.
- privateDns PrivateName Options On Launch Dns Name Options On Launch Properties 
- 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.
- List<Tag>
- Any tags assigned to the subnet.
- assignIpv6Address booleanOn Creation 
- Indicates whether a network interface created in this subnet receives an IPv6 address. The default value is false. If you specifyAssignIpv6AddressOnCreation, 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.
- mapPublic booleanIp On Launch 
- 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.
- networkAcl stringAssociation Id 
- The ID of the network ACL that is associated with the subnet's VPC, such as acl-5fb85d36.
- privateDns PrivateName Options On Launch Dns Name Options On Launch Properties 
- 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.
- Tag[]
- Any tags assigned to the subnet.
- assign_ipv6_ booladdress_ on_ creation 
- Indicates whether a network interface created in this subnet receives an IPv6 address. The default value is false. If you specifyAssignIpv6AddressOnCreation, 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_ strblock 
- The IPv6 CIDR block.
If you specify AssignIpv6AddressOnCreation, you must also specify an IPv6 CIDR block.
- ipv6_cidr_ Sequence[str]blocks 
- The IPv6 network ranges for the subnet, in CIDR notation.
- map_public_ boolip_ on_ launch 
- 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_ strassociation_ id 
- The ID of the network ACL that is associated with the subnet's VPC, such as acl-5fb85d36.
- private_dns_ Privatename_ options_ on_ launch Dns Name Options On Launch Properties 
- 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.
- Sequence[root_Tag]
- Any tags assigned to the subnet.
- assignIpv6Address BooleanOn Creation 
- Indicates whether a network interface created in this subnet receives an IPv6 address. The default value is false. If you specifyAssignIpv6AddressOnCreation, 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.
- mapPublic BooleanIp On Launch 
- 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.
- networkAcl StringAssociation Id 
- The ID of the network ACL that is associated with the subnet's VPC, such as acl-5fb85d36.
- privateDns Property MapName Options On Launch 
- 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.
- List<Property Map>
- Any tags assigned to the subnet.
Supporting Types
PrivateDnsNameOptionsOnLaunchProperties      
- EnableResource boolName Dns ARecord 
- Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
- EnableResource boolName Dns Aaaa Record 
- 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.
- EnableResource boolName Dns ARecord 
- Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
- EnableResource boolName Dns Aaaa Record 
- 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.
- enableResource BooleanName Dns ARecord 
- Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
- enableResource BooleanName Dns Aaaa Record 
- 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.
- enableResource booleanName Dns ARecord 
- Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
- enableResource booleanName Dns Aaaa Record 
- 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_ boolname_ dns_ a_ record 
- Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
- enable_resource_ boolname_ dns_ aaaa_ record 
- 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.
- enableResource BooleanName Dns ARecord 
- Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
- enableResource BooleanName Dns Aaaa Record 
- 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
Package Details
- Repository
- AWS Native pulumi/pulumi-aws-native
- License
- Apache-2.0
AWS Native is in preview. AWS Classic is fully supported.