NatGatewayArgs

data class NatGatewayArgs(val allocationId: Output<String>? = null, val connectivityType: Output<String>? = null, val privateIp: Output<String>? = null, val secondaryAllocationIds: Output<List<String>>? = null, val secondaryPrivateIpAddressCount: Output<Int>? = null, val secondaryPrivateIpAddresses: Output<List<String>>? = null, val subnetId: Output<String>? = null, val tags: Output<Map<String, String>>? = null) : ConvertibleToJava<NatGatewayArgs>

Provides a resource to create a VPC NAT Gateway.

Example Usage

Public NAT

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2.NatGateway("example", {
allocationId: exampleAwsEip.id,
subnetId: exampleAwsSubnet.id,
tags: {
Name: "gw NAT",
},
}, {
dependsOn: [exampleAwsInternetGateway],
});
import pulumi
import pulumi_aws as aws
example = aws.ec2.NatGateway("example",
allocation_id=example_aws_eip["id"],
subnet_id=example_aws_subnet["id"],
tags={
"Name": "gw NAT",
},
opts = pulumi.ResourceOptions(depends_on=[example_aws_internet_gateway]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ec2.NatGateway("example", new()
{
AllocationId = exampleAwsEip.Id,
SubnetId = exampleAwsSubnet.Id,
Tags =
{
{ "Name", "gw NAT" },
},
}, new CustomResourceOptions
{
DependsOn =
{
exampleAwsInternetGateway,
},
});
});
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.NewNatGateway(ctx, "example", &ec2.NatGatewayArgs{
AllocationId: pulumi.Any(exampleAwsEip.Id),
SubnetId: pulumi.Any(exampleAwsSubnet.Id),
Tags: pulumi.StringMap{
"Name": pulumi.String("gw NAT"),
},
}, pulumi.DependsOn([]pulumi.Resource{
exampleAwsInternetGateway,
}))
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.NatGateway;
import com.pulumi.aws.ec2.NatGatewayArgs;
import com.pulumi.resources.CustomResourceOptions;
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) {
var example = new NatGateway("example", NatGatewayArgs.builder()
.allocationId(exampleAwsEip.id())
.subnetId(exampleAwsSubnet.id())
.tags(Map.of("Name", "gw NAT"))
.build(), CustomResourceOptions.builder()
.dependsOn(exampleAwsInternetGateway)
.build());
}
}
resources:
example:
type: aws:ec2:NatGateway
properties:
allocationId: ${exampleAwsEip.id}
subnetId: ${exampleAwsSubnet.id}
tags:
Name: gw NAT
options:
dependsOn:
- ${exampleAwsInternetGateway}

Public NAT with Secondary Private IP Addresses

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2.NatGateway("example", {
allocationId: exampleAwsEip.id,
subnetId: exampleAwsSubnet.id,
secondaryAllocationIds: [secondary&#46;id],
secondaryPrivateIpAddresses: ["10&#46;0&#46;1&#46;5"],
});
import pulumi
import pulumi_aws as aws
example = aws.ec2.NatGateway("example",
allocation_id=example_aws_eip["id"],
subnet_id=example_aws_subnet["id"],
secondary_allocation_ids=[secondary["id"]],
secondary_private_ip_addresses=["10&#46;0&#46;1&#46;5"])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ec2.NatGateway("example", new()
{
AllocationId = exampleAwsEip.Id,
SubnetId = exampleAwsSubnet.Id,
SecondaryAllocationIds = new[]
{
secondary.Id,
},
SecondaryPrivateIpAddresses = new[]
{
"10.0.1.5",
},
});
});
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.NewNatGateway(ctx, "example", &ec2.NatGatewayArgs{
AllocationId: pulumi.Any(exampleAwsEip.Id),
SubnetId: pulumi.Any(exampleAwsSubnet.Id),
SecondaryAllocationIds: pulumi.StringArray{
secondary.Id,
},
SecondaryPrivateIpAddresses: pulumi.StringArray{
pulumi.String("10.0.1.5"),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.NatGateway;
import com.pulumi.aws.ec2.NatGatewayArgs;
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) {
var example = new NatGateway("example", NatGatewayArgs.builder()
.allocationId(exampleAwsEip.id())
.subnetId(exampleAwsSubnet.id())
.secondaryAllocationIds(secondary.id())
.secondaryPrivateIpAddresses("10.0.1.5")
.build());
}
}
resources:
example:
type: aws:ec2:NatGateway
properties:
allocationId: ${exampleAwsEip.id}
subnetId: ${exampleAwsSubnet.id}
secondaryAllocationIds:
- ${secondary.id}
secondaryPrivateIpAddresses:
- 10.0.1.5

Private NAT

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2.NatGateway("example", {
connectivityType: "private",
subnetId: exampleAwsSubnet.id,
});
import pulumi
import pulumi_aws as aws
example = aws.ec2.NatGateway("example",
connectivity_type="private",
subnet_id=example_aws_subnet["id"])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ec2.NatGateway("example", new()
{
ConnectivityType = "private",
SubnetId = exampleAwsSubnet.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.NewNatGateway(ctx, "example", &ec2.NatGatewayArgs{
ConnectivityType: pulumi.String("private"),
SubnetId: pulumi.Any(exampleAwsSubnet.Id),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.NatGateway;
import com.pulumi.aws.ec2.NatGatewayArgs;
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) {
var example = new NatGateway("example", NatGatewayArgs.builder()
.connectivityType("private")
.subnetId(exampleAwsSubnet.id())
.build());
}
}
resources:
example:
type: aws:ec2:NatGateway
properties:
connectivityType: private
subnetId: ${exampleAwsSubnet.id}

Private NAT with Secondary Private IP Addresses

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2.NatGateway("example", {
connectivityType: "private",
subnetId: exampleAwsSubnet.id,
secondaryPrivateIpAddressCount: 7,
});
import pulumi
import pulumi_aws as aws
example = aws.ec2.NatGateway("example",
connectivity_type="private",
subnet_id=example_aws_subnet["id"],
secondary_private_ip_address_count=7)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ec2.NatGateway("example", new()
{
ConnectivityType = "private",
SubnetId = exampleAwsSubnet.Id,
SecondaryPrivateIpAddressCount = 7,
});
});
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.NewNatGateway(ctx, "example", &ec2.NatGatewayArgs{
ConnectivityType: pulumi.String("private"),
SubnetId: pulumi.Any(exampleAwsSubnet.Id),
SecondaryPrivateIpAddressCount: pulumi.Int(7),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.NatGateway;
import com.pulumi.aws.ec2.NatGatewayArgs;
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) {
var example = new NatGateway("example", NatGatewayArgs.builder()
.connectivityType("private")
.subnetId(exampleAwsSubnet.id())
.secondaryPrivateIpAddressCount(7)
.build());
}
}
resources:
example:
type: aws:ec2:NatGateway
properties:
connectivityType: private
subnetId: ${exampleAwsSubnet.id}
secondaryPrivateIpAddressCount: 7

Import

Using pulumi import, import NAT Gateways using the id. For example:

$ pulumi import aws:ec2/natGateway:NatGateway private_gw nat-05dba92075d71c408

Constructors

Link copied to clipboard
constructor(allocationId: Output<String>? = null, connectivityType: Output<String>? = null, privateIp: Output<String>? = null, secondaryAllocationIds: Output<List<String>>? = null, secondaryPrivateIpAddressCount: Output<Int>? = null, secondaryPrivateIpAddresses: Output<List<String>>? = null, subnetId: Output<String>? = null, tags: Output<Map<String, String>>? = null)

Properties

Link copied to clipboard
val allocationId: Output<String>? = null

The Allocation ID of the Elastic IP address for the NAT Gateway. Required for connectivity_type of public.

Link copied to clipboard
val connectivityType: Output<String>? = null

Connectivity type for the NAT Gateway. Valid values are private and public. Defaults to public.

Link copied to clipboard
val privateIp: Output<String>? = null

The private IPv4 address to assign to the NAT Gateway. If you don't provide an address, a private IPv4 address will be automatically assigned.

Link copied to clipboard
val secondaryAllocationIds: Output<List<String>>? = null

A list of secondary allocation EIP IDs for this NAT Gateway.

Link copied to clipboard
val secondaryPrivateIpAddressCount: Output<Int>? = null

Private NAT Gateway only The number of secondary private IPv4 addresses you want to assign to the NAT Gateway.

Link copied to clipboard

A list of secondary private IPv4 addresses to assign to the NAT Gateway.

Link copied to clipboard
val subnetId: Output<String>? = null

The Subnet ID of the subnet in which to place the NAT Gateway.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

A map of tags to assign to the resource. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Functions

Link copied to clipboard
open override fun toJava(): NatGatewayArgs