Try AWS Native preview for resources not in the classic version.
aws.ec2.getNatGateway
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
Provides details about a specific VPC NAT Gateway.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const default = aws.ec2.getNatGateway({
    subnetId: _public.id,
});
import pulumi
import pulumi_aws as aws
default = aws.ec2.get_nat_gateway(subnet_id=public["id"])
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2.LookupNatGateway(ctx, &ec2.LookupNatGatewayArgs{
			SubnetId: pulumi.StringRef(public.Id),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var @default = Aws.Ec2.GetNatGateway.Invoke(new()
    {
        SubnetId = @public.Id,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetNatGatewayArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var default = Ec2Functions.getNatGateway(GetNatGatewayArgs.builder()
            .subnetId(public_.id())
            .build());
    }
}
variables:
  default:
    fn::invoke:
      Function: aws:ec2:getNatGateway
      Arguments:
        subnetId: ${public.id}
With tags
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const default = aws.ec2.getNatGateway({
    subnetId: _public.id,
    tags: {
        Name: "gw NAT",
    },
});
import pulumi
import pulumi_aws as aws
default = aws.ec2.get_nat_gateway(subnet_id=public["id"],
    tags={
        "Name": "gw NAT",
    })
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2.LookupNatGateway(ctx, &ec2.LookupNatGatewayArgs{
			SubnetId: pulumi.StringRef(public.Id),
			Tags: map[string]interface{}{
				"Name": "gw NAT",
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var @default = Aws.Ec2.GetNatGateway.Invoke(new()
    {
        SubnetId = @public.Id,
        Tags = 
        {
            { "Name", "gw NAT" },
        },
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetNatGatewayArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var default = Ec2Functions.getNatGateway(GetNatGatewayArgs.builder()
            .subnetId(public_.id())
            .tags(Map.of("Name", "gw NAT"))
            .build());
    }
}
variables:
  default:
    fn::invoke:
      Function: aws:ec2:getNatGateway
      Arguments:
        subnetId: ${public.id}
        tags:
          Name: gw NAT
Using getNatGateway
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 getNatGateway(args: GetNatGatewayArgs, opts?: InvokeOptions): Promise<GetNatGatewayResult>
function getNatGatewayOutput(args: GetNatGatewayOutputArgs, opts?: InvokeOptions): Output<GetNatGatewayResult>def get_nat_gateway(filters: Optional[Sequence[GetNatGatewayFilter]] = None,
                    id: Optional[str] = None,
                    state: Optional[str] = None,
                    subnet_id: Optional[str] = None,
                    tags: Optional[Mapping[str, str]] = None,
                    vpc_id: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetNatGatewayResult
def get_nat_gateway_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetNatGatewayFilterArgs]]]] = None,
                    id: Optional[pulumi.Input[str]] = None,
                    state: Optional[pulumi.Input[str]] = None,
                    subnet_id: Optional[pulumi.Input[str]] = None,
                    tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                    vpc_id: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetNatGatewayResult]func LookupNatGateway(ctx *Context, args *LookupNatGatewayArgs, opts ...InvokeOption) (*LookupNatGatewayResult, error)
func LookupNatGatewayOutput(ctx *Context, args *LookupNatGatewayOutputArgs, opts ...InvokeOption) LookupNatGatewayResultOutput> Note: This function is named LookupNatGateway in the Go SDK.
public static class GetNatGateway 
{
    public static Task<GetNatGatewayResult> InvokeAsync(GetNatGatewayArgs args, InvokeOptions? opts = null)
    public static Output<GetNatGatewayResult> Invoke(GetNatGatewayInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetNatGatewayResult> getNatGateway(GetNatGatewayArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: aws:ec2/getNatGateway:getNatGateway
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Filters
List<Get
Nat Gateway Filter>  Custom filter block as described below.
More complex filters can be expressed using one or more
filtersub-blocks, which take the following arguments:- Id string
 - ID of the specific NAT Gateway to retrieve.
 - State string
 - State of the NAT Gateway (pending | failed | available | deleting | deleted ).
 - Subnet
Id string - ID of subnet that the NAT Gateway resides in.
 - Dictionary<string, string>
 - Map of tags, each pair of which must exactly match a pair on the desired NAT Gateway.
 - Vpc
Id string - ID of the VPC that the NAT Gateway resides in.
 
- Filters
[]Get
Nat Gateway Filter  Custom filter block as described below.
More complex filters can be expressed using one or more
filtersub-blocks, which take the following arguments:- Id string
 - ID of the specific NAT Gateway to retrieve.
 - State string
 - State of the NAT Gateway (pending | failed | available | deleting | deleted ).
 - Subnet
Id string - ID of subnet that the NAT Gateway resides in.
 - map[string]string
 - Map of tags, each pair of which must exactly match a pair on the desired NAT Gateway.
 - Vpc
Id string - ID of the VPC that the NAT Gateway resides in.
 
- filters
List<Get
Nat Gateway Filter>  Custom filter block as described below.
More complex filters can be expressed using one or more
filtersub-blocks, which take the following arguments:- id String
 - ID of the specific NAT Gateway to retrieve.
 - state String
 - State of the NAT Gateway (pending | failed | available | deleting | deleted ).
 - subnet
Id String - ID of subnet that the NAT Gateway resides in.
 - Map<String,String>
 - Map of tags, each pair of which must exactly match a pair on the desired NAT Gateway.
 - vpc
Id String - ID of the VPC that the NAT Gateway resides in.
 
- filters
Get
Nat Gateway Filter[]  Custom filter block as described below.
More complex filters can be expressed using one or more
filtersub-blocks, which take the following arguments:- id string
 - ID of the specific NAT Gateway to retrieve.
 - state string
 - State of the NAT Gateway (pending | failed | available | deleting | deleted ).
 - subnet
Id string - ID of subnet that the NAT Gateway resides in.
 - {[key: string]: string}
 - Map of tags, each pair of which must exactly match a pair on the desired NAT Gateway.
 - vpc
Id string - ID of the VPC that the NAT Gateway resides in.
 
- filters
Sequence[Get
Nat Gateway Filter]  Custom filter block as described below.
More complex filters can be expressed using one or more
filtersub-blocks, which take the following arguments:- id str
 - ID of the specific NAT Gateway to retrieve.
 - state str
 - State of the NAT Gateway (pending | failed | available | deleting | deleted ).
 - subnet_
id str - ID of subnet that the NAT Gateway resides in.
 - Mapping[str, str]
 - Map of tags, each pair of which must exactly match a pair on the desired NAT Gateway.
 - vpc_
id str - ID of the VPC that the NAT Gateway resides in.
 
- filters List<Property Map>
 Custom filter block as described below.
More complex filters can be expressed using one or more
filtersub-blocks, which take the following arguments:- id String
 - ID of the specific NAT Gateway to retrieve.
 - state String
 - State of the NAT Gateway (pending | failed | available | deleting | deleted ).
 - subnet
Id String - ID of subnet that the NAT Gateway resides in.
 - Map<String>
 - Map of tags, each pair of which must exactly match a pair on the desired NAT Gateway.
 - vpc
Id String - ID of the VPC that the NAT Gateway resides in.
 
getNatGateway Result
The following output properties are available:
- Allocation
Id string - ID of the EIP allocated to the selected NAT Gateway.
 - Association
Id string - The association ID of the Elastic IP address that's associated with the NAT Gateway. Only available when 
connectivity_typeispublic. - Connectivity
Type string - Connectivity type of the NAT Gateway.
 - Id string
 - Network
Interface stringId  - The ID of the ENI allocated to the selected NAT Gateway.
 - Private
Ip string - Private IP address of the selected NAT Gateway.
 - Public
Ip string - Public IP (EIP) address of the selected NAT Gateway.
 - Secondary
Allocation List<string>Ids  - Secondary allocation EIP IDs for the selected NAT Gateway.
 - Secondary
Private intIp Address Count  - The number of secondary private IPv4 addresses assigned to the selected NAT Gateway.
 - Secondary
Private List<string>Ip Addresses  - Secondary private IPv4 addresses assigned to the selected NAT Gateway.
 - State string
 - Subnet
Id string - Dictionary<string, string>
 - Vpc
Id string - Filters
List<Get
Nat Gateway Filter>  
- Allocation
Id string - ID of the EIP allocated to the selected NAT Gateway.
 - Association
Id string - The association ID of the Elastic IP address that's associated with the NAT Gateway. Only available when 
connectivity_typeispublic. - Connectivity
Type string - Connectivity type of the NAT Gateway.
 - Id string
 - Network
Interface stringId  - The ID of the ENI allocated to the selected NAT Gateway.
 - Private
Ip string - Private IP address of the selected NAT Gateway.
 - Public
Ip string - Public IP (EIP) address of the selected NAT Gateway.
 - Secondary
Allocation []stringIds  - Secondary allocation EIP IDs for the selected NAT Gateway.
 - Secondary
Private intIp Address Count  - The number of secondary private IPv4 addresses assigned to the selected NAT Gateway.
 - Secondary
Private []stringIp Addresses  - Secondary private IPv4 addresses assigned to the selected NAT Gateway.
 - State string
 - Subnet
Id string - map[string]string
 - Vpc
Id string - Filters
[]Get
Nat Gateway Filter  
- allocation
Id String - ID of the EIP allocated to the selected NAT Gateway.
 - association
Id String - The association ID of the Elastic IP address that's associated with the NAT Gateway. Only available when 
connectivity_typeispublic. - connectivity
Type String - Connectivity type of the NAT Gateway.
 - id String
 - network
Interface StringId  - The ID of the ENI allocated to the selected NAT Gateway.
 - private
Ip String - Private IP address of the selected NAT Gateway.
 - public
Ip String - Public IP (EIP) address of the selected NAT Gateway.
 - secondary
Allocation List<String>Ids  - Secondary allocation EIP IDs for the selected NAT Gateway.
 - secondary
Private IntegerIp Address Count  - The number of secondary private IPv4 addresses assigned to the selected NAT Gateway.
 - secondary
Private List<String>Ip Addresses  - Secondary private IPv4 addresses assigned to the selected NAT Gateway.
 - state String
 - subnet
Id String - Map<String,String>
 - vpc
Id String - filters
List<Get
Nat Gateway Filter>  
- allocation
Id string - ID of the EIP allocated to the selected NAT Gateway.
 - association
Id string - The association ID of the Elastic IP address that's associated with the NAT Gateway. Only available when 
connectivity_typeispublic. - connectivity
Type string - Connectivity type of the NAT Gateway.
 - id string
 - network
Interface stringId  - The ID of the ENI allocated to the selected NAT Gateway.
 - private
Ip string - Private IP address of the selected NAT Gateway.
 - public
Ip string - Public IP (EIP) address of the selected NAT Gateway.
 - secondary
Allocation string[]Ids  - Secondary allocation EIP IDs for the selected NAT Gateway.
 - secondary
Private numberIp Address Count  - The number of secondary private IPv4 addresses assigned to the selected NAT Gateway.
 - secondary
Private string[]Ip Addresses  - Secondary private IPv4 addresses assigned to the selected NAT Gateway.
 - state string
 - subnet
Id string - {[key: string]: string}
 - vpc
Id string - filters
Get
Nat Gateway Filter[]  
- allocation_
id str - ID of the EIP allocated to the selected NAT Gateway.
 - association_
id str - The association ID of the Elastic IP address that's associated with the NAT Gateway. Only available when 
connectivity_typeispublic. - connectivity_
type str - Connectivity type of the NAT Gateway.
 - id str
 - network_
interface_ strid  - The ID of the ENI allocated to the selected NAT Gateway.
 - private_
ip str - Private IP address of the selected NAT Gateway.
 - public_
ip str - Public IP (EIP) address of the selected NAT Gateway.
 - secondary_
allocation_ Sequence[str]ids  - Secondary allocation EIP IDs for the selected NAT Gateway.
 - secondary_
private_ intip_ address_ count  - The number of secondary private IPv4 addresses assigned to the selected NAT Gateway.
 - secondary_
private_ Sequence[str]ip_ addresses  - Secondary private IPv4 addresses assigned to the selected NAT Gateway.
 - state str
 - subnet_
id str - Mapping[str, str]
 - vpc_
id str - filters
Sequence[Get
Nat Gateway Filter]  
- allocation
Id String - ID of the EIP allocated to the selected NAT Gateway.
 - association
Id String - The association ID of the Elastic IP address that's associated with the NAT Gateway. Only available when 
connectivity_typeispublic. - connectivity
Type String - Connectivity type of the NAT Gateway.
 - id String
 - network
Interface StringId  - The ID of the ENI allocated to the selected NAT Gateway.
 - private
Ip String - Private IP address of the selected NAT Gateway.
 - public
Ip String - Public IP (EIP) address of the selected NAT Gateway.
 - secondary
Allocation List<String>Ids  - Secondary allocation EIP IDs for the selected NAT Gateway.
 - secondary
Private NumberIp Address Count  - The number of secondary private IPv4 addresses assigned to the selected NAT Gateway.
 - secondary
Private List<String>Ip Addresses  - Secondary private IPv4 addresses assigned to the selected NAT Gateway.
 - state String
 - subnet
Id String - Map<String>
 - vpc
Id String - filters List<Property Map>
 
Supporting Types
GetNatGatewayFilter   
- 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. An 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. An 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. An 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. An 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. An 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. An 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 
awsTerraform Provider. 
Try AWS Native preview for resources not in the classic version.