alicloud.ens.LoadBalancer
Explore with Pulumi AI
Provides a ENS Load Balancer resource. Load balancing. When you use it for the first time, please contact the product classmates to add a resource whitelist.
For information about ENS Load Balancer and how to use it, see What is Load Balancer.
NOTE: Available since v1.213.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 network = new alicloud.ens.Network("network", {
    networkName: name,
    description: name,
    cidrBlock: "192.168.2.0/24",
    ensRegionId: "cn-chenzhou-telecom_unicom_cmcc",
});
const _switch = new alicloud.ens.Vswitch("switch", {
    description: name,
    cidrBlock: "192.168.2.0/24",
    vswitchName: name,
    ensRegionId: "cn-chenzhou-telecom_unicom_cmcc",
    networkId: network.id,
});
const _default = new alicloud.ens.LoadBalancer("default", {
    loadBalancerName: name,
    paymentType: "PayAsYouGo",
    ensRegionId: "cn-chenzhou-telecom_unicom_cmcc",
    loadBalancerSpec: "elb.s1.small",
    vswitchId: _switch.id,
    networkId: network.id,
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "terraform-example"
network = alicloud.ens.Network("network",
    network_name=name,
    description=name,
    cidr_block="192.168.2.0/24",
    ens_region_id="cn-chenzhou-telecom_unicom_cmcc")
switch = alicloud.ens.Vswitch("switch",
    description=name,
    cidr_block="192.168.2.0/24",
    vswitch_name=name,
    ens_region_id="cn-chenzhou-telecom_unicom_cmcc",
    network_id=network.id)
default = alicloud.ens.LoadBalancer("default",
    load_balancer_name=name,
    payment_type="PayAsYouGo",
    ens_region_id="cn-chenzhou-telecom_unicom_cmcc",
    load_balancer_spec="elb.s1.small",
    vswitch_id=switch.id,
    network_id=network.id)
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
		}
		network, err := ens.NewNetwork(ctx, "network", &ens.NetworkArgs{
			NetworkName: pulumi.String(name),
			Description: pulumi.String(name),
			CidrBlock:   pulumi.String("192.168.2.0/24"),
			EnsRegionId: pulumi.String("cn-chenzhou-telecom_unicom_cmcc"),
		})
		if err != nil {
			return err
		}
		_, err = ens.NewVswitch(ctx, "switch", &ens.VswitchArgs{
			Description: pulumi.String(name),
			CidrBlock:   pulumi.String("192.168.2.0/24"),
			VswitchName: pulumi.String(name),
			EnsRegionId: pulumi.String("cn-chenzhou-telecom_unicom_cmcc"),
			NetworkId:   network.ID(),
		})
		if err != nil {
			return err
		}
		_, err = ens.NewLoadBalancer(ctx, "default", &ens.LoadBalancerArgs{
			LoadBalancerName: pulumi.String(name),
			PaymentType:      pulumi.String("PayAsYouGo"),
			EnsRegionId:      pulumi.String("cn-chenzhou-telecom_unicom_cmcc"),
			LoadBalancerSpec: pulumi.String("elb.s1.small"),
			VswitchId:        _switch.ID(),
			NetworkId:        network.ID(),
		})
		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 network = new AliCloud.Ens.Network("network", new()
    {
        NetworkName = name,
        Description = name,
        CidrBlock = "192.168.2.0/24",
        EnsRegionId = "cn-chenzhou-telecom_unicom_cmcc",
    });
    var @switch = new AliCloud.Ens.Vswitch("switch", new()
    {
        Description = name,
        CidrBlock = "192.168.2.0/24",
        VswitchName = name,
        EnsRegionId = "cn-chenzhou-telecom_unicom_cmcc",
        NetworkId = network.Id,
    });
    var @default = new AliCloud.Ens.LoadBalancer("default", new()
    {
        LoadBalancerName = name,
        PaymentType = "PayAsYouGo",
        EnsRegionId = "cn-chenzhou-telecom_unicom_cmcc",
        LoadBalancerSpec = "elb.s1.small",
        VswitchId = @switch.Id,
        NetworkId = network.Id,
    });
});
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.LoadBalancer;
import com.pulumi.alicloud.ens.LoadBalancerArgs;
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");
        var network = new Network("network", NetworkArgs.builder()
            .networkName(name)
            .description(name)
            .cidrBlock("192.168.2.0/24")
            .ensRegionId("cn-chenzhou-telecom_unicom_cmcc")
            .build());
        var switch_ = new Vswitch("switch", VswitchArgs.builder()
            .description(name)
            .cidrBlock("192.168.2.0/24")
            .vswitchName(name)
            .ensRegionId("cn-chenzhou-telecom_unicom_cmcc")
            .networkId(network.id())
            .build());
        var default_ = new LoadBalancer("default", LoadBalancerArgs.builder()
            .loadBalancerName(name)
            .paymentType("PayAsYouGo")
            .ensRegionId("cn-chenzhou-telecom_unicom_cmcc")
            .loadBalancerSpec("elb.s1.small")
            .vswitchId(switch_.id())
            .networkId(network.id())
            .build());
    }
}
configuration:
  name:
    type: string
    default: terraform-example
resources:
  network:
    type: alicloud:ens:Network
    properties:
      networkName: ${name}
      description: ${name}
      cidrBlock: 192.168.2.0/24
      ensRegionId: cn-chenzhou-telecom_unicom_cmcc
  switch:
    type: alicloud:ens:Vswitch
    properties:
      description: ${name}
      cidrBlock: 192.168.2.0/24
      vswitchName: ${name}
      ensRegionId: cn-chenzhou-telecom_unicom_cmcc
      networkId: ${network.id}
  default:
    type: alicloud:ens:LoadBalancer
    properties:
      loadBalancerName: ${name}
      paymentType: PayAsYouGo
      ensRegionId: cn-chenzhou-telecom_unicom_cmcc
      loadBalancerSpec: elb.s1.small
      vswitchId: ${switch.id}
      networkId: ${network.id}
Create LoadBalancer Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new LoadBalancer(name: string, args: LoadBalancerArgs, opts?: CustomResourceOptions);@overload
def LoadBalancer(resource_name: str,
                 args: LoadBalancerArgs,
                 opts: Optional[ResourceOptions] = None)
@overload
def LoadBalancer(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 ens_region_id: Optional[str] = None,
                 load_balancer_spec: Optional[str] = None,
                 network_id: Optional[str] = None,
                 payment_type: Optional[str] = None,
                 vswitch_id: Optional[str] = None,
                 load_balancer_name: Optional[str] = None)func NewLoadBalancer(ctx *Context, name string, args LoadBalancerArgs, opts ...ResourceOption) (*LoadBalancer, error)public LoadBalancer(string name, LoadBalancerArgs args, CustomResourceOptions? opts = null)
public LoadBalancer(String name, LoadBalancerArgs args)
public LoadBalancer(String name, LoadBalancerArgs args, CustomResourceOptions options)
type: alicloud:ens:LoadBalancer
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 LoadBalancerArgs
- 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 LoadBalancerArgs
- 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 LoadBalancerArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args LoadBalancerArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args LoadBalancerArgs
- 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 alicloudLoadBalancerResource = new AliCloud.Ens.LoadBalancer("alicloudLoadBalancerResource", new()
{
    EnsRegionId = "string",
    LoadBalancerSpec = "string",
    NetworkId = "string",
    PaymentType = "string",
    VswitchId = "string",
    LoadBalancerName = "string",
});
example, err := ens.NewLoadBalancer(ctx, "alicloudLoadBalancerResource", &ens.LoadBalancerArgs{
	EnsRegionId:      pulumi.String("string"),
	LoadBalancerSpec: pulumi.String("string"),
	NetworkId:        pulumi.String("string"),
	PaymentType:      pulumi.String("string"),
	VswitchId:        pulumi.String("string"),
	LoadBalancerName: pulumi.String("string"),
})
var alicloudLoadBalancerResource = new LoadBalancer("alicloudLoadBalancerResource", LoadBalancerArgs.builder()
    .ensRegionId("string")
    .loadBalancerSpec("string")
    .networkId("string")
    .paymentType("string")
    .vswitchId("string")
    .loadBalancerName("string")
    .build());
alicloud_load_balancer_resource = alicloud.ens.LoadBalancer("alicloudLoadBalancerResource",
    ens_region_id="string",
    load_balancer_spec="string",
    network_id="string",
    payment_type="string",
    vswitch_id="string",
    load_balancer_name="string")
const alicloudLoadBalancerResource = new alicloud.ens.LoadBalancer("alicloudLoadBalancerResource", {
    ensRegionId: "string",
    loadBalancerSpec: "string",
    networkId: "string",
    paymentType: "string",
    vswitchId: "string",
    loadBalancerName: "string",
});
type: alicloud:ens:LoadBalancer
properties:
    ensRegionId: string
    loadBalancerName: string
    loadBalancerSpec: string
    networkId: string
    paymentType: string
    vswitchId: string
LoadBalancer 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 LoadBalancer resource accepts the following input properties:
- EnsRegion stringId 
- The ID of the ENS node.
- LoadBalancer stringSpec 
- Specifications of the Server Load Balancer instance. Valid values: elb.s1.small,elb.s3.medium,elb.s2.small,elb.s2.medium,elb.s3.small.
- NetworkId string
- The network ID of the created edge load balancing (ELB) instance.
- PaymentType string
- Server Load Balancer Instance Payment Type. Valid value: PayAsYouGo.
- VswitchId string
- The ID of the vSwitch to which the VPC instance belongs.
- LoadBalancer stringName 
- Name of the Server Load Balancer instanceRules:The length is 1~80 English or Chinese characters. When this parameter is not specified, the system randomly assigns an instance nameCannot start with http://andhttps.
- EnsRegion stringId 
- The ID of the ENS node.
- LoadBalancer stringSpec 
- Specifications of the Server Load Balancer instance. Valid values: elb.s1.small,elb.s3.medium,elb.s2.small,elb.s2.medium,elb.s3.small.
- NetworkId string
- The network ID of the created edge load balancing (ELB) instance.
- PaymentType string
- Server Load Balancer Instance Payment Type. Valid value: PayAsYouGo.
- VswitchId string
- The ID of the vSwitch to which the VPC instance belongs.
- LoadBalancer stringName 
- Name of the Server Load Balancer instanceRules:The length is 1~80 English or Chinese characters. When this parameter is not specified, the system randomly assigns an instance nameCannot start with http://andhttps.
- ensRegion StringId 
- The ID of the ENS node.
- loadBalancer StringSpec 
- Specifications of the Server Load Balancer instance. Valid values: elb.s1.small,elb.s3.medium,elb.s2.small,elb.s2.medium,elb.s3.small.
- networkId String
- The network ID of the created edge load balancing (ELB) instance.
- paymentType String
- Server Load Balancer Instance Payment Type. Valid value: PayAsYouGo.
- vswitchId String
- The ID of the vSwitch to which the VPC instance belongs.
- loadBalancer StringName 
- Name of the Server Load Balancer instanceRules:The length is 1~80 English or Chinese characters. When this parameter is not specified, the system randomly assigns an instance nameCannot start with http://andhttps.
- ensRegion stringId 
- The ID of the ENS node.
- loadBalancer stringSpec 
- Specifications of the Server Load Balancer instance. Valid values: elb.s1.small,elb.s3.medium,elb.s2.small,elb.s2.medium,elb.s3.small.
- networkId string
- The network ID of the created edge load balancing (ELB) instance.
- paymentType string
- Server Load Balancer Instance Payment Type. Valid value: PayAsYouGo.
- vswitchId string
- The ID of the vSwitch to which the VPC instance belongs.
- loadBalancer stringName 
- Name of the Server Load Balancer instanceRules:The length is 1~80 English or Chinese characters. When this parameter is not specified, the system randomly assigns an instance nameCannot start with http://andhttps.
- ens_region_ strid 
- The ID of the ENS node.
- load_balancer_ strspec 
- Specifications of the Server Load Balancer instance. Valid values: elb.s1.small,elb.s3.medium,elb.s2.small,elb.s2.medium,elb.s3.small.
- network_id str
- The network ID of the created edge load balancing (ELB) instance.
- payment_type str
- Server Load Balancer Instance Payment Type. Valid value: PayAsYouGo.
- vswitch_id str
- The ID of the vSwitch to which the VPC instance belongs.
- load_balancer_ strname 
- Name of the Server Load Balancer instanceRules:The length is 1~80 English or Chinese characters. When this parameter is not specified, the system randomly assigns an instance nameCannot start with http://andhttps.
- ensRegion StringId 
- The ID of the ENS node.
- loadBalancer StringSpec 
- Specifications of the Server Load Balancer instance. Valid values: elb.s1.small,elb.s3.medium,elb.s2.small,elb.s2.medium,elb.s3.small.
- networkId String
- The network ID of the created edge load balancing (ELB) instance.
- paymentType String
- Server Load Balancer Instance Payment Type. Valid value: PayAsYouGo.
- vswitchId String
- The ID of the vSwitch to which the VPC instance belongs.
- loadBalancer StringName 
- Name of the Server Load Balancer instanceRules:The length is 1~80 English or Chinese characters. When this parameter is not specified, the system randomly assigns an instance nameCannot start with http://andhttps.
Outputs
All input properties are implicitly available as output properties. Additionally, the LoadBalancer resource produces the following output properties:
- CreateTime string
- The creation Time (UTC) of the load balancing instance.
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- The status of the SLB instance.
- CreateTime string
- The creation Time (UTC) of the load balancing instance.
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- The status of the SLB instance.
- createTime String
- The creation Time (UTC) of the load balancing instance.
- id String
- The provider-assigned unique ID for this managed resource.
- status String
- The status of the SLB instance.
- createTime string
- The creation Time (UTC) of the load balancing instance.
- id string
- The provider-assigned unique ID for this managed resource.
- status string
- The status of the SLB instance.
- create_time str
- The creation Time (UTC) of the load balancing instance.
- id str
- The provider-assigned unique ID for this managed resource.
- status str
- The status of the SLB instance.
- createTime String
- The creation Time (UTC) of the load balancing instance.
- id String
- The provider-assigned unique ID for this managed resource.
- status String
- The status of the SLB instance.
Look up Existing LoadBalancer Resource
Get an existing LoadBalancer 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?: LoadBalancerState, opts?: CustomResourceOptions): LoadBalancer@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        create_time: Optional[str] = None,
        ens_region_id: Optional[str] = None,
        load_balancer_name: Optional[str] = None,
        load_balancer_spec: Optional[str] = None,
        network_id: Optional[str] = None,
        payment_type: Optional[str] = None,
        status: Optional[str] = None,
        vswitch_id: Optional[str] = None) -> LoadBalancerfunc GetLoadBalancer(ctx *Context, name string, id IDInput, state *LoadBalancerState, opts ...ResourceOption) (*LoadBalancer, error)public static LoadBalancer Get(string name, Input<string> id, LoadBalancerState? state, CustomResourceOptions? opts = null)public static LoadBalancer get(String name, Output<String> id, LoadBalancerState 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.
- CreateTime string
- The creation Time (UTC) of the load balancing instance.
- EnsRegion stringId 
- The ID of the ENS node.
- LoadBalancer stringName 
- Name of the Server Load Balancer instanceRules:The length is 1~80 English or Chinese characters. When this parameter is not specified, the system randomly assigns an instance nameCannot start with http://andhttps.
- LoadBalancer stringSpec 
- Specifications of the Server Load Balancer instance. Valid values: elb.s1.small,elb.s3.medium,elb.s2.small,elb.s2.medium,elb.s3.small.
- NetworkId string
- The network ID of the created edge load balancing (ELB) instance.
- PaymentType string
- Server Load Balancer Instance Payment Type. Valid value: PayAsYouGo.
- Status string
- The status of the SLB instance.
- VswitchId string
- The ID of the vSwitch to which the VPC instance belongs.
- CreateTime string
- The creation Time (UTC) of the load balancing instance.
- EnsRegion stringId 
- The ID of the ENS node.
- LoadBalancer stringName 
- Name of the Server Load Balancer instanceRules:The length is 1~80 English or Chinese characters. When this parameter is not specified, the system randomly assigns an instance nameCannot start with http://andhttps.
- LoadBalancer stringSpec 
- Specifications of the Server Load Balancer instance. Valid values: elb.s1.small,elb.s3.medium,elb.s2.small,elb.s2.medium,elb.s3.small.
- NetworkId string
- The network ID of the created edge load balancing (ELB) instance.
- PaymentType string
- Server Load Balancer Instance Payment Type. Valid value: PayAsYouGo.
- Status string
- The status of the SLB instance.
- VswitchId string
- The ID of the vSwitch to which the VPC instance belongs.
- createTime String
- The creation Time (UTC) of the load balancing instance.
- ensRegion StringId 
- The ID of the ENS node.
- loadBalancer StringName 
- Name of the Server Load Balancer instanceRules:The length is 1~80 English or Chinese characters. When this parameter is not specified, the system randomly assigns an instance nameCannot start with http://andhttps.
- loadBalancer StringSpec 
- Specifications of the Server Load Balancer instance. Valid values: elb.s1.small,elb.s3.medium,elb.s2.small,elb.s2.medium,elb.s3.small.
- networkId String
- The network ID of the created edge load balancing (ELB) instance.
- paymentType String
- Server Load Balancer Instance Payment Type. Valid value: PayAsYouGo.
- status String
- The status of the SLB instance.
- vswitchId String
- The ID of the vSwitch to which the VPC instance belongs.
- createTime string
- The creation Time (UTC) of the load balancing instance.
- ensRegion stringId 
- The ID of the ENS node.
- loadBalancer stringName 
- Name of the Server Load Balancer instanceRules:The length is 1~80 English or Chinese characters. When this parameter is not specified, the system randomly assigns an instance nameCannot start with http://andhttps.
- loadBalancer stringSpec 
- Specifications of the Server Load Balancer instance. Valid values: elb.s1.small,elb.s3.medium,elb.s2.small,elb.s2.medium,elb.s3.small.
- networkId string
- The network ID of the created edge load balancing (ELB) instance.
- paymentType string
- Server Load Balancer Instance Payment Type. Valid value: PayAsYouGo.
- status string
- The status of the SLB instance.
- vswitchId string
- The ID of the vSwitch to which the VPC instance belongs.
- create_time str
- The creation Time (UTC) of the load balancing instance.
- ens_region_ strid 
- The ID of the ENS node.
- load_balancer_ strname 
- Name of the Server Load Balancer instanceRules:The length is 1~80 English or Chinese characters. When this parameter is not specified, the system randomly assigns an instance nameCannot start with http://andhttps.
- load_balancer_ strspec 
- Specifications of the Server Load Balancer instance. Valid values: elb.s1.small,elb.s3.medium,elb.s2.small,elb.s2.medium,elb.s3.small.
- network_id str
- The network ID of the created edge load balancing (ELB) instance.
- payment_type str
- Server Load Balancer Instance Payment Type. Valid value: PayAsYouGo.
- status str
- The status of the SLB instance.
- vswitch_id str
- The ID of the vSwitch to which the VPC instance belongs.
- createTime String
- The creation Time (UTC) of the load balancing instance.
- ensRegion StringId 
- The ID of the ENS node.
- loadBalancer StringName 
- Name of the Server Load Balancer instanceRules:The length is 1~80 English or Chinese characters. When this parameter is not specified, the system randomly assigns an instance nameCannot start with http://andhttps.
- loadBalancer StringSpec 
- Specifications of the Server Load Balancer instance. Valid values: elb.s1.small,elb.s3.medium,elb.s2.small,elb.s2.medium,elb.s3.small.
- networkId String
- The network ID of the created edge load balancing (ELB) instance.
- paymentType String
- Server Load Balancer Instance Payment Type. Valid value: PayAsYouGo.
- status String
- The status of the SLB instance.
- vswitchId String
- The ID of the vSwitch to which the VPC instance belongs.
Import
ENS Load Balancer can be imported using the id, e.g.
$ pulumi import alicloud:ens/loadBalancer:LoadBalancer 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 alicloudTerraform Provider.