1. Packages
  2. Alicloud Provider
  3. API Docs
  4. ens
  5. NatGateway
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

alicloud.ens.NatGateway

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

    Provides a Ens Nat Gateway resource.

    Nat gateway of ENS.

    For information about Ens Nat Gateway and how to use it, see What is Nat Gateway.

    NOTE: Available since v1.227.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const ensRegionId = config.get("ensRegionId") || "cn-chenzhou-telecom_unicom_cmcc";
    const defaultObbrL7 = new alicloud.ens.Network("defaultObbrL7", {
        networkName: name,
        description: name,
        cidrBlock: "10.0.0.0/8",
        ensRegionId: ensRegionId,
    });
    const defaulteFw783 = new alicloud.ens.Vswitch("defaulteFw783", {
        cidrBlock: "10.0.8.0/24",
        vswitchName: name,
        ensRegionId: defaultObbrL7.ensRegionId,
        networkId: defaultObbrL7.id,
    });
    const _default = new alicloud.ens.NatGateway("default", {
        vswitchId: defaulteFw783.id,
        ensRegionId: defaulteFw783.ensRegionId,
        networkId: defaulteFw783.networkId,
        instanceType: "enat.default",
        natName: name,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    ens_region_id = config.get("ensRegionId")
    if ens_region_id is None:
        ens_region_id = "cn-chenzhou-telecom_unicom_cmcc"
    default_obbr_l7 = alicloud.ens.Network("defaultObbrL7",
        network_name=name,
        description=name,
        cidr_block="10.0.0.0/8",
        ens_region_id=ens_region_id)
    defaulte_fw783 = alicloud.ens.Vswitch("defaulteFw783",
        cidr_block="10.0.8.0/24",
        vswitch_name=name,
        ens_region_id=default_obbr_l7.ens_region_id,
        network_id=default_obbr_l7.id)
    default = alicloud.ens.NatGateway("default",
        vswitch_id=defaulte_fw783.id,
        ens_region_id=defaulte_fw783.ens_region_id,
        network_id=defaulte_fw783.network_id,
        instance_type="enat.default",
        nat_name=name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ens"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		ensRegionId := "cn-chenzhou-telecom_unicom_cmcc"
    		if param := cfg.Get("ensRegionId"); param != "" {
    			ensRegionId = param
    		}
    		defaultObbrL7, err := ens.NewNetwork(ctx, "defaultObbrL7", &ens.NetworkArgs{
    			NetworkName: pulumi.String(name),
    			Description: pulumi.String(name),
    			CidrBlock:   pulumi.String("10.0.0.0/8"),
    			EnsRegionId: pulumi.String(ensRegionId),
    		})
    		if err != nil {
    			return err
    		}
    		defaulteFw783, err := ens.NewVswitch(ctx, "defaulteFw783", &ens.VswitchArgs{
    			CidrBlock:   pulumi.String("10.0.8.0/24"),
    			VswitchName: pulumi.String(name),
    			EnsRegionId: defaultObbrL7.EnsRegionId,
    			NetworkId:   defaultObbrL7.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ens.NewNatGateway(ctx, "default", &ens.NatGatewayArgs{
    			VswitchId:    defaulteFw783.ID(),
    			EnsRegionId:  defaulteFw783.EnsRegionId,
    			NetworkId:    defaulteFw783.NetworkId,
    			InstanceType: pulumi.String("enat.default"),
    			NatName:      pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var ensRegionId = config.Get("ensRegionId") ?? "cn-chenzhou-telecom_unicom_cmcc";
        var defaultObbrL7 = new AliCloud.Ens.Network("defaultObbrL7", new()
        {
            NetworkName = name,
            Description = name,
            CidrBlock = "10.0.0.0/8",
            EnsRegionId = ensRegionId,
        });
    
        var defaulteFw783 = new AliCloud.Ens.Vswitch("defaulteFw783", new()
        {
            CidrBlock = "10.0.8.0/24",
            VswitchName = name,
            EnsRegionId = defaultObbrL7.EnsRegionId,
            NetworkId = defaultObbrL7.Id,
        });
    
        var @default = new AliCloud.Ens.NatGateway("default", new()
        {
            VswitchId = defaulteFw783.Id,
            EnsRegionId = defaulteFw783.EnsRegionId,
            NetworkId = defaulteFw783.NetworkId,
            InstanceType = "enat.default",
            NatName = name,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ens.Network;
    import com.pulumi.alicloud.ens.NetworkArgs;
    import com.pulumi.alicloud.ens.Vswitch;
    import com.pulumi.alicloud.ens.VswitchArgs;
    import com.pulumi.alicloud.ens.NatGateway;
    import com.pulumi.alicloud.ens.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) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            final var ensRegionId = config.get("ensRegionId").orElse("cn-chenzhou-telecom_unicom_cmcc");
            var defaultObbrL7 = new Network("defaultObbrL7", NetworkArgs.builder()
                .networkName(name)
                .description(name)
                .cidrBlock("10.0.0.0/8")
                .ensRegionId(ensRegionId)
                .build());
    
            var defaulteFw783 = new Vswitch("defaulteFw783", VswitchArgs.builder()
                .cidrBlock("10.0.8.0/24")
                .vswitchName(name)
                .ensRegionId(defaultObbrL7.ensRegionId())
                .networkId(defaultObbrL7.id())
                .build());
    
            var default_ = new NatGateway("default", NatGatewayArgs.builder()
                .vswitchId(defaulteFw783.id())
                .ensRegionId(defaulteFw783.ensRegionId())
                .networkId(defaulteFw783.networkId())
                .instanceType("enat.default")
                .natName(name)
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
      ensRegionId:
        type: string
        default: cn-chenzhou-telecom_unicom_cmcc
    resources:
      defaultObbrL7:
        type: alicloud:ens:Network
        properties:
          networkName: ${name}
          description: ${name}
          cidrBlock: 10.0.0.0/8
          ensRegionId: ${ensRegionId}
      defaulteFw783:
        type: alicloud:ens:Vswitch
        properties:
          cidrBlock: 10.0.8.0/24
          vswitchName: ${name}
          ensRegionId: ${defaultObbrL7.ensRegionId}
          networkId: ${defaultObbrL7.id}
      default:
        type: alicloud:ens:NatGateway
        properties:
          vswitchId: ${defaulteFw783.id}
          ensRegionId: ${defaulteFw783.ensRegionId}
          networkId: ${defaulteFw783.networkId}
          instanceType: enat.default
          natName: ${name}
    

    Create NatGateway Resource

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

    Constructor syntax

    new NatGateway(name: string, args: NatGatewayArgs, opts?: CustomResourceOptions);
    @overload
    def NatGateway(resource_name: str,
                   args: NatGatewayArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def NatGateway(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   ens_region_id: Optional[str] = None,
                   network_id: Optional[str] = None,
                   vswitch_id: Optional[str] = None,
                   instance_type: Optional[str] = None,
                   nat_name: Optional[str] = None)
    func NewNatGateway(ctx *Context, name string, args NatGatewayArgs, opts ...ResourceOption) (*NatGateway, error)
    public NatGateway(string name, NatGatewayArgs args, CustomResourceOptions? opts = null)
    public NatGateway(String name, NatGatewayArgs args)
    public NatGateway(String name, NatGatewayArgs args, CustomResourceOptions options)
    
    type: alicloud:ens:NatGateway
    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 NatGatewayArgs
    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 NatGatewayArgs
    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 NatGatewayArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args NatGatewayArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args NatGatewayArgs
    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 natGatewayResource = new AliCloud.Ens.NatGateway("natGatewayResource", new()
    {
        EnsRegionId = "string",
        NetworkId = "string",
        VswitchId = "string",
        InstanceType = "string",
        NatName = "string",
    });
    
    example, err := ens.NewNatGateway(ctx, "natGatewayResource", &ens.NatGatewayArgs{
    	EnsRegionId:  pulumi.String("string"),
    	NetworkId:    pulumi.String("string"),
    	VswitchId:    pulumi.String("string"),
    	InstanceType: pulumi.String("string"),
    	NatName:      pulumi.String("string"),
    })
    
    var natGatewayResource = new NatGateway("natGatewayResource", NatGatewayArgs.builder()
        .ensRegionId("string")
        .networkId("string")
        .vswitchId("string")
        .instanceType("string")
        .natName("string")
        .build());
    
    nat_gateway_resource = alicloud.ens.NatGateway("natGatewayResource",
        ens_region_id="string",
        network_id="string",
        vswitch_id="string",
        instance_type="string",
        nat_name="string")
    
    const natGatewayResource = new alicloud.ens.NatGateway("natGatewayResource", {
        ensRegionId: "string",
        networkId: "string",
        vswitchId: "string",
        instanceType: "string",
        natName: "string",
    });
    
    type: alicloud:ens:NatGateway
    properties:
        ensRegionId: string
        instanceType: string
        natName: string
        networkId: string
        vswitchId: string
    

    NatGateway Resource Properties

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

    Inputs

    The NatGateway resource accepts the following input properties:

    EnsRegionId string
    The ID of the ENS node.
    NetworkId string
    The network ID.
    VswitchId string
    The vSwitch ID.
    InstanceType string
    NAT specifications. Value: enat.default.
    NatName string
    The name of the NAT gateway. The length is 1 to 128 characters, but it cannot start with 'http:// 'or 'https.
    EnsRegionId string
    The ID of the ENS node.
    NetworkId string
    The network ID.
    VswitchId string
    The vSwitch ID.
    InstanceType string
    NAT specifications. Value: enat.default.
    NatName string
    The name of the NAT gateway. The length is 1 to 128 characters, but it cannot start with 'http:// 'or 'https.
    ensRegionId String
    The ID of the ENS node.
    networkId String
    The network ID.
    vswitchId String
    The vSwitch ID.
    instanceType String
    NAT specifications. Value: enat.default.
    natName String
    The name of the NAT gateway. The length is 1 to 128 characters, but it cannot start with 'http:// 'or 'https.
    ensRegionId string
    The ID of the ENS node.
    networkId string
    The network ID.
    vswitchId string
    The vSwitch ID.
    instanceType string
    NAT specifications. Value: enat.default.
    natName string
    The name of the NAT gateway. The length is 1 to 128 characters, but it cannot start with 'http:// 'or 'https.
    ens_region_id str
    The ID of the ENS node.
    network_id str
    The network ID.
    vswitch_id str
    The vSwitch ID.
    instance_type str
    NAT specifications. Value: enat.default.
    nat_name str
    The name of the NAT gateway. The length is 1 to 128 characters, but it cannot start with 'http:// 'or 'https.
    ensRegionId String
    The ID of the ENS node.
    networkId String
    The network ID.
    vswitchId String
    The vSwitch ID.
    instanceType String
    NAT specifications. Value: enat.default.
    natName String
    The name of the NAT gateway. The length is 1 to 128 characters, but it cannot start with 'http:// 'or 'https.

    Outputs

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

    CreateTime string
    Creation time. UTC time, in the format of YYYY-MM-DDThh:mm:ssZ.
    Id string
    The provider-assigned unique ID for this managed resource.
    CreateTime string
    Creation time. UTC time, in the format of YYYY-MM-DDThh:mm:ssZ.
    Id string
    The provider-assigned unique ID for this managed resource.
    createTime String
    Creation time. UTC time, in the format of YYYY-MM-DDThh:mm:ssZ.
    id String
    The provider-assigned unique ID for this managed resource.
    createTime string
    Creation time. UTC time, in the format of YYYY-MM-DDThh:mm:ssZ.
    id string
    The provider-assigned unique ID for this managed resource.
    create_time str
    Creation time. UTC time, in the format of YYYY-MM-DDThh:mm:ssZ.
    id str
    The provider-assigned unique ID for this managed resource.
    createTime String
    Creation time. UTC time, in the format of YYYY-MM-DDThh:mm:ssZ.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing NatGateway Resource

    Get an existing NatGateway 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?: NatGatewayState, opts?: CustomResourceOptions): NatGateway
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            create_time: Optional[str] = None,
            ens_region_id: Optional[str] = None,
            instance_type: Optional[str] = None,
            nat_name: Optional[str] = None,
            network_id: Optional[str] = None,
            vswitch_id: Optional[str] = None) -> NatGateway
    func GetNatGateway(ctx *Context, name string, id IDInput, state *NatGatewayState, opts ...ResourceOption) (*NatGateway, error)
    public static NatGateway Get(string name, Input<string> id, NatGatewayState? state, CustomResourceOptions? opts = null)
    public static NatGateway get(String name, Output<String> id, NatGatewayState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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:
    CreateTime string
    Creation time. UTC time, in the format of YYYY-MM-DDThh:mm:ssZ.
    EnsRegionId string
    The ID of the ENS node.
    InstanceType string
    NAT specifications. Value: enat.default.
    NatName string
    The name of the NAT gateway. The length is 1 to 128 characters, but it cannot start with 'http:// 'or 'https.
    NetworkId string
    The network ID.
    VswitchId string
    The vSwitch ID.
    CreateTime string
    Creation time. UTC time, in the format of YYYY-MM-DDThh:mm:ssZ.
    EnsRegionId string
    The ID of the ENS node.
    InstanceType string
    NAT specifications. Value: enat.default.
    NatName string
    The name of the NAT gateway. The length is 1 to 128 characters, but it cannot start with 'http:// 'or 'https.
    NetworkId string
    The network ID.
    VswitchId string
    The vSwitch ID.
    createTime String
    Creation time. UTC time, in the format of YYYY-MM-DDThh:mm:ssZ.
    ensRegionId String
    The ID of the ENS node.
    instanceType String
    NAT specifications. Value: enat.default.
    natName String
    The name of the NAT gateway. The length is 1 to 128 characters, but it cannot start with 'http:// 'or 'https.
    networkId String
    The network ID.
    vswitchId String
    The vSwitch ID.
    createTime string
    Creation time. UTC time, in the format of YYYY-MM-DDThh:mm:ssZ.
    ensRegionId string
    The ID of the ENS node.
    instanceType string
    NAT specifications. Value: enat.default.
    natName string
    The name of the NAT gateway. The length is 1 to 128 characters, but it cannot start with 'http:// 'or 'https.
    networkId string
    The network ID.
    vswitchId string
    The vSwitch ID.
    create_time str
    Creation time. UTC time, in the format of YYYY-MM-DDThh:mm:ssZ.
    ens_region_id str
    The ID of the ENS node.
    instance_type str
    NAT specifications. Value: enat.default.
    nat_name str
    The name of the NAT gateway. The length is 1 to 128 characters, but it cannot start with 'http:// 'or 'https.
    network_id str
    The network ID.
    vswitch_id str
    The vSwitch ID.
    createTime String
    Creation time. UTC time, in the format of YYYY-MM-DDThh:mm:ssZ.
    ensRegionId String
    The ID of the ENS node.
    instanceType String
    NAT specifications. Value: enat.default.
    natName String
    The name of the NAT gateway. The length is 1 to 128 characters, but it cannot start with 'http:// 'or 'https.
    networkId String
    The network ID.
    vswitchId String
    The vSwitch ID.

    Import

    Ens Nat Gateway can be imported using the id, e.g.

    $ pulumi import alicloud:ens/natGateway:NatGateway example <id>
    

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

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi