We recommend new projects start with resources from the AWS provider.
aws-native.ec2.getSubnet
Explore with Pulumi AI
We recommend new projects start with resources from the AWS provider.
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:
- Subnet
Id string - The ID of the subnet.
- Subnet
Id string - The ID of the subnet.
- subnet
Id String - The ID of the subnet.
- subnet
Id string - The ID of the subnet.
- subnet_
id str - The ID of the subnet.
- subnet
Id String - The ID of the subnet.
getSubnet Result
The following output properties are available:
- Assign
Ipv6Address 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. - 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.
You must first configure a NAT gateway in a public subnet (separate from the subnet containing the IPv6-only workloads). For example, the subnet containing the NAT gateway should have a
0.0.0.0/0
route pointing to the internet gateway. For more information, see Configure DNS64 and NAT64 in the User Guide. - Ipv6Cidr
Block string - The IPv6 CIDR block.
If you specify
AssignIpv6AddressOnCreation
, you must also specify an IPv6 CIDR block. - Ipv6Cidr
Blocks List<string> - The IPv6 CIDR blocks that are associated with the subnet.
- 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 stringAssociation Id - The ID of the network ACL that is associated with the subnet's VPC, such as
acl-5fb85d36
. - Private
Dns 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)
- Subnet
Id string - The ID of the subnet.
- List<Pulumi.
Aws Native. Outputs. Tag> - Any tags assigned to the subnet.
- Assign
Ipv6Address 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. - 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.
You must first configure a NAT gateway in a public subnet (separate from the subnet containing the IPv6-only workloads). For example, the subnet containing the NAT gateway should have a
0.0.0.0/0
route pointing to the internet gateway. For more information, see Configure DNS64 and NAT64 in the User Guide. - Ipv6Cidr
Block string - The IPv6 CIDR block.
If you specify
AssignIpv6AddressOnCreation
, you must also specify an IPv6 CIDR block. - Ipv6Cidr
Blocks []string - The IPv6 CIDR blocks that are associated with the subnet.
- 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 stringAssociation 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 string - The ID of the subnet.
- Tag
- Any tags assigned to the subnet.
- assign
Ipv6Address 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. - enable
Dns64 Boolean - Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.
You must first configure a NAT gateway in a public subnet (separate from the subnet containing the IPv6-only workloads). For example, the subnet containing the NAT gateway should have a
0.0.0.0/0
route pointing to the internet gateway. For more information, see Configure DNS64 and NAT64 in the User Guide. - ipv6Cidr
Block String - The IPv6 CIDR block.
If you specify
AssignIpv6AddressOnCreation
, you must also specify an IPv6 CIDR block. - ipv6Cidr
Blocks List<String> - The IPv6 CIDR blocks that are associated with the subnet.
- map
Public 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. - network
Acl StringAssociation 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 String - The ID of the subnet.
- List<Tag>
- Any tags assigned to the subnet.
- assign
Ipv6Address 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. - enable
Dns64 boolean - Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.
You must first configure a NAT gateway in a public subnet (separate from the subnet containing the IPv6-only workloads). For example, the subnet containing the NAT gateway should have a
0.0.0.0/0
route pointing to the internet gateway. For more information, see Configure DNS64 and NAT64 in the User Guide. - ipv6Cidr
Block string - The IPv6 CIDR block.
If you specify
AssignIpv6AddressOnCreation
, you must also specify an IPv6 CIDR block. - ipv6Cidr
Blocks string[] - The IPv6 CIDR blocks that are associated with the subnet.
- map
Public 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. - network
Acl stringAssociation 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 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.
You must first configure a NAT gateway in a public subnet (separate from the subnet containing the IPv6-only workloads). For example, the subnet containing the NAT gateway should have a
0.0.0.0/0
route pointing to the internet gateway. For more information, see Configure 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 CIDR blocks that are associated with the subnet.
- 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.
- assign
Ipv6Address 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. - enable
Dns64 Boolean - Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.
You must first configure a NAT gateway in a public subnet (separate from the subnet containing the IPv6-only workloads). For example, the subnet containing the NAT gateway should have a
0.0.0.0/0
route pointing to the internet gateway. For more information, see Configure DNS64 and NAT64 in the User Guide. - ipv6Cidr
Block String - The IPv6 CIDR block.
If you specify
AssignIpv6AddressOnCreation
, you must also specify an IPv6 CIDR block. - ipv6Cidr
Blocks List<String> - The IPv6 CIDR blocks that are associated with the subnet.
- map
Public 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. - network
Acl StringAssociation Id - The ID of the network ACL that is associated with the subnet's VPC, such as
acl-5fb85d36
. - private
Dns 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)
- subnet
Id String - The ID of the subnet.
- List<Property Map>
- Any tags assigned to the subnet.
Supporting Types
PrivateDnsNameOptionsOnLaunchProperties
- Enable
Resource boolName Dns ARecord - 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 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 ARecord - 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 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 BooleanName Dns ARecord - Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
- enable
Resource BooleanName Dns Aaaa Record - Indicates whether to respond to DNS queries for instance hostname with DNS AAAA records.
- hostname
Type 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 booleanName Dns ARecord - Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
- enable
Resource booleanName Dns Aaaa Record - Indicates whether to respond to DNS queries for instance hostname with DNS AAAA records.
- hostname
Type 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.
- enable
Resource BooleanName Dns ARecord - Indicates whether to respond to DNS queries for instance hostnames with DNS A records.
- enable
Resource BooleanName Dns Aaaa Record - Indicates whether to respond to DNS queries for instance hostname with DNS AAAA records.
- hostname
Type 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
We recommend new projects start with resources from the AWS provider.