Nat Gateway
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());
}
}Content copied to clipboard
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());
}
}Content copied to clipboard
Import
NAT Gateways can be imported using the id, e.g.,
$ pulumi import aws:ec2/natGateway:NatGateway private_gw nat-05dba92075d71c408Content copied to clipboard
Properties
Link copied to clipboard
The Allocation ID of the Elastic IP address for the gateway. Required for connectivity_type of public.
Link copied to clipboard
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
Connectivity type for the gateway. Valid values are private and public. Defaults to public.
Link copied to clipboard
The ID of the network interface associated with the NAT gateway.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard