NatGateway

class NatGateway : KotlinCustomResource

Provides a resource to create a VPC NAT Gateway.

Example Usage

Public NAT

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(aws_eip.example().id())
.subnetId(aws_subnet.example().id())
.tags(Map.of("Name", "gw NAT"))
.build(), CustomResourceOptions.builder()
.dependsOn(aws_internet_gateway.example())
.build());
}
}

Public NAT with Secondary Private IP Addresses

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(aws_eip.example().id())
.subnetId(aws_subnet.example().id())
.secondaryAllocationIds(aws_eip.secondary().id())
.secondaryPrivateIpAddresses("10.0.1.5")
.build());
}
}

Private NAT

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(aws_subnet.example().id())
.build());
}
}

Private NAT with Secondary Private IP Addresses

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(aws_subnet.example().id())
.secondaryPrivateIpAddressCount(7)
.build());
}
}

Import

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

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

Properties

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

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

Link copied to clipboard
val associationId: Output<String>

The association ID of the Elastic IP address that's associated with the NAT Gateway. Only available when connectivity_type is public.

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

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

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

The ID of the network interface associated with the NAT Gateway.

Link copied to clipboard
val privateIp: Output<String>

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 publicIp: Output<String>

The Elastic IP address associated with the NAT Gateway.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard

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>

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

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

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.

Link copied to clipboard
val tagsAll: Output<Map<String, String>>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Link copied to clipboard
val urn: Output<String>