1. Packages
  2. Volcengine
  3. API Docs
  4. nat
  5. Gateway
Volcengine v0.0.39 published on Friday, Nov 21, 2025 by Volcengine
volcengine logo
Volcengine v0.0.39 published on Friday, Nov 21, 2025 by Volcengine

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as volcengine from "@pulumi/volcengine";
    import * as volcengine from "@volcengine/pulumi";
    
    const fooZones = volcengine.ecs.getZones({});
    const fooVpc = new volcengine.vpc.Vpc("fooVpc", {
        vpcName: "acc-test-vpc",
        cidrBlock: "172.16.0.0/16",
    });
    const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", {
        subnetName: "acc-test-subnet",
        cidrBlock: "172.16.0.0/24",
        zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
        vpcId: fooVpc.id,
    });
    // create internet nat gateway and snat entry and dnat entry
    const internetNatGateway = new volcengine.nat.Gateway("internetNatGateway", {
        vpcId: fooVpc.id,
        subnetId: fooSubnet.id,
        spec: "Small",
        natGatewayName: "acc-test-internet_ng",
        description: "acc-test",
        billingType: "PostPaid",
        projectName: "default",
        tags: [{
            key: "k1",
            value: "v1",
        }],
    });
    const fooAddress = new volcengine.eip.Address("fooAddress", {
        description: "acc-test",
        bandwidth: 1,
        billingType: "PostPaidByBandwidth",
        isp: "BGP",
    });
    const fooAssociate = new volcengine.eip.Associate("fooAssociate", {
        allocationId: fooAddress.id,
        instanceId: internetNatGateway.id,
        instanceType: "Nat",
    });
    const fooSnatEntry = new volcengine.nat.SnatEntry("fooSnatEntry", {
        snatEntryName: "acc-test-snat-entry",
        natGatewayId: internetNatGateway.id,
        eipId: fooAddress.id,
        sourceCidr: "172.16.0.0/24",
    }, {
        dependsOn: [fooAssociate],
    });
    const fooDnatEntry = new volcengine.nat.DnatEntry("fooDnatEntry", {
        dnatEntryName: "acc-test-dnat-entry",
        externalIp: fooAddress.eipAddress,
        externalPort: "80",
        internalIp: "172.16.0.10",
        internalPort: "80",
        natGatewayId: internetNatGateway.id,
        protocol: "tcp",
    }, {
        dependsOn: [fooAssociate],
    });
    // create intranet nat gateway and snat entry and dnat entry
    const intranetNatGateway = new volcengine.nat.Gateway("intranetNatGateway", {
        vpcId: fooVpc.id,
        subnetId: fooSubnet.id,
        natGatewayName: "acc-test-intranet_ng",
        description: "acc-test",
        networkType: "intranet",
        billingType: "PostPaidByUsage",
        projectName: "default",
        tags: [{
            key: "k1",
            value: "v1",
        }],
    });
    const fooIp = new volcengine.nat.Ip("fooIp", {
        natGatewayId: intranetNatGateway.id,
        natIpName: "acc-test-nat-ip",
        natIpDescription: "acc-test",
        natIp: "172.16.0.3",
    });
    const foo_intranetSnatEntry = new volcengine.nat.SnatEntry("foo-intranetSnatEntry", {
        snatEntryName: "acc-test-snat-entry-intranet",
        natGatewayId: intranetNatGateway.id,
        natIpId: fooIp.id,
        sourceCidr: "172.16.0.0/24",
    });
    const foo_intranetDnatEntry = new volcengine.nat.DnatEntry("foo-intranetDnatEntry", {
        natGatewayId: intranetNatGateway.id,
        dnatEntryName: "acc-test-dnat-entry-intranet",
        protocol: "tcp",
        internalIp: "172.16.0.5",
        internalPort: "82",
        externalIp: fooIp.natIp,
        externalPort: "87",
    });
    
    import pulumi
    import pulumi_volcengine as volcengine
    
    foo_zones = volcengine.ecs.get_zones()
    foo_vpc = volcengine.vpc.Vpc("fooVpc",
        vpc_name="acc-test-vpc",
        cidr_block="172.16.0.0/16")
    foo_subnet = volcengine.vpc.Subnet("fooSubnet",
        subnet_name="acc-test-subnet",
        cidr_block="172.16.0.0/24",
        zone_id=foo_zones.zones[0].id,
        vpc_id=foo_vpc.id)
    # create internet nat gateway and snat entry and dnat entry
    internet_nat_gateway = volcengine.nat.Gateway("internetNatGateway",
        vpc_id=foo_vpc.id,
        subnet_id=foo_subnet.id,
        spec="Small",
        nat_gateway_name="acc-test-internet_ng",
        description="acc-test",
        billing_type="PostPaid",
        project_name="default",
        tags=[volcengine.nat.GatewayTagArgs(
            key="k1",
            value="v1",
        )])
    foo_address = volcengine.eip.Address("fooAddress",
        description="acc-test",
        bandwidth=1,
        billing_type="PostPaidByBandwidth",
        isp="BGP")
    foo_associate = volcengine.eip.Associate("fooAssociate",
        allocation_id=foo_address.id,
        instance_id=internet_nat_gateway.id,
        instance_type="Nat")
    foo_snat_entry = volcengine.nat.SnatEntry("fooSnatEntry",
        snat_entry_name="acc-test-snat-entry",
        nat_gateway_id=internet_nat_gateway.id,
        eip_id=foo_address.id,
        source_cidr="172.16.0.0/24",
        opts=pulumi.ResourceOptions(depends_on=[foo_associate]))
    foo_dnat_entry = volcengine.nat.DnatEntry("fooDnatEntry",
        dnat_entry_name="acc-test-dnat-entry",
        external_ip=foo_address.eip_address,
        external_port="80",
        internal_ip="172.16.0.10",
        internal_port="80",
        nat_gateway_id=internet_nat_gateway.id,
        protocol="tcp",
        opts=pulumi.ResourceOptions(depends_on=[foo_associate]))
    # create intranet nat gateway and snat entry and dnat entry
    intranet_nat_gateway = volcengine.nat.Gateway("intranetNatGateway",
        vpc_id=foo_vpc.id,
        subnet_id=foo_subnet.id,
        nat_gateway_name="acc-test-intranet_ng",
        description="acc-test",
        network_type="intranet",
        billing_type="PostPaidByUsage",
        project_name="default",
        tags=[volcengine.nat.GatewayTagArgs(
            key="k1",
            value="v1",
        )])
    foo_ip = volcengine.nat.Ip("fooIp",
        nat_gateway_id=intranet_nat_gateway.id,
        nat_ip_name="acc-test-nat-ip",
        nat_ip_description="acc-test",
        nat_ip="172.16.0.3")
    foo_intranet_snat_entry = volcengine.nat.SnatEntry("foo-intranetSnatEntry",
        snat_entry_name="acc-test-snat-entry-intranet",
        nat_gateway_id=intranet_nat_gateway.id,
        nat_ip_id=foo_ip.id,
        source_cidr="172.16.0.0/24")
    foo_intranet_dnat_entry = volcengine.nat.DnatEntry("foo-intranetDnatEntry",
        nat_gateway_id=intranet_nat_gateway.id,
        dnat_entry_name="acc-test-dnat-entry-intranet",
        protocol="tcp",
        internal_ip="172.16.0.5",
        internal_port="82",
        external_ip=foo_ip.nat_ip,
        external_port="87")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/ecs"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/eip"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/nat"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/vpc"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		fooZones, err := ecs.GetZones(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		fooVpc, err := vpc.NewVpc(ctx, "fooVpc", &vpc.VpcArgs{
    			VpcName:   pulumi.String("acc-test-vpc"),
    			CidrBlock: pulumi.String("172.16.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		fooSubnet, err := vpc.NewSubnet(ctx, "fooSubnet", &vpc.SubnetArgs{
    			SubnetName: pulumi.String("acc-test-subnet"),
    			CidrBlock:  pulumi.String("172.16.0.0/24"),
    			ZoneId:     pulumi.String(fooZones.Zones[0].Id),
    			VpcId:      fooVpc.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		// create internet nat gateway and snat entry and dnat entry
    		internetNatGateway, err := nat.NewGateway(ctx, "internetNatGateway", &nat.GatewayArgs{
    			VpcId:          fooVpc.ID(),
    			SubnetId:       fooSubnet.ID(),
    			Spec:           pulumi.String("Small"),
    			NatGatewayName: pulumi.String("acc-test-internet_ng"),
    			Description:    pulumi.String("acc-test"),
    			BillingType:    pulumi.String("PostPaid"),
    			ProjectName:    pulumi.String("default"),
    			Tags: nat.GatewayTagArray{
    				&nat.GatewayTagArgs{
    					Key:   pulumi.String("k1"),
    					Value: pulumi.String("v1"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		fooAddress, err := eip.NewAddress(ctx, "fooAddress", &eip.AddressArgs{
    			Description: pulumi.String("acc-test"),
    			Bandwidth:   pulumi.Int(1),
    			BillingType: pulumi.String("PostPaidByBandwidth"),
    			Isp:         pulumi.String("BGP"),
    		})
    		if err != nil {
    			return err
    		}
    		fooAssociate, err := eip.NewAssociate(ctx, "fooAssociate", &eip.AssociateArgs{
    			AllocationId: fooAddress.ID(),
    			InstanceId:   internetNatGateway.ID(),
    			InstanceType: pulumi.String("Nat"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = nat.NewSnatEntry(ctx, "fooSnatEntry", &nat.SnatEntryArgs{
    			SnatEntryName: pulumi.String("acc-test-snat-entry"),
    			NatGatewayId:  internetNatGateway.ID(),
    			EipId:         fooAddress.ID(),
    			SourceCidr:    pulumi.String("172.16.0.0/24"),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			fooAssociate,
    		}))
    		if err != nil {
    			return err
    		}
    		_, err = nat.NewDnatEntry(ctx, "fooDnatEntry", &nat.DnatEntryArgs{
    			DnatEntryName: pulumi.String("acc-test-dnat-entry"),
    			ExternalIp:    fooAddress.EipAddress,
    			ExternalPort:  pulumi.String("80"),
    			InternalIp:    pulumi.String("172.16.0.10"),
    			InternalPort:  pulumi.String("80"),
    			NatGatewayId:  internetNatGateway.ID(),
    			Protocol:      pulumi.String("tcp"),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			fooAssociate,
    		}))
    		if err != nil {
    			return err
    		}
    		// create intranet nat gateway and snat entry and dnat entry
    		intranetNatGateway, err := nat.NewGateway(ctx, "intranetNatGateway", &nat.GatewayArgs{
    			VpcId:          fooVpc.ID(),
    			SubnetId:       fooSubnet.ID(),
    			NatGatewayName: pulumi.String("acc-test-intranet_ng"),
    			Description:    pulumi.String("acc-test"),
    			NetworkType:    pulumi.String("intranet"),
    			BillingType:    pulumi.String("PostPaidByUsage"),
    			ProjectName:    pulumi.String("default"),
    			Tags: nat.GatewayTagArray{
    				&nat.GatewayTagArgs{
    					Key:   pulumi.String("k1"),
    					Value: pulumi.String("v1"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		fooIp, err := nat.NewIp(ctx, "fooIp", &nat.IpArgs{
    			NatGatewayId:     intranetNatGateway.ID(),
    			NatIpName:        pulumi.String("acc-test-nat-ip"),
    			NatIpDescription: pulumi.String("acc-test"),
    			NatIp:            pulumi.String("172.16.0.3"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = nat.NewSnatEntry(ctx, "foo-intranetSnatEntry", &nat.SnatEntryArgs{
    			SnatEntryName: pulumi.String("acc-test-snat-entry-intranet"),
    			NatGatewayId:  intranetNatGateway.ID(),
    			NatIpId:       fooIp.ID(),
    			SourceCidr:    pulumi.String("172.16.0.0/24"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = nat.NewDnatEntry(ctx, "foo-intranetDnatEntry", &nat.DnatEntryArgs{
    			NatGatewayId:  intranetNatGateway.ID(),
    			DnatEntryName: pulumi.String("acc-test-dnat-entry-intranet"),
    			Protocol:      pulumi.String("tcp"),
    			InternalIp:    pulumi.String("172.16.0.5"),
    			InternalPort:  pulumi.String("82"),
    			ExternalIp:    fooIp.NatIp,
    			ExternalPort:  pulumi.String("87"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Volcengine = Pulumi.Volcengine;
    
    return await Deployment.RunAsync(() => 
    {
        var fooZones = Volcengine.Ecs.GetZones.Invoke();
    
        var fooVpc = new Volcengine.Vpc.Vpc("fooVpc", new()
        {
            VpcName = "acc-test-vpc",
            CidrBlock = "172.16.0.0/16",
        });
    
        var fooSubnet = new Volcengine.Vpc.Subnet("fooSubnet", new()
        {
            SubnetName = "acc-test-subnet",
            CidrBlock = "172.16.0.0/24",
            ZoneId = fooZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
            VpcId = fooVpc.Id,
        });
    
        // create internet nat gateway and snat entry and dnat entry
        var internetNatGateway = new Volcengine.Nat.Gateway("internetNatGateway", new()
        {
            VpcId = fooVpc.Id,
            SubnetId = fooSubnet.Id,
            Spec = "Small",
            NatGatewayName = "acc-test-internet_ng",
            Description = "acc-test",
            BillingType = "PostPaid",
            ProjectName = "default",
            Tags = new[]
            {
                new Volcengine.Nat.Inputs.GatewayTagArgs
                {
                    Key = "k1",
                    Value = "v1",
                },
            },
        });
    
        var fooAddress = new Volcengine.Eip.Address("fooAddress", new()
        {
            Description = "acc-test",
            Bandwidth = 1,
            BillingType = "PostPaidByBandwidth",
            Isp = "BGP",
        });
    
        var fooAssociate = new Volcengine.Eip.Associate("fooAssociate", new()
        {
            AllocationId = fooAddress.Id,
            InstanceId = internetNatGateway.Id,
            InstanceType = "Nat",
        });
    
        var fooSnatEntry = new Volcengine.Nat.SnatEntry("fooSnatEntry", new()
        {
            SnatEntryName = "acc-test-snat-entry",
            NatGatewayId = internetNatGateway.Id,
            EipId = fooAddress.Id,
            SourceCidr = "172.16.0.0/24",
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                fooAssociate,
            },
        });
    
        var fooDnatEntry = new Volcengine.Nat.DnatEntry("fooDnatEntry", new()
        {
            DnatEntryName = "acc-test-dnat-entry",
            ExternalIp = fooAddress.EipAddress,
            ExternalPort = "80",
            InternalIp = "172.16.0.10",
            InternalPort = "80",
            NatGatewayId = internetNatGateway.Id,
            Protocol = "tcp",
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                fooAssociate,
            },
        });
    
        // create intranet nat gateway and snat entry and dnat entry
        var intranetNatGateway = new Volcengine.Nat.Gateway("intranetNatGateway", new()
        {
            VpcId = fooVpc.Id,
            SubnetId = fooSubnet.Id,
            NatGatewayName = "acc-test-intranet_ng",
            Description = "acc-test",
            NetworkType = "intranet",
            BillingType = "PostPaidByUsage",
            ProjectName = "default",
            Tags = new[]
            {
                new Volcengine.Nat.Inputs.GatewayTagArgs
                {
                    Key = "k1",
                    Value = "v1",
                },
            },
        });
    
        var fooIp = new Volcengine.Nat.Ip("fooIp", new()
        {
            NatGatewayId = intranetNatGateway.Id,
            NatIpName = "acc-test-nat-ip",
            NatIpDescription = "acc-test",
            NatIp = "172.16.0.3",
        });
    
        var foo_intranetSnatEntry = new Volcengine.Nat.SnatEntry("foo-intranetSnatEntry", new()
        {
            SnatEntryName = "acc-test-snat-entry-intranet",
            NatGatewayId = intranetNatGateway.Id,
            NatIpId = fooIp.Id,
            SourceCidr = "172.16.0.0/24",
        });
    
        var foo_intranetDnatEntry = new Volcengine.Nat.DnatEntry("foo-intranetDnatEntry", new()
        {
            NatGatewayId = intranetNatGateway.Id,
            DnatEntryName = "acc-test-dnat-entry-intranet",
            Protocol = "tcp",
            InternalIp = "172.16.0.5",
            InternalPort = "82",
            ExternalIp = fooIp.NatIp,
            ExternalPort = "87",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.volcengine.ecs.EcsFunctions;
    import com.pulumi.volcengine.ecs.inputs.GetZonesArgs;
    import com.pulumi.volcengine.vpc.Vpc;
    import com.pulumi.volcengine.vpc.VpcArgs;
    import com.pulumi.volcengine.vpc.Subnet;
    import com.pulumi.volcengine.vpc.SubnetArgs;
    import com.pulumi.volcengine.nat.Gateway;
    import com.pulumi.volcengine.nat.GatewayArgs;
    import com.pulumi.volcengine.nat.inputs.GatewayTagArgs;
    import com.pulumi.volcengine.eip.Address;
    import com.pulumi.volcengine.eip.AddressArgs;
    import com.pulumi.volcengine.eip.Associate;
    import com.pulumi.volcengine.eip.AssociateArgs;
    import com.pulumi.volcengine.nat.SnatEntry;
    import com.pulumi.volcengine.nat.SnatEntryArgs;
    import com.pulumi.volcengine.nat.DnatEntry;
    import com.pulumi.volcengine.nat.DnatEntryArgs;
    import com.pulumi.volcengine.nat.Ip;
    import com.pulumi.volcengine.nat.IpArgs;
    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) {
            final var fooZones = EcsFunctions.getZones();
    
            var fooVpc = new Vpc("fooVpc", VpcArgs.builder()        
                .vpcName("acc-test-vpc")
                .cidrBlock("172.16.0.0/16")
                .build());
    
            var fooSubnet = new Subnet("fooSubnet", SubnetArgs.builder()        
                .subnetName("acc-test-subnet")
                .cidrBlock("172.16.0.0/24")
                .zoneId(fooZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
                .vpcId(fooVpc.id())
                .build());
    
            // create internet nat gateway and snat entry and dnat entry
            var internetNatGateway = new Gateway("internetNatGateway", GatewayArgs.builder()        
                .vpcId(fooVpc.id())
                .subnetId(fooSubnet.id())
                .spec("Small")
                .natGatewayName("acc-test-internet_ng")
                .description("acc-test")
                .billingType("PostPaid")
                .projectName("default")
                .tags(GatewayTagArgs.builder()
                    .key("k1")
                    .value("v1")
                    .build())
                .build());
    
            var fooAddress = new Address("fooAddress", AddressArgs.builder()        
                .description("acc-test")
                .bandwidth(1)
                .billingType("PostPaidByBandwidth")
                .isp("BGP")
                .build());
    
            var fooAssociate = new Associate("fooAssociate", AssociateArgs.builder()        
                .allocationId(fooAddress.id())
                .instanceId(internetNatGateway.id())
                .instanceType("Nat")
                .build());
    
            var fooSnatEntry = new SnatEntry("fooSnatEntry", SnatEntryArgs.builder()        
                .snatEntryName("acc-test-snat-entry")
                .natGatewayId(internetNatGateway.id())
                .eipId(fooAddress.id())
                .sourceCidr("172.16.0.0/24")
                .build(), CustomResourceOptions.builder()
                    .dependsOn(fooAssociate)
                    .build());
    
            var fooDnatEntry = new DnatEntry("fooDnatEntry", DnatEntryArgs.builder()        
                .dnatEntryName("acc-test-dnat-entry")
                .externalIp(fooAddress.eipAddress())
                .externalPort(80)
                .internalIp("172.16.0.10")
                .internalPort(80)
                .natGatewayId(internetNatGateway.id())
                .protocol("tcp")
                .build(), CustomResourceOptions.builder()
                    .dependsOn(fooAssociate)
                    .build());
    
            // create intranet nat gateway and snat entry and dnat entry
            var intranetNatGateway = new Gateway("intranetNatGateway", GatewayArgs.builder()        
                .vpcId(fooVpc.id())
                .subnetId(fooSubnet.id())
                .natGatewayName("acc-test-intranet_ng")
                .description("acc-test")
                .networkType("intranet")
                .billingType("PostPaidByUsage")
                .projectName("default")
                .tags(GatewayTagArgs.builder()
                    .key("k1")
                    .value("v1")
                    .build())
                .build());
    
            var fooIp = new Ip("fooIp", IpArgs.builder()        
                .natGatewayId(intranetNatGateway.id())
                .natIpName("acc-test-nat-ip")
                .natIpDescription("acc-test")
                .natIp("172.16.0.3")
                .build());
    
            var foo_intranetSnatEntry = new SnatEntry("foo-intranetSnatEntry", SnatEntryArgs.builder()        
                .snatEntryName("acc-test-snat-entry-intranet")
                .natGatewayId(intranetNatGateway.id())
                .natIpId(fooIp.id())
                .sourceCidr("172.16.0.0/24")
                .build());
    
            var foo_intranetDnatEntry = new DnatEntry("foo-intranetDnatEntry", DnatEntryArgs.builder()        
                .natGatewayId(intranetNatGateway.id())
                .dnatEntryName("acc-test-dnat-entry-intranet")
                .protocol("tcp")
                .internalIp("172.16.0.5")
                .internalPort("82")
                .externalIp(fooIp.natIp())
                .externalPort("87")
                .build());
    
        }
    }
    
    resources:
      fooVpc:
        type: volcengine:vpc:Vpc
        properties:
          vpcName: acc-test-vpc
          cidrBlock: 172.16.0.0/16
      fooSubnet:
        type: volcengine:vpc:Subnet
        properties:
          subnetName: acc-test-subnet
          cidrBlock: 172.16.0.0/24
          zoneId: ${fooZones.zones[0].id}
          vpcId: ${fooVpc.id}
      # create internet nat gateway and snat entry and dnat entry
      internetNatGateway:
        type: volcengine:nat:Gateway
        properties:
          vpcId: ${fooVpc.id}
          subnetId: ${fooSubnet.id}
          spec: Small
          natGatewayName: acc-test-internet_ng
          description: acc-test
          billingType: PostPaid
          projectName: default
          tags:
            - key: k1
              value: v1
      fooAddress:
        type: volcengine:eip:Address
        properties:
          description: acc-test
          bandwidth: 1
          billingType: PostPaidByBandwidth
          isp: BGP
      fooAssociate:
        type: volcengine:eip:Associate
        properties:
          allocationId: ${fooAddress.id}
          instanceId: ${internetNatGateway.id}
          instanceType: Nat
      fooSnatEntry:
        type: volcengine:nat:SnatEntry
        properties:
          snatEntryName: acc-test-snat-entry
          natGatewayId: ${internetNatGateway.id}
          eipId: ${fooAddress.id}
          sourceCidr: 172.16.0.0/24
        options:
          dependson:
            - ${fooAssociate}
      fooDnatEntry:
        type: volcengine:nat:DnatEntry
        properties:
          dnatEntryName: acc-test-dnat-entry
          externalIp: ${fooAddress.eipAddress}
          externalPort: 80
          internalIp: 172.16.0.10
          internalPort: 80
          natGatewayId: ${internetNatGateway.id}
          protocol: tcp
        options:
          dependson:
            - ${fooAssociate}
      # create intranet nat gateway and snat entry and dnat entry
      intranetNatGateway:
        type: volcengine:nat:Gateway
        properties:
          vpcId: ${fooVpc.id}
          subnetId: ${fooSubnet.id}
          natGatewayName: acc-test-intranet_ng
          description: acc-test
          networkType: intranet
          billingType: PostPaidByUsage
          projectName: default
          tags:
            - key: k1
              value: v1
      fooIp:
        type: volcengine:nat:Ip
        properties:
          natGatewayId: ${intranetNatGateway.id}
          natIpName: acc-test-nat-ip
          natIpDescription: acc-test
          natIp: 172.16.0.3
      foo-intranetSnatEntry:
        type: volcengine:nat:SnatEntry
        properties:
          snatEntryName: acc-test-snat-entry-intranet
          natGatewayId: ${intranetNatGateway.id}
          natIpId: ${fooIp.id}
          sourceCidr: 172.16.0.0/24
      foo-intranetDnatEntry:
        type: volcengine:nat:DnatEntry
        properties:
          natGatewayId: ${intranetNatGateway.id}
          dnatEntryName: acc-test-dnat-entry-intranet
          protocol: tcp
          internalIp: 172.16.0.5
          internalPort: '82'
          externalIp: ${fooIp.natIp}
          externalPort: '87'
    variables:
      fooZones:
        fn::invoke:
          Function: volcengine:ecs:getZones
          Arguments: {}
    

    Create Gateway Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Gateway(name: string, args: GatewayArgs, opts?: CustomResourceOptions);
    @overload
    def Gateway(resource_name: str,
                args: GatewayArgs,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def Gateway(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                subnet_id: Optional[str] = None,
                vpc_id: Optional[str] = None,
                billing_type: Optional[str] = None,
                description: Optional[str] = None,
                nat_gateway_name: Optional[str] = None,
                network_type: Optional[str] = None,
                period: Optional[int] = None,
                project_name: Optional[str] = None,
                spec: Optional[str] = None,
                tags: Optional[Sequence[GatewayTagArgs]] = None)
    func NewGateway(ctx *Context, name string, args GatewayArgs, opts ...ResourceOption) (*Gateway, error)
    public Gateway(string name, GatewayArgs args, CustomResourceOptions? opts = null)
    public Gateway(String name, GatewayArgs args)
    public Gateway(String name, GatewayArgs args, CustomResourceOptions options)
    
    type: volcengine:nat:Gateway
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args GatewayArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args GatewayArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args GatewayArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args GatewayArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args GatewayArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var volcengineGatewayResource = new Volcengine.Nat.Gateway("volcengineGatewayResource", new()
    {
        SubnetId = "string",
        VpcId = "string",
        BillingType = "string",
        Description = "string",
        NatGatewayName = "string",
        NetworkType = "string",
        Period = 0,
        ProjectName = "string",
        Spec = "string",
        Tags = new[]
        {
            new Volcengine.Nat.Inputs.GatewayTagArgs
            {
                Key = "string",
                Value = "string",
            },
        },
    });
    
    example, err := nat.NewGateway(ctx, "volcengineGatewayResource", &nat.GatewayArgs{
    	SubnetId:       pulumi.String("string"),
    	VpcId:          pulumi.String("string"),
    	BillingType:    pulumi.String("string"),
    	Description:    pulumi.String("string"),
    	NatGatewayName: pulumi.String("string"),
    	NetworkType:    pulumi.String("string"),
    	Period:         pulumi.Int(0),
    	ProjectName:    pulumi.String("string"),
    	Spec:           pulumi.String("string"),
    	Tags: nat.GatewayTagArray{
    		&nat.GatewayTagArgs{
    			Key:   pulumi.String("string"),
    			Value: pulumi.String("string"),
    		},
    	},
    })
    
    var volcengineGatewayResource = new com.pulumi.volcengine.nat.Gateway("volcengineGatewayResource", com.pulumi.volcengine.nat.GatewayArgs.builder()
        .subnetId("string")
        .vpcId("string")
        .billingType("string")
        .description("string")
        .natGatewayName("string")
        .networkType("string")
        .period(0)
        .projectName("string")
        .spec("string")
        .tags(GatewayTagArgs.builder()
            .key("string")
            .value("string")
            .build())
        .build());
    
    volcengine_gateway_resource = volcengine.nat.Gateway("volcengineGatewayResource",
        subnet_id="string",
        vpc_id="string",
        billing_type="string",
        description="string",
        nat_gateway_name="string",
        network_type="string",
        period=0,
        project_name="string",
        spec="string",
        tags=[{
            "key": "string",
            "value": "string",
        }])
    
    const volcengineGatewayResource = new volcengine.nat.Gateway("volcengineGatewayResource", {
        subnetId: "string",
        vpcId: "string",
        billingType: "string",
        description: "string",
        natGatewayName: "string",
        networkType: "string",
        period: 0,
        projectName: "string",
        spec: "string",
        tags: [{
            key: "string",
            value: "string",
        }],
    });
    
    type: volcengine:nat:Gateway
    properties:
        billingType: string
        description: string
        natGatewayName: string
        networkType: string
        period: 0
        projectName: string
        spec: string
        subnetId: string
        tags:
            - key: string
              value: string
        vpcId: string
    

    Gateway Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Gateway resource accepts the following input properties:

    SubnetId string
    The ID of the Subnet.
    VpcId string
    The ID of the VPC.
    BillingType string
    The billing type of the NatGateway, the value is PostPaid or PrePaid or PostPaidByUsage. Default value is PostPaid. When the network_type is intranet, the billing type must be PostPaidByUsage.
    Description string
    The description of the NatGateway.
    NatGatewayName string
    The name of the NatGateway.
    NetworkType string
    The network type of the NatGateway. Valid values are internet and intranet. Default value is internet.
    Period int
    The period of the NatGateway, the valid value range in 1~9 or 12 or 24 or 36. Default value is 12. The period unit defaults to Month.This field is only effective when creating a PrePaid NatGateway. When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignore_changes ignore changes in fields.
    ProjectName string
    The ProjectName of the NatGateway.
    Spec string
    The specification of the NatGateway. Optional choice contains Small(default), Medium, Large or leave blank. When the billing_type is PostPaidByUsage, this field should not be specified.
    Tags List<GatewayTag>
    Tags.
    SubnetId string
    The ID of the Subnet.
    VpcId string
    The ID of the VPC.
    BillingType string
    The billing type of the NatGateway, the value is PostPaid or PrePaid or PostPaidByUsage. Default value is PostPaid. When the network_type is intranet, the billing type must be PostPaidByUsage.
    Description string
    The description of the NatGateway.
    NatGatewayName string
    The name of the NatGateway.
    NetworkType string
    The network type of the NatGateway. Valid values are internet and intranet. Default value is internet.
    Period int
    The period of the NatGateway, the valid value range in 1~9 or 12 or 24 or 36. Default value is 12. The period unit defaults to Month.This field is only effective when creating a PrePaid NatGateway. When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignore_changes ignore changes in fields.
    ProjectName string
    The ProjectName of the NatGateway.
    Spec string
    The specification of the NatGateway. Optional choice contains Small(default), Medium, Large or leave blank. When the billing_type is PostPaidByUsage, this field should not be specified.
    Tags []GatewayTagArgs
    Tags.
    subnetId String
    The ID of the Subnet.
    vpcId String
    The ID of the VPC.
    billingType String
    The billing type of the NatGateway, the value is PostPaid or PrePaid or PostPaidByUsage. Default value is PostPaid. When the network_type is intranet, the billing type must be PostPaidByUsage.
    description String
    The description of the NatGateway.
    natGatewayName String
    The name of the NatGateway.
    networkType String
    The network type of the NatGateway. Valid values are internet and intranet. Default value is internet.
    period Integer
    The period of the NatGateway, the valid value range in 1~9 or 12 or 24 or 36. Default value is 12. The period unit defaults to Month.This field is only effective when creating a PrePaid NatGateway. When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignore_changes ignore changes in fields.
    projectName String
    The ProjectName of the NatGateway.
    spec String
    The specification of the NatGateway. Optional choice contains Small(default), Medium, Large or leave blank. When the billing_type is PostPaidByUsage, this field should not be specified.
    tags List<GatewayTag>
    Tags.
    subnetId string
    The ID of the Subnet.
    vpcId string
    The ID of the VPC.
    billingType string
    The billing type of the NatGateway, the value is PostPaid or PrePaid or PostPaidByUsage. Default value is PostPaid. When the network_type is intranet, the billing type must be PostPaidByUsage.
    description string
    The description of the NatGateway.
    natGatewayName string
    The name of the NatGateway.
    networkType string
    The network type of the NatGateway. Valid values are internet and intranet. Default value is internet.
    period number
    The period of the NatGateway, the valid value range in 1~9 or 12 or 24 or 36. Default value is 12. The period unit defaults to Month.This field is only effective when creating a PrePaid NatGateway. When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignore_changes ignore changes in fields.
    projectName string
    The ProjectName of the NatGateway.
    spec string
    The specification of the NatGateway. Optional choice contains Small(default), Medium, Large or leave blank. When the billing_type is PostPaidByUsage, this field should not be specified.
    tags GatewayTag[]
    Tags.
    subnet_id str
    The ID of the Subnet.
    vpc_id str
    The ID of the VPC.
    billing_type str
    The billing type of the NatGateway, the value is PostPaid or PrePaid or PostPaidByUsage. Default value is PostPaid. When the network_type is intranet, the billing type must be PostPaidByUsage.
    description str
    The description of the NatGateway.
    nat_gateway_name str
    The name of the NatGateway.
    network_type str
    The network type of the NatGateway. Valid values are internet and intranet. Default value is internet.
    period int
    The period of the NatGateway, the valid value range in 1~9 or 12 or 24 or 36. Default value is 12. The period unit defaults to Month.This field is only effective when creating a PrePaid NatGateway. When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignore_changes ignore changes in fields.
    project_name str
    The ProjectName of the NatGateway.
    spec str
    The specification of the NatGateway. Optional choice contains Small(default), Medium, Large or leave blank. When the billing_type is PostPaidByUsage, this field should not be specified.
    tags Sequence[GatewayTagArgs]
    Tags.
    subnetId String
    The ID of the Subnet.
    vpcId String
    The ID of the VPC.
    billingType String
    The billing type of the NatGateway, the value is PostPaid or PrePaid or PostPaidByUsage. Default value is PostPaid. When the network_type is intranet, the billing type must be PostPaidByUsage.
    description String
    The description of the NatGateway.
    natGatewayName String
    The name of the NatGateway.
    networkType String
    The network type of the NatGateway. Valid values are internet and intranet. Default value is internet.
    period Number
    The period of the NatGateway, the valid value range in 1~9 or 12 or 24 or 36. Default value is 12. The period unit defaults to Month.This field is only effective when creating a PrePaid NatGateway. When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignore_changes ignore changes in fields.
    projectName String
    The ProjectName of the NatGateway.
    spec String
    The specification of the NatGateway. Optional choice contains Small(default), Medium, Large or leave blank. When the billing_type is PostPaidByUsage, this field should not be specified.
    tags List<Property Map>
    Tags.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Gateway resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Gateway Resource

    Get an existing Gateway resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: GatewayState, opts?: CustomResourceOptions): Gateway
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            billing_type: Optional[str] = None,
            description: Optional[str] = None,
            nat_gateway_name: Optional[str] = None,
            network_type: Optional[str] = None,
            period: Optional[int] = None,
            project_name: Optional[str] = None,
            spec: Optional[str] = None,
            subnet_id: Optional[str] = None,
            tags: Optional[Sequence[GatewayTagArgs]] = None,
            vpc_id: Optional[str] = None) -> Gateway
    func GetGateway(ctx *Context, name string, id IDInput, state *GatewayState, opts ...ResourceOption) (*Gateway, error)
    public static Gateway Get(string name, Input<string> id, GatewayState? state, CustomResourceOptions? opts = null)
    public static Gateway get(String name, Output<String> id, GatewayState state, CustomResourceOptions options)
    resources:  _:    type: volcengine:nat:Gateway    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    BillingType string
    The billing type of the NatGateway, the value is PostPaid or PrePaid or PostPaidByUsage. Default value is PostPaid. When the network_type is intranet, the billing type must be PostPaidByUsage.
    Description string
    The description of the NatGateway.
    NatGatewayName string
    The name of the NatGateway.
    NetworkType string
    The network type of the NatGateway. Valid values are internet and intranet. Default value is internet.
    Period int
    The period of the NatGateway, the valid value range in 1~9 or 12 or 24 or 36. Default value is 12. The period unit defaults to Month.This field is only effective when creating a PrePaid NatGateway. When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignore_changes ignore changes in fields.
    ProjectName string
    The ProjectName of the NatGateway.
    Spec string
    The specification of the NatGateway. Optional choice contains Small(default), Medium, Large or leave blank. When the billing_type is PostPaidByUsage, this field should not be specified.
    SubnetId string
    The ID of the Subnet.
    Tags List<GatewayTag>
    Tags.
    VpcId string
    The ID of the VPC.
    BillingType string
    The billing type of the NatGateway, the value is PostPaid or PrePaid or PostPaidByUsage. Default value is PostPaid. When the network_type is intranet, the billing type must be PostPaidByUsage.
    Description string
    The description of the NatGateway.
    NatGatewayName string
    The name of the NatGateway.
    NetworkType string
    The network type of the NatGateway. Valid values are internet and intranet. Default value is internet.
    Period int
    The period of the NatGateway, the valid value range in 1~9 or 12 or 24 or 36. Default value is 12. The period unit defaults to Month.This field is only effective when creating a PrePaid NatGateway. When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignore_changes ignore changes in fields.
    ProjectName string
    The ProjectName of the NatGateway.
    Spec string
    The specification of the NatGateway. Optional choice contains Small(default), Medium, Large or leave blank. When the billing_type is PostPaidByUsage, this field should not be specified.
    SubnetId string
    The ID of the Subnet.
    Tags []GatewayTagArgs
    Tags.
    VpcId string
    The ID of the VPC.
    billingType String
    The billing type of the NatGateway, the value is PostPaid or PrePaid or PostPaidByUsage. Default value is PostPaid. When the network_type is intranet, the billing type must be PostPaidByUsage.
    description String
    The description of the NatGateway.
    natGatewayName String
    The name of the NatGateway.
    networkType String
    The network type of the NatGateway. Valid values are internet and intranet. Default value is internet.
    period Integer
    The period of the NatGateway, the valid value range in 1~9 or 12 or 24 or 36. Default value is 12. The period unit defaults to Month.This field is only effective when creating a PrePaid NatGateway. When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignore_changes ignore changes in fields.
    projectName String
    The ProjectName of the NatGateway.
    spec String
    The specification of the NatGateway. Optional choice contains Small(default), Medium, Large or leave blank. When the billing_type is PostPaidByUsage, this field should not be specified.
    subnetId String
    The ID of the Subnet.
    tags List<GatewayTag>
    Tags.
    vpcId String
    The ID of the VPC.
    billingType string
    The billing type of the NatGateway, the value is PostPaid or PrePaid or PostPaidByUsage. Default value is PostPaid. When the network_type is intranet, the billing type must be PostPaidByUsage.
    description string
    The description of the NatGateway.
    natGatewayName string
    The name of the NatGateway.
    networkType string
    The network type of the NatGateway. Valid values are internet and intranet. Default value is internet.
    period number
    The period of the NatGateway, the valid value range in 1~9 or 12 or 24 or 36. Default value is 12. The period unit defaults to Month.This field is only effective when creating a PrePaid NatGateway. When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignore_changes ignore changes in fields.
    projectName string
    The ProjectName of the NatGateway.
    spec string
    The specification of the NatGateway. Optional choice contains Small(default), Medium, Large or leave blank. When the billing_type is PostPaidByUsage, this field should not be specified.
    subnetId string
    The ID of the Subnet.
    tags GatewayTag[]
    Tags.
    vpcId string
    The ID of the VPC.
    billing_type str
    The billing type of the NatGateway, the value is PostPaid or PrePaid or PostPaidByUsage. Default value is PostPaid. When the network_type is intranet, the billing type must be PostPaidByUsage.
    description str
    The description of the NatGateway.
    nat_gateway_name str
    The name of the NatGateway.
    network_type str
    The network type of the NatGateway. Valid values are internet and intranet. Default value is internet.
    period int
    The period of the NatGateway, the valid value range in 1~9 or 12 or 24 or 36. Default value is 12. The period unit defaults to Month.This field is only effective when creating a PrePaid NatGateway. When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignore_changes ignore changes in fields.
    project_name str
    The ProjectName of the NatGateway.
    spec str
    The specification of the NatGateway. Optional choice contains Small(default), Medium, Large or leave blank. When the billing_type is PostPaidByUsage, this field should not be specified.
    subnet_id str
    The ID of the Subnet.
    tags Sequence[GatewayTagArgs]
    Tags.
    vpc_id str
    The ID of the VPC.
    billingType String
    The billing type of the NatGateway, the value is PostPaid or PrePaid or PostPaidByUsage. Default value is PostPaid. When the network_type is intranet, the billing type must be PostPaidByUsage.
    description String
    The description of the NatGateway.
    natGatewayName String
    The name of the NatGateway.
    networkType String
    The network type of the NatGateway. Valid values are internet and intranet. Default value is internet.
    period Number
    The period of the NatGateway, the valid value range in 1~9 or 12 or 24 or 36. Default value is 12. The period unit defaults to Month.This field is only effective when creating a PrePaid NatGateway. When importing resources, this attribute will not be imported. If this attribute is set, please use lifecycle and ignore_changes ignore changes in fields.
    projectName String
    The ProjectName of the NatGateway.
    spec String
    The specification of the NatGateway. Optional choice contains Small(default), Medium, Large or leave blank. When the billing_type is PostPaidByUsage, this field should not be specified.
    subnetId String
    The ID of the Subnet.
    tags List<Property Map>
    Tags.
    vpcId String
    The ID of the VPC.

    Supporting Types

    GatewayTag, GatewayTagArgs

    Key string
    The Key of Tags.
    Value string
    The Value of Tags.
    Key string
    The Key of Tags.
    Value string
    The Value of Tags.
    key String
    The Key of Tags.
    value String
    The Value of Tags.
    key string
    The Key of Tags.
    value string
    The Value of Tags.
    key str
    The Key of Tags.
    value str
    The Value of Tags.
    key String
    The Key of Tags.
    value String
    The Value of Tags.

    Import

    NatGateway can be imported using the id, e.g.

    $ pulumi import volcengine:nat/gateway:Gateway default ngw-vv3t043k05sm****
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    volcengine volcengine/pulumi-volcengine
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the volcengine Terraform Provider.
    volcengine logo
    Volcengine v0.0.39 published on Friday, Nov 21, 2025 by Volcengine
      Meet Neo: Your AI Platform Teammate