Skip to content

aws.ec2.describe_subnets

Example SQL Queries

SELECT * FROM
aws.ec2.describe_subnets;

Description

Describes your subnets. The default is to describe all your subnets. Alternatively, you can specify specific subnet IDs or filter the results to include only the subnets that match specific criteria.

For more information, see Subnets in the Amazon VPC User Guide.

Table Definition

Column NameColumn Data Type
dry_run Input Column

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

BOOLEAN
filters Input Column

The filters.

  • availability-zone - The Availability Zone for the subnet. You can also use availabilityZone as the filter name.

  • availability-zone-id - The ID of the Availability Zone for the subnet. You can also use availabilityZoneId as the filter name.

  • available-ip-address-count - The number of IPv4 addresses in the subnet that are available.

  • cidr-block - The IPv4 CIDR block of the subnet. The CIDR block you specify must exactly match the subnet's CIDR block for information to be returned for the subnet. You can also use cidr or cidrBlock as the filter names.

  • customer-owned-ipv4-pool - The customer-owned IPv4 address pool associated with the subnet.

  • default-for-az - Indicates whether this is the default subnet for the Availability Zone (true | false). You can also use defaultForAz as the filter name.

  • enable-dns64 - Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.

  • enable-lni-at-device-index - 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).

  • ipv6-cidr-block-association.ipv6-cidr-block - An IPv6 CIDR block associated with the subnet.

  • ipv6-cidr-block-association.association-id - An association ID for an IPv6 CIDR block associated with the subnet.

  • ipv6-cidr-block-association.state - The state of an IPv6 CIDR block associated with the subnet.

  • ipv6-native - Indicates whether this is an IPv6 only subnet (true | false).

  • map-customer-owned-ip-on-launch - Indicates whether a network interface created in this subnet (including a network interface created by RunInstances) receives a customer-owned IPv4 address.

  • map-public-ip-on-launch - Indicates whether instances launched in this subnet receive a public IPv4 address.

  • outpost-arn - The Amazon Resource Name (ARN) of the Outpost.

  • owner-id - The ID of the Amazon Web Services account that owns the subnet.

  • private-dns-name-options-on-launch.hostname-type - The type of hostname to assign to instances in the subnet at launch. For IPv4-only and dual-stack (IPv4 and IPv6) subnets, an instance DNS name can be based on the instance IPv4 address (ip-name) or the instance ID (resource-name). For IPv6 only subnets, an instance DNS name must be based on the instance ID (resource-name).

  • private-dns-name-options-on-launch.enable-resource-name-dns-a-record - Indicates whether to respond to DNS queries for instance hostnames with DNS A records.

  • private-dns-name-options-on-launch.enable-resource-name-dns-aaaa-record - Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records.

  • state - The state of the subnet (pending | available).

  • subnet-arn - The Amazon Resource Name (ARN) of the subnet.

  • subnet-id - The ID of the subnet.

  • tag:<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key Owner and the value TeamA, specify tag:Owner for the filter name and TeamA for the filter value.

  • tag-key - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.

  • vpc-id - The ID of the VPC for the subnet.

STRUCT(
"name" VARCHAR,
"values" VARCHAR[]
)[]
Show child fields
filters[]
Show child fields
filters[].name

The name of the filter. Filter names are case-sensitive.

filters[].values[]
subnet_ids Input Column

The IDs of the subnets.

Default: Describes all your subnets.

VARCHAR[]
Show child fields
subnet_ids[]
_aws_profile Input Column

The AWS profile defines the AWS identity used. It can be defined via credentials or by assuming a IAM role.

STRUCT(
"type" VARCHAR,
"name" VARCHAR,
"account_id" VARCHAR,
"via_profile_name" VARCHAR,
"assumed_role_arn" VARCHAR,
"organization" STRUCT(
"account_name" VARCHAR,
"id" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[],
"master_account" STRUCT(
"id" VARCHAR,
"email" VARCHAR
),
"parents" STRUCT(
"type" VARCHAR,
"id" VARCHAR,
"name" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)[]
)
)
Show child fields
_aws_profile.account_id

The AWS account id

_aws_profile.assumed_role_arn

The ARN of the assumed role

_aws_profile.name

The unique name of the profile.

_aws_profile.organization

Information about this profile's membership in the AWS organization.

Show child fields
_aws_profile.organization.account_name

The name of account speciifed by the organization

_aws_profile.organization.id

The organization id

_aws_profile.organization.master_account
Show child fields
_aws_profile.organization.master_account.email

The organization master account email address

_aws_profile.organization.master_account.id

The organization master account id

_aws_profile.organization.parents[]
Show child fields
_aws_profile.organization.parents[].id

The id of the parent

_aws_profile.organization.parents[].name

The name of the parent

_aws_profile.organization.parents[].tags[]
Show child fields
_aws_profile.organization.parents[].tags[].key
_aws_profile.organization.parents[].tags[].value
_aws_profile.organization.parents[].type

The type of parent can be an organization unit or a root

_aws_profile.organization.tags[]
Show child fields
_aws_profile.organization.tags[].key
_aws_profile.organization.tags[].value
_aws_profile.type

The type of profile, either 'credentials' or 'assumed_role'

_aws_profile.via_profile_name

This IAM role for this profile is assumed by first utilizing another profile with this name to obtain credentials.

_aws_region Input Column

The AWS region to use.

VARCHAR
assign_ipv6_address_on_creation

Indicates whether a network interface created in this subnet (including a network interface created by RunInstances) receives an IPv6 address.

BOOLEAN
availability_zone

The Availability Zone of the subnet.

VARCHAR
availability_zone_id

The AZ ID of the subnet.

VARCHAR
available_ip_address_count

The number of unused private IPv4 addresses in the subnet. The IPv4 addresses for any stopped instances are considered unavailable.

BIGINT
cidr_block

The IPv4 CIDR block assigned to the subnet.

VARCHAR
customer_owned_ipv4_pool

The customer-owned IPv4 address pool associated with the subnet.

VARCHAR
default_for_az

Indicates whether this is the default subnet for the Availability Zone.

BOOLEAN
enable_dns64

Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.

BOOLEAN
enable_lni_at_device_index

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

BIGINT
ipv6_cidr_block_association_set

Information about the IPv6 CIDR blocks associated with the subnet.

STRUCT(
"association_id" VARCHAR,
"ipv6_cidr_block" VARCHAR,
"ipv6_cidr_block_state" STRUCT(
"state" VARCHAR,
"status_message" VARCHAR
),
"ipv6_address_attribute" VARCHAR,
"ip_source" VARCHAR
)[]
Show child fields
ipv6_cidr_block_association_set[]
Show child fields
ipv6_cidr_block_association_set[].association_id

The ID of the association.

ipv6_cidr_block_association_set[].ip_source

The source that allocated the IP address space. byoip or amazon indicates public IP address space allocated by Amazon or space that you have allocated with Bring your own IP (BYOIP). none indicates private space.

ipv6_cidr_block_association_set[].ipv6_address_attribute

Public IPv6 addresses are those advertised on the internet from Amazon Web Services. Private IP addresses are not and cannot be advertised on the internet from Amazon Web Services.

ipv6_cidr_block_association_set[].ipv6_cidr_block

The IPv6 CIDR block.

ipv6_cidr_block_association_set[].ipv6_cidr_block_state

The state of the CIDR block.

Show child fields
ipv6_cidr_block_association_set[].ipv6_cidr_block_state.state

The state of a CIDR block.

ipv6_cidr_block_association_set[].ipv6_cidr_block_state.status_message

A message about the status of the CIDR block, if applicable.

ipv6_native

Indicates whether this is an IPv6 only subnet.

BOOLEAN
map_customer_owned_ip_on_launch

Indicates whether a network interface created in this subnet (including a network interface created by RunInstances) receives a customer-owned IPv4 address.

BOOLEAN
map_public_ip_on_launch

Indicates whether instances launched in this subnet receive a public IPv4 address.

Amazon Web Services 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 Amazon VPC pricing page.

BOOLEAN
outpost_arn

The Amazon Resource Name (ARN) of the Outpost.

VARCHAR
owner_id

The ID of the Amazon Web Services account that owns the subnet.

VARCHAR
private_dns_name_options_on_launch

The type of hostnames to assign to instances in the subnet at launch. An instance hostname is based on the IPv4 address or ID of the instance.

STRUCT(
"hostname_type" VARCHAR,
"enable_resource_name_dns_a_record" BOOLEAN,
"enable_resource_name_dns_aaaa_record" BOOLEAN
)
Show child fields
private_dns_name_options_on_launch.enable_resource_name_dns_a_record

Indicates whether to respond to DNS queries for instance hostnames with DNS A records.

private_dns_name_options_on_launch.enable_resource_name_dns_aaaa_record

Indicates whether to respond to DNS queries for instance hostname with DNS AAAA records.

private_dns_name_options_on_launch.hostname_type

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.

state

The current state of the subnet.

VARCHAR
subnet_arn

The Amazon Resource Name (ARN) of the subnet.

VARCHAR
subnet_id

The ID of the subnet.

VARCHAR
tags

Any tags assigned to the subnet.

STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
Show child fields
tags[]
Show child fields
tags[].key

The key of the tag.

Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with aws:.

tags[].value

The value of the tag.

Constraints: Tag values are case-sensitive and accept a maximum of 256 Unicode characters.

vpc_id

The ID of the VPC the subnet is in.

VARCHAR