Alibaba Cloud

Pulumi Official
Package maintained by Pulumi
v3.28.0 published on Tuesday, Aug 16, 2022 by Pulumi

BandwidthLimit

Provides a CEN cross-regional interconnection bandwidth resource. To connect networks in different regions, you must set cross-region interconnection bandwidth after buying a bandwidth package. The total bandwidth set for all the interconnected regions of a bandwidth package cannot exceed the bandwidth of the bandwidth package. By default, 1 Kbps bandwidth is provided for connectivity test. To run normal business, you must buy a bandwidth package and set a proper interconnection bandwidth.

For example, a CEN instance is bound to a bandwidth package of 20 Mbps and the interconnection areas are Mainland China and North America. You can set the cross-region interconnection bandwidth between US West 1 and China East 1, China East 2, China South 1, and so on. However, the total bandwidth set for all the interconnected regions cannot exceed 20 Mbps.

For information about CEN and how to use it, see Cross-region interconnection bandwidth

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf-testAccCenBandwidthLimitConfig";
        var fra = new AliCloud.Provider("fra", new AliCloud.ProviderArgs
        {
            Region = "eu-central-1",
        });
        var sh = new AliCloud.Provider("sh", new AliCloud.ProviderArgs
        {
            Region = "cn-shanghai",
        });
        var vpc1 = new AliCloud.Vpc.Network("vpc1", new AliCloud.Vpc.NetworkArgs
        {
            VpcName = name,
            CidrBlock = "192.168.0.0/16",
        }, new CustomResourceOptions
        {
            Provider = alicloud.Fra,
        });
        var vpc2 = new AliCloud.Vpc.Network("vpc2", new AliCloud.Vpc.NetworkArgs
        {
            CidrBlock = "172.16.0.0/12",
        }, new CustomResourceOptions
        {
            Provider = alicloud.Sh,
        });
        var cen = new AliCloud.Cen.Instance("cen", new AliCloud.Cen.InstanceArgs
        {
            Description = "tf-testAccCenBandwidthLimitConfigDescription",
        });
        var bwp = new AliCloud.Cen.BandwidthPackage("bwp", new AliCloud.Cen.BandwidthPackageArgs
        {
            Bandwidth = 5,
            GeographicRegionIds = 
            {
                "Europe",
                "China",
            },
        });
        var bwpAttach = new AliCloud.Cen.BandwidthPackageAttachment("bwpAttach", new AliCloud.Cen.BandwidthPackageAttachmentArgs
        {
            InstanceId = cen.Id,
            BandwidthPackageId = bwp.Id,
        });
        var vpcAttach1 = new AliCloud.Cen.InstanceAttachment("vpcAttach1", new AliCloud.Cen.InstanceAttachmentArgs
        {
            InstanceId = cen.Id,
            ChildInstanceId = vpc1.Id,
            ChildInstanceType = "VPC",
            ChildInstanceRegionId = "eu-central-1",
        });
        var vpcAttach2 = new AliCloud.Cen.InstanceAttachment("vpcAttach2", new AliCloud.Cen.InstanceAttachmentArgs
        {
            InstanceId = cen.Id,
            ChildInstanceId = vpc2.Id,
            ChildInstanceType = "VPC",
            ChildInstanceRegionId = "cn-shanghai",
        });
        var foo = new AliCloud.Cen.BandwidthLimit("foo", new AliCloud.Cen.BandwidthLimitArgs
        {
            InstanceId = cen.Id,
            RegionIds = 
            {
                "eu-central-1",
                "cn-shanghai",
            },
            Limit = 4,
        }, new CustomResourceOptions
        {
            DependsOn = 
            {
                bwpAttach,
                vpcAttach1,
                vpcAttach2,
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cen"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/providers"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
	"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 := "tf-testAccCenBandwidthLimitConfig"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		_, err := providers.Newalicloud(ctx, "fra", &providers.alicloudArgs{
			Region: "eu-central-1",
		})
		if err != nil {
			return err
		}
		_, err = providers.Newalicloud(ctx, "sh", &providers.alicloudArgs{
			Region: "cn-shanghai",
		})
		if err != nil {
			return err
		}
		vpc1, err := vpc.NewNetwork(ctx, "vpc1", &vpc.NetworkArgs{
			VpcName:   pulumi.String(name),
			CidrBlock: pulumi.String("192.168.0.0/16"),
		}, pulumi.Provider(alicloud.Fra))
		if err != nil {
			return err
		}
		vpc2, err := vpc.NewNetwork(ctx, "vpc2", &vpc.NetworkArgs{
			CidrBlock: pulumi.String("172.16.0.0/12"),
		}, pulumi.Provider(alicloud.Sh))
		if err != nil {
			return err
		}
		cen, err := cen.NewInstance(ctx, "cen", &cen.InstanceArgs{
			Description: pulumi.String("tf-testAccCenBandwidthLimitConfigDescription"),
		})
		if err != nil {
			return err
		}
		bwp, err := cen.NewBandwidthPackage(ctx, "bwp", &cen.BandwidthPackageArgs{
			Bandwidth: pulumi.Int(5),
			GeographicRegionIds: pulumi.StringArray{
				pulumi.String("Europe"),
				pulumi.String("China"),
			},
		})
		if err != nil {
			return err
		}
		bwpAttach, err := cen.NewBandwidthPackageAttachment(ctx, "bwpAttach", &cen.BandwidthPackageAttachmentArgs{
			InstanceId:         cen.ID(),
			BandwidthPackageId: bwp.ID(),
		})
		if err != nil {
			return err
		}
		vpcAttach1, err := cen.NewInstanceAttachment(ctx, "vpcAttach1", &cen.InstanceAttachmentArgs{
			InstanceId:            cen.ID(),
			ChildInstanceId:       vpc1.ID(),
			ChildInstanceType:     pulumi.String("VPC"),
			ChildInstanceRegionId: pulumi.String("eu-central-1"),
		})
		if err != nil {
			return err
		}
		vpcAttach2, err := cen.NewInstanceAttachment(ctx, "vpcAttach2", &cen.InstanceAttachmentArgs{
			InstanceId:            cen.ID(),
			ChildInstanceId:       vpc2.ID(),
			ChildInstanceType:     pulumi.String("VPC"),
			ChildInstanceRegionId: pulumi.String("cn-shanghai"),
		})
		if err != nil {
			return err
		}
		_, err = cen.NewBandwidthLimit(ctx, "foo", &cen.BandwidthLimitArgs{
			InstanceId: cen.ID(),
			RegionIds: pulumi.StringArray{
				pulumi.String("eu-central-1"),
				pulumi.String("cn-shanghai"),
			},
			BandwidthLimit: pulumi.Int(4),
		}, pulumi.DependsOn([]pulumi.Resource{
			bwpAttach,
			vpcAttach1,
			vpcAttach2,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.pulumi.providers.alicloud;
import com.pulumi.pulumi.providers.ProviderArgs;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.cen.Instance;
import com.pulumi.alicloud.cen.InstanceArgs;
import com.pulumi.alicloud.cen.BandwidthPackage;
import com.pulumi.alicloud.cen.BandwidthPackageArgs;
import com.pulumi.alicloud.cen.BandwidthPackageAttachment;
import com.pulumi.alicloud.cen.BandwidthPackageAttachmentArgs;
import com.pulumi.alicloud.cen.InstanceAttachment;
import com.pulumi.alicloud.cen.InstanceAttachmentArgs;
import com.pulumi.alicloud.cen.BandwidthLimit;
import com.pulumi.alicloud.cen.BandwidthLimitArgs;
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 config = ctx.config();
        final var name = config.get("name").orElse("tf-testAccCenBandwidthLimitConfig");
        var fra = new Provider("fra", ProviderArgs.builder()        
            .region("eu-central-1")
            .build());

        var sh = new Provider("sh", ProviderArgs.builder()        
            .region("cn-shanghai")
            .build());

        var vpc1 = new Network("vpc1", NetworkArgs.builder()        
            .vpcName(name)
            .cidrBlock("192.168.0.0/16")
            .build(), CustomResourceOptions.builder()
                .provider(alicloud.fra())
                .build());

        var vpc2 = new Network("vpc2", NetworkArgs.builder()        
            .cidrBlock("172.16.0.0/12")
            .build(), CustomResourceOptions.builder()
                .provider(alicloud.sh())
                .build());

        var cen = new Instance("cen", InstanceArgs.builder()        
            .description("tf-testAccCenBandwidthLimitConfigDescription")
            .build());

        var bwp = new BandwidthPackage("bwp", BandwidthPackageArgs.builder()        
            .bandwidth(5)
            .geographicRegionIds(            
                "Europe",
                "China")
            .build());

        var bwpAttach = new BandwidthPackageAttachment("bwpAttach", BandwidthPackageAttachmentArgs.builder()        
            .instanceId(cen.id())
            .bandwidthPackageId(bwp.id())
            .build());

        var vpcAttach1 = new InstanceAttachment("vpcAttach1", InstanceAttachmentArgs.builder()        
            .instanceId(cen.id())
            .childInstanceId(vpc1.id())
            .childInstanceType("VPC")
            .childInstanceRegionId("eu-central-1")
            .build());

        var vpcAttach2 = new InstanceAttachment("vpcAttach2", InstanceAttachmentArgs.builder()        
            .instanceId(cen.id())
            .childInstanceId(vpc2.id())
            .childInstanceType("VPC")
            .childInstanceRegionId("cn-shanghai")
            .build());

        var foo = new BandwidthLimit("foo", BandwidthLimitArgs.builder()        
            .instanceId(cen.id())
            .regionIds(            
                "eu-central-1",
                "cn-shanghai")
            .bandwidthLimit(4)
            .build(), CustomResourceOptions.builder()
                .dependsOn(                
                    bwpAttach,
                    vpcAttach1,
                    vpcAttach2)
                .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud
import pulumi_pulumi as pulumi

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "tf-testAccCenBandwidthLimitConfig"
fra = pulumi.providers.Alicloud("fra", region="eu-central-1")
sh = pulumi.providers.Alicloud("sh", region="cn-shanghai")
vpc1 = alicloud.vpc.Network("vpc1",
    vpc_name=name,
    cidr_block="192.168.0.0/16",
    opts=pulumi.ResourceOptions(provider=alicloud["fra"]))
vpc2 = alicloud.vpc.Network("vpc2", cidr_block="172.16.0.0/12",
opts=pulumi.ResourceOptions(provider=alicloud["sh"]))
cen = alicloud.cen.Instance("cen", description="tf-testAccCenBandwidthLimitConfigDescription")
bwp = alicloud.cen.BandwidthPackage("bwp",
    bandwidth=5,
    geographic_region_ids=[
        "Europe",
        "China",
    ])
bwp_attach = alicloud.cen.BandwidthPackageAttachment("bwpAttach",
    instance_id=cen.id,
    bandwidth_package_id=bwp.id)
vpc_attach1 = alicloud.cen.InstanceAttachment("vpcAttach1",
    instance_id=cen.id,
    child_instance_id=vpc1.id,
    child_instance_type="VPC",
    child_instance_region_id="eu-central-1")
vpc_attach2 = alicloud.cen.InstanceAttachment("vpcAttach2",
    instance_id=cen.id,
    child_instance_id=vpc2.id,
    child_instance_type="VPC",
    child_instance_region_id="cn-shanghai")
foo = alicloud.cen.BandwidthLimit("foo",
    instance_id=cen.id,
    region_ids=[
        "eu-central-1",
        "cn-shanghai",
    ],
    bandwidth_limit=4,
    opts=pulumi.ResourceOptions(depends_on=[
            bwp_attach,
            vpc_attach1,
            vpc_attach2,
        ]))
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const name = config.get("name") || "tf-testAccCenBandwidthLimitConfig";
const fra = new alicloud.Provider("fra", {region: "eu-central-1"});
const sh = new alicloud.Provider("sh", {region: "cn-shanghai"});
const vpc1 = new alicloud.vpc.Network("vpc1", {
    vpcName: name,
    cidrBlock: "192.168.0.0/16",
}, {
    provider: alicloud.fra,
});
const vpc2 = new alicloud.vpc.Network("vpc2", {cidrBlock: "172.16.0.0/12"}, {
    provider: alicloud.sh,
});
const cen = new alicloud.cen.Instance("cen", {description: "tf-testAccCenBandwidthLimitConfigDescription"});
const bwp = new alicloud.cen.BandwidthPackage("bwp", {
    bandwidth: 5,
    geographicRegionIds: [
        "Europe",
        "China",
    ],
});
const bwpAttach = new alicloud.cen.BandwidthPackageAttachment("bwpAttach", {
    instanceId: cen.id,
    bandwidthPackageId: bwp.id,
});
const vpcAttach1 = new alicloud.cen.InstanceAttachment("vpcAttach1", {
    instanceId: cen.id,
    childInstanceId: vpc1.id,
    childInstanceType: "VPC",
    childInstanceRegionId: "eu-central-1",
});
const vpcAttach2 = new alicloud.cen.InstanceAttachment("vpcAttach2", {
    instanceId: cen.id,
    childInstanceId: vpc2.id,
    childInstanceType: "VPC",
    childInstanceRegionId: "cn-shanghai",
});
const foo = new alicloud.cen.BandwidthLimit("foo", {
    instanceId: cen.id,
    regionIds: [
        "eu-central-1",
        "cn-shanghai",
    ],
    bandwidthLimit: 4,
}, {
    dependsOn: [
        bwpAttach,
        vpcAttach1,
        vpcAttach2,
    ],
});
configuration:
  name:
    type: string
    default: tf-testAccCenBandwidthLimitConfig
resources:
  fra:
    type: pulumi:providers:alicloud
    properties:
      region: eu-central-1
  sh:
    type: pulumi:providers:alicloud
    properties:
      region: cn-shanghai
  vpc1:
    type: alicloud:vpc:Network
    properties:
      vpcName: ${name}
      cidrBlock: 192.168.0.0/16
    options:
      provider: ${alicloud.fra}
  vpc2:
    type: alicloud:vpc:Network
    properties:
      cidrBlock: 172.16.0.0/12
    options:
      provider: ${alicloud.sh}
  cen:
    type: alicloud:cen:Instance
    properties:
      description: tf-testAccCenBandwidthLimitConfigDescription
  bwp:
    type: alicloud:cen:BandwidthPackage
    properties:
      bandwidth: 5
      geographicRegionIds:
        - Europe
        - China
  bwpAttach:
    type: alicloud:cen:BandwidthPackageAttachment
    properties:
      instanceId: ${cen.id}
      bandwidthPackageId: ${bwp.id}
  vpcAttach1:
    type: alicloud:cen:InstanceAttachment
    properties:
      instanceId: ${cen.id}
      childInstanceId: ${vpc1.id}
      childInstanceType: VPC
      childInstanceRegionId: eu-central-1
  vpcAttach2:
    type: alicloud:cen:InstanceAttachment
    properties:
      instanceId: ${cen.id}
      childInstanceId: ${vpc2.id}
      childInstanceType: VPC
      childInstanceRegionId: cn-shanghai
  foo:
    type: alicloud:cen:BandwidthLimit
    properties:
      instanceId: ${cen.id}
      regionIds:
        - eu-central-1
        - cn-shanghai
      bandwidthLimit: 4
    options:
      dependson:
        - ${bwpAttach}
        - ${vpcAttach1}
        - ${vpcAttach2}

Create a BandwidthLimit Resource

new BandwidthLimit(name: string, args: BandwidthLimitArgs, opts?: CustomResourceOptions);
@overload
def BandwidthLimit(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   bandwidth_limit: Optional[int] = None,
                   instance_id: Optional[str] = None,
                   region_ids: Optional[Sequence[str]] = None)
@overload
def BandwidthLimit(resource_name: str,
                   args: BandwidthLimitArgs,
                   opts: Optional[ResourceOptions] = None)
func NewBandwidthLimit(ctx *Context, name string, args BandwidthLimitArgs, opts ...ResourceOption) (*BandwidthLimit, error)
public BandwidthLimit(string name, BandwidthLimitArgs args, CustomResourceOptions? opts = null)
public BandwidthLimit(String name, BandwidthLimitArgs args)
public BandwidthLimit(String name, BandwidthLimitArgs args, CustomResourceOptions options)
type: alicloud:cen:BandwidthLimit
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args BandwidthLimitArgs
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 BandwidthLimitArgs
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 BandwidthLimitArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args BandwidthLimitArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args BandwidthLimitArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

BandwidthLimit 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 BandwidthLimit resource accepts the following input properties:

InstanceId string

The ID of the CEN.

Limit int

The bandwidth configured for the interconnected regions communication.

RegionIds List<string>

List of the two regions to interconnect. Must be two different regions.

BandwidthLimit int

The bandwidth configured for the interconnected regions communication.

InstanceId string

The ID of the CEN.

RegionIds []string

List of the two regions to interconnect. Must be two different regions.

bandwidthLimit Integer

The bandwidth configured for the interconnected regions communication.

instanceId String

The ID of the CEN.

regionIds List<String>

List of the two regions to interconnect. Must be two different regions.

bandwidthLimit number

The bandwidth configured for the interconnected regions communication.

instanceId string

The ID of the CEN.

regionIds string[]

List of the two regions to interconnect. Must be two different regions.

bandwidth_limit int

The bandwidth configured for the interconnected regions communication.

instance_id str

The ID of the CEN.

region_ids Sequence[str]

List of the two regions to interconnect. Must be two different regions.

bandwidthLimit Number

The bandwidth configured for the interconnected regions communication.

instanceId String

The ID of the CEN.

regionIds List<String>

List of the two regions to interconnect. Must be two different regions.

Outputs

All input properties are implicitly available as output properties. Additionally, the BandwidthLimit 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 an Existing BandwidthLimit Resource

Get an existing BandwidthLimit 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?: BandwidthLimitState, opts?: CustomResourceOptions): BandwidthLimit
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        bandwidth_limit: Optional[int] = None,
        instance_id: Optional[str] = None,
        region_ids: Optional[Sequence[str]] = None) -> BandwidthLimit
func GetBandwidthLimit(ctx *Context, name string, id IDInput, state *BandwidthLimitState, opts ...ResourceOption) (*BandwidthLimit, error)
public static BandwidthLimit Get(string name, Input<string> id, BandwidthLimitState? state, CustomResourceOptions? opts = null)
public static BandwidthLimit get(String name, Output<String> id, BandwidthLimitState 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:
InstanceId string

The ID of the CEN.

Limit int

The bandwidth configured for the interconnected regions communication.

RegionIds List<string>

List of the two regions to interconnect. Must be two different regions.

BandwidthLimit int

The bandwidth configured for the interconnected regions communication.

InstanceId string

The ID of the CEN.

RegionIds []string

List of the two regions to interconnect. Must be two different regions.

bandwidthLimit Integer

The bandwidth configured for the interconnected regions communication.

instanceId String

The ID of the CEN.

regionIds List<String>

List of the two regions to interconnect. Must be two different regions.

bandwidthLimit number

The bandwidth configured for the interconnected regions communication.

instanceId string

The ID of the CEN.

regionIds string[]

List of the two regions to interconnect. Must be two different regions.

bandwidth_limit int

The bandwidth configured for the interconnected regions communication.

instance_id str

The ID of the CEN.

region_ids Sequence[str]

List of the two regions to interconnect. Must be two different regions.

bandwidthLimit Number

The bandwidth configured for the interconnected regions communication.

instanceId String

The ID of the CEN.

regionIds List<String>

List of the two regions to interconnect. Must be two different regions.

Import

CEN bandwidth limit can be imported using the id, e.g.

 $ pulumi import alicloud:cen/bandwidthLimit:BandwidthLimit example cen-abc123456:cn-beijing:eu-west-1

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.