AWS v6.83.0 published on Monday, Jun 16, 2025 by Pulumi
aws.ec2.getSubnets
Explore with Pulumi AI
This resource can be useful for getting back a set of subnet IDs.
Using getSubnets
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 getSubnets(args: GetSubnetsArgs, opts?: InvokeOptions): Promise<GetSubnetsResult>
function getSubnetsOutput(args: GetSubnetsOutputArgs, opts?: InvokeOptions): Output<GetSubnetsResult>
def get_subnets(filters: Optional[Sequence[GetSubnetsFilter]] = None,
tags: Optional[Mapping[str, str]] = None,
opts: Optional[InvokeOptions] = None) -> GetSubnetsResult
def get_subnets_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetSubnetsFilterArgs]]]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetSubnetsResult]
func GetSubnets(ctx *Context, args *GetSubnetsArgs, opts ...InvokeOption) (*GetSubnetsResult, error)
func GetSubnetsOutput(ctx *Context, args *GetSubnetsOutputArgs, opts ...InvokeOption) GetSubnetsResultOutput
> Note: This function is named GetSubnets
in the Go SDK.
public static class GetSubnets
{
public static Task<GetSubnetsResult> InvokeAsync(GetSubnetsArgs args, InvokeOptions? opts = null)
public static Output<GetSubnetsResult> Invoke(GetSubnetsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetSubnetsResult> getSubnets(GetSubnetsArgs args, InvokeOptions options)
public static Output<GetSubnetsResult> getSubnets(GetSubnetsArgs args, InvokeOptions options)
fn::invoke:
function: aws:ec2/getSubnets:getSubnets
arguments:
# arguments dictionary
The following arguments are supported:
- Filters
List<Get
Subnets Filter> - Custom filter block as described below.
- Dictionary<string, string>
- Map of tags, each pair of which must exactly match a pair on the desired subnets.
- Filters
[]Get
Subnets Filter - Custom filter block as described below.
- map[string]string
- Map of tags, each pair of which must exactly match a pair on the desired subnets.
- filters
List<Get
Subnets Filter> - Custom filter block as described below.
- Map<String,String>
- Map of tags, each pair of which must exactly match a pair on the desired subnets.
- filters
Get
Subnets Filter[] - Custom filter block as described below.
- {[key: string]: string}
- Map of tags, each pair of which must exactly match a pair on the desired subnets.
- filters
Sequence[Get
Subnets Filter] - Custom filter block as described below.
- Mapping[str, str]
- Map of tags, each pair of which must exactly match a pair on the desired subnets.
- filters List<Property Map>
- Custom filter block as described below.
- Map<String>
- Map of tags, each pair of which must exactly match a pair on the desired subnets.
getSubnets Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- List of all the subnet ids found.
- Dictionary<string, string>
- Filters
List<Get
Subnets Filter>
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- List of all the subnet ids found.
- map[string]string
- Filters
[]Get
Subnets Filter
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- List of all the subnet ids found.
- Map<String,String>
- filters
List<Get
Subnets Filter>
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- List of all the subnet ids found.
- {[key: string]: string}
- filters
Get
Subnets Filter[]
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- List of all the subnet ids found.
- Mapping[str, str]
- filters
Sequence[Get
Subnets Filter]
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- List of all the subnet ids found.
- Map<String>
- filters List<Property Map>
Supporting Types
GetSubnetsFilter
- Name string
- Name of the field to filter by, as defined by
the underlying AWS API.
For example, if matching against tag
Name
, use: - Values List<string>
- Set of values that are accepted for the given field. Subnet IDs will be selected if any one of the given values match.
- Name string
- Name of the field to filter by, as defined by
the underlying AWS API.
For example, if matching against tag
Name
, use: - Values []string
- Set of values that are accepted for the given field. Subnet IDs will be selected if any one of the given values match.
- name String
- Name of the field to filter by, as defined by
the underlying AWS API.
For example, if matching against tag
Name
, use: - values List<String>
- Set of values that are accepted for the given field. Subnet IDs will be selected if any one of the given values match.
- name string
- Name of the field to filter by, as defined by
the underlying AWS API.
For example, if matching against tag
Name
, use: - values string[]
- Set of values that are accepted for the given field. Subnet IDs will be selected if any one of the given values match.
- name str
- Name of the field to filter by, as defined by
the underlying AWS API.
For example, if matching against tag
Name
, use: - values Sequence[str]
- Set of values that are accepted for the given field. Subnet IDs will be selected if any one of the given values match.
- name String
- Name of the field to filter by, as defined by
the underlying AWS API.
For example, if matching against tag
Name
, use: - values List<String>
- Set of values that are accepted for the given field. Subnet IDs will be selected if any one of the given values match.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.