aws.ec2.getNatGateways
Explore with Pulumi AI
This resource can be useful for getting back a list of NAT gateway ids to be referenced elsewhere.
Example Usage
The following returns all NAT gateways in a specified VPC that are marked as available
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const ngws = aws.ec2.getNatGateways({
vpcId: vpcId,
filters: [{
name: "state",
values: ["available"],
}],
});
const ngw = .map(__index => (aws.ec2.getNatGateway({
id: _arg0_.ids[__index],
})));
import pulumi
import pulumi_aws as aws
ngws = aws.ec2.get_nat_gateways(vpc_id=vpc_id,
filters=[{
"name": "state",
"values": ["available"],
}])
ngw = [aws.ec2.get_nat_gateway(id=ngws.ids[__index]) for __index in range(len(ngws.ids))]
Coming soon!
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var ngws = Aws.Ec2.GetNatGateways.Invoke(new()
{
VpcId = vpcId,
Filters = new[]
{
new Aws.Ec2.Inputs.GetNatGatewaysFilterInputArgs
{
Name = "state",
Values = new[]
{
"available",
},
},
},
});
var ngw = ;
});
Coming soon!
Coming soon!
Using getNatGateways
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 getNatGateways(args: GetNatGatewaysArgs, opts?: InvokeOptions): Promise<GetNatGatewaysResult>
function getNatGatewaysOutput(args: GetNatGatewaysOutputArgs, opts?: InvokeOptions): Output<GetNatGatewaysResult>
def get_nat_gateways(filters: Optional[Sequence[GetNatGatewaysFilter]] = None,
tags: Optional[Mapping[str, str]] = None,
vpc_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetNatGatewaysResult
def get_nat_gateways_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetNatGatewaysFilterArgs]]]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
vpc_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetNatGatewaysResult]
func GetNatGateways(ctx *Context, args *GetNatGatewaysArgs, opts ...InvokeOption) (*GetNatGatewaysResult, error)
func GetNatGatewaysOutput(ctx *Context, args *GetNatGatewaysOutputArgs, opts ...InvokeOption) GetNatGatewaysResultOutput
> Note: This function is named GetNatGateways
in the Go SDK.
public static class GetNatGateways
{
public static Task<GetNatGatewaysResult> InvokeAsync(GetNatGatewaysArgs args, InvokeOptions? opts = null)
public static Output<GetNatGatewaysResult> Invoke(GetNatGatewaysInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetNatGatewaysResult> getNatGateways(GetNatGatewaysArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: aws:ec2/getNatGateways:getNatGateways
arguments:
# arguments dictionary
The following arguments are supported:
- Filters
List<Get
Nat Gateways 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 NAT Gateways.
More complex filters can be expressed using one or more
filter
sub-blocks, which take the following arguments:- Vpc
Id string - VPC ID that you want to filter from.
- Filters
[]Get
Nat Gateways 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 NAT Gateways.
More complex filters can be expressed using one or more
filter
sub-blocks, which take the following arguments:- Vpc
Id string - VPC ID that you want to filter from.
- filters
List<Get
Nat Gateways 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 NAT Gateways.
More complex filters can be expressed using one or more
filter
sub-blocks, which take the following arguments:- vpc
Id String - VPC ID that you want to filter from.
- filters
Get
Nat Gateways 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 NAT Gateways.
More complex filters can be expressed using one or more
filter
sub-blocks, which take the following arguments:- vpc
Id string - VPC ID that you want to filter from.
- filters
Sequence[Get
Nat Gateways 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 NAT Gateways.
More complex filters can be expressed using one or more
filter
sub-blocks, which take the following arguments:- vpc_
id str - VPC ID that you want to filter from.
- 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 NAT Gateways.
More complex filters can be expressed using one or more
filter
sub-blocks, which take the following arguments:- vpc
Id String - VPC ID that you want to filter from.
getNatGateways 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 NAT gateway ids found.
- Dictionary<string, string>
- Filters
List<Get
Nat Gateways Filter> - Vpc
Id string
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- List of all the NAT gateway ids found.
- map[string]string
- Filters
[]Get
Nat Gateways Filter - Vpc
Id string
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- List of all the NAT gateway ids found.
- Map<String,String>
- filters
List<Get
Nat Gateways Filter> - vpc
Id String
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- List of all the NAT gateway ids found.
- {[key: string]: string}
- filters
Get
Nat Gateways Filter[] - vpc
Id string
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- List of all the NAT gateway ids found.
- Mapping[str, str]
- filters
Sequence[Get
Nat Gateways Filter] - vpc_
id str
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- List of all the NAT gateway ids found.
- Map<String>
- filters List<Property Map>
- vpc
Id String
Supporting Types
GetNatGatewaysFilter
- Name string
- Name of the field to filter by, as defined by the underlying AWS API.
- Values List<string>
- Set of values that are accepted for the given field. A Nat Gateway will be selected if any one of the given values matches.
- Name string
- Name of the field to filter by, as defined by the underlying AWS API.
- Values []string
- Set of values that are accepted for the given field. A Nat Gateway will be selected if any one of the given values matches.
- name String
- Name of the field to filter by, as defined by the underlying AWS API.
- values List<String>
- Set of values that are accepted for the given field. A Nat Gateway will be selected if any one of the given values matches.
- name string
- Name of the field to filter by, as defined by the underlying AWS API.
- values string[]
- Set of values that are accepted for the given field. A Nat Gateway will be selected if any one of the given values matches.
- name str
- Name of the field to filter by, as defined by the underlying AWS API.
- values Sequence[str]
- Set of values that are accepted for the given field. A Nat Gateway will be selected if any one of the given values matches.
- name String
- Name of the field to filter by, as defined by the underlying AWS API.
- values List<String>
- Set of values that are accepted for the given field. A Nat Gateway will be selected if any one of the given values matches.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.