All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::NLB::LoadBalancer

Last Updated:Mar 07, 2024

ALIYUN::NLB::LoadBalancer is used to create a Network Load Balancer (NLB) instance.

Syntax

{
  "Type": "ALIYUN::NLB::LoadBalancer",
  "Properties": {
    "LoadBalancerName": String,
    "AddressIpVersion": String,
    "ResourceGroupId": String,
    "VpcId": String,
    "LoadBalancerBillingConfig": Map,
    "TrafficAffinityEnabled": Boolean,
    "BandwidthPackageId": String,
    "AddressType": String,
    "ZoneMappings": List,
    "CrossZoneEnabled": Boolean,
    "LoadBalancerType": String,
    "DeletionProtectionConfig": Map,
    "ModificationProtectionConfig": Map,
    "Tags": List
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

LoadBalancerName

String

No

Yes

The name of the NLB instance.

None

AddressIpVersion

String

No

No

The IP version of the NLB instance.

Valid values:

  • Ipv4

  • DualStack

ResourceGroupId

String

No

No

The ID of the resource group.

None

VpcId

String

Yes

No

The ID of the virtual private cloud (VPC) to which the NLB instance belongs.

None

LoadBalancerBillingConfig

Map

No

No

The billing configurations of the NLB instance.

For more information, see LoadBalancerBillingConfig property.

TrafficAffinityEnabled

Boolean

No

Yes

Specifies whether to enable traffic affinity.

Valid values:

  • true

  • false

BandwidthPackageId

String

No

Yes

The ID of the EIP bandwidth plan of the Internet-facing NLB instance.

None

AddressType

String

Yes

Yes

The type of the IPv4 address of the NLB instance.

Valid values:

  • Internet: The NLB instance uses a public IP address. The domain name of the NLB instance is resolved to the public IP address. Therefore, the NLB instance can be accessed over the Internet.

  • Intranet: The NLB instance uses a private IP address. The domain name of the NLB instance is resolved to the private IP address. Therefore, the NLB instance can be accessed over the VPC in which the NLB instance is deployed.

ZoneMappings

List

Yes

No

The mappings between zones and vSwitches.

For more information, see ZoneMappings properties.

CrossZoneEnabled

Boolean

No

Yes

Specifies whether to enable cross-zone load balancing.

Valid values:

  • true

  • false

LoadBalancerType

String

No

No

The type of the NLB instance.

None

DeletionProtectionConfig

Map

No

Yes

The configuration of deletion protection.

For more information, see DeletionProtectionConfig properties.

ModificationProtectionConfig

Map

No

Yes

The configuration of deletion protection.

For more information, see ModificationProtectionConfig properties.

Tags

List

No

Yes

The tags.

For more information, see Tags properties.

LoadBalancerBillingConfig syntax

"LoadBalancerBillingConfig": {
  "PayType": String
}

LoadBalancerBillingConfig property

Property

Type

Required

Editable

Description

Constraint

PayType

String

No

No

The billing method of the NLB instance.

Valid values:

  • PayAsYouGo

  • PostPaid

  • PayOnDemand

  • Postpaid

  • PostPay

ZoneMappings syntax

"ZoneMappings": [
  {
    "ZoneId": String,
    "VSwitchId": String,
    "AllocationId": String,
    "PrivateIPv4Address": String,
    "LoadBalancerAddresses": List
  }
]

ZoneMappings properties

Property

Type

Required

Editable

Description

Constraint

ZoneId

String

Yes

No

The zone ID of the NLB instance.

You can call the DescribeZones operation to query the zones of the NLB instance.

VSwitchId

String

Yes

No

The vSwitch of the zone.

You can use only one vSwitch in each zone.

AllocationId

String

No

No

The EIP ID.

None

PrivateIPv4Address

String

No

No

The IPv4 address.

None

LoadBalancerAddresses

List

No

No

The endpoints of the NLB instances.  

This property takes precedence over AllocationId and EipType in the "ZoneMappings" section. For more information, see LoadBalancerAddresses properties.

EipType

String

No

No

The EIP type.

Valid values:

  • Common: EIP

  • Anycast: Anycast EIP

Note

For information about the regions in which you can associate Anycast EIPs with NLB instances, see Associate Anycast EIPs with an ALB instance to enable access through the nearest access point.

LoadBalancerAddresses syntax

"LoadBalancerAddresses": {
  "AllocationId": String,
  "PrivateIPv4Address": String
}

LoadBalancerAddresses properties

Property

Type

Required

Editable

Description

Constraint

AllocationId

String

Yes

No

The EIP ID.

None

PrivateIPv4Address

String

No

No

The IPv4 address.

None

DeletionProtectionConfig syntax

"DeletionProtectionConfig": {
  "Enabled": String,
  "Reason": String
}

DeletionProtectionConfig properties

Property

Type

Required

Editable

Description

Constraint

Enabled

String

Yes

Yes

Specifies whether to enable deletion protection.

Valid values:

  • true

  • false (default)

Reason

String

No

Yes

The reason why deletion protection is enabled or disabled.

The value must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The value must start with a letter.

ModificationProtectionConfig syntax

"ModificationProtectionConfig": {
  "Reason": String,
  "Status": String
}

ModificationProtectionConfig properties

Property

Type

Required

Editable

Description

Constraint

Reason

String

No

Yes

The reason why deletion protection is enabled.

The value must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The value must start with a letter.

Note

This property takes effect only if Status is set to ConsoleProtection.

Status

String

Yes

Yes

Specifies whether deletion protection is enabled.

Valid values:

  • NonProtection: Deletion protection is disabled. In this case, you cannot pass the reason for enabling the configuration read-only mode. You must clear the setting of the Reason property.

  • ConsoleProtection: Deletion protection is enabled. In this case, you can pass the reason for enabling the configuration read-only mode.

Note

If you set this property to ConsoleProtection, you cannot modify instance configurations in the NLB console. However, you can modify instance configurations by calling API operations.

Tags syntax

"Tags": {
  "Key": String,
  "Value": String
}

Tags properties

Property

Type

Required

Editable

Description

Constraint

Key

String

Yes

No

The tag key.

The tag key can be up to 128 characters in length and cannot contain http:// or https://. It cannot start with acs: or aliyun.

You can add up to 20 tags in each call.

Value

String

No

No

The tag value.

The tag value can be up to 128 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://.

You can add up to 20 tags in each call.

Return values

Fn::GetAtt

  • AddressIpVersion: the IP version of the NLB instance.

  • VpcId: the ID of the VPC to which the NLB instance belongs.

  • LoadBalancerId: the ID of the NLB instance.

  • AddressType: the type of the IPv4 address that is used by the NLB instance.

  • DNSName: the domain name of the NLB instance.

  • ZoneMappings: the mappings between zones and vSwitches.

  • LoadBalancerType: the type of the NLB instance.

Examples

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  VpcId:
    Type: String
    Description: The ID of the virtual private cloud (VPC) where the NLB instance is deployed.
  AddressType:
    Type: String
    Description: |-
      The type of IP address that the NLB instance uses to provide services. Valid values:
      Internet: The NLB instance uses a public IP address. The domain name of the NLB instance is resolved to the public IP address. Therefore, the NLB instance can be accessed over the Internet.
      Intranet: The NLB instance uses a private IP address. The domain name of the NLB instance is resolved to the private IP address. Therefore, the NLB instance can be accessed over the VPC where the NLB instance is deployed.
    AllowedValues:
      - Internet
      - Intranet
  ZoneMappings:
    Type: Json
    Description: The zones and the vSwitches in the zones. You must specify at least two zones.
    MinLength: 2
    MaxLength: 3
Resources:
  LoadBalancer:
    Type: ALIYUN::NLB::LoadBalancer
    Properties:
      VpcId:
        Ref: VpcId
      AddressType:
        Ref: AddressType
      ZoneMappings:
        Ref: ZoneMappings
Outputs:
  AddressIpVersion:
    Description: The version of IP address that the NLB instance uses to provide services.
    Value:
      Fn::GetAtt:
        - LoadBalancer
        - AddressIpVersion
  VpcId:
    Description: The ID of the virtual private cloud (VPC) where the NLB instance is deployed.
    Value:
      Fn::GetAtt:
        - LoadBalancer
        - VpcId
  LoadBalancerId:
    Description: The ID of the NLB instance.
    Value:
      Fn::GetAtt:
        - LoadBalancer
        - LoadBalancerId
  AddressType:
    Description: The type of IP address that the NLB instance uses to provide services.
    Value:
      Fn::GetAtt:
        - LoadBalancer
        - AddressType
  DNSName:
    Description: The domain name of the NLB instance.
    Value:
      Fn::GetAtt:
        - LoadBalancer
        - DNSName
  ZoneMappings:
    Description: The zones, vSwitches and addresses which are mapped to the zones.
    Value:
      Fn::GetAtt:
        - LoadBalancer
        - ZoneMappings
  LoadBalancerType:
    Description: The type of the NLB instance.
    Value:
      Fn::GetAtt:
        - LoadBalancer
        - LoadBalancerType

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "VpcId": {
      "Type": "String",
      "Description": "The ID of the virtual private cloud (VPC) where the NLB instance is deployed."
    },
    "AddressType": {
      "Type": "String",
      "Description": "The type of IP address that the NLB instance uses to provide services. Valid values:\nInternet: The NLB instance uses a public IP address. The domain name of the NLB instance is resolved to the public IP address. Therefore, the NLB instance can be accessed over the Internet.\nIntranet: The NLB instance uses a private IP address. The domain name of the NLB instance is resolved to the private IP address. Therefore, the NLB instance can be accessed over the VPC where the NLB instance is deployed.",
      "AllowedValues": [
        "Internet",
        "Intranet"
      ]
    },
    "ZoneMappings": {
      "Type": "Json",
      "Description": "The zones and the vSwitches in the zones. You must specify at least two zones.",
      "MinLength": 2,
      "MaxLength": 3
    }
  },
  "Resources": {
    "LoadBalancer": {
      "Type": "ALIYUN::NLB::LoadBalancer",
      "Properties": {
        "VpcId": {
          "Ref": "VpcId"
        },
        "AddressType": {
          "Ref": "AddressType"
        },
        "ZoneMappings": {
          "Ref": "ZoneMappings"
        }
      }
    }
  },
  "Outputs": {
    "AddressIpVersion": {
      "Description": "The version of IP address that the NLB instance uses to provide services.",
      "Value": {
        "Fn::GetAtt": [
          "LoadBalancer",
          "AddressIpVersion"
        ]
      }
    },
    "VpcId": {
      "Description": "The ID of the virtual private cloud (VPC) where the NLB instance is deployed.",
      "Value": {
        "Fn::GetAtt": [
          "LoadBalancer",
          "VpcId"
        ]
      }
    },
    "LoadBalancerId": {
      "Description": "The ID of the NLB instance.",
      "Value": {
        "Fn::GetAtt": [
          "LoadBalancer",
          "LoadBalancerId"
        ]
      }
    },
    "AddressType": {
      "Description": "The type of IP address that the NLB instance uses to provide services.",
      "Value": {
        "Fn::GetAtt": [
          "LoadBalancer",
          "AddressType"
        ]
      }
    },
    "DNSName": {
      "Description": "The domain name of the NLB instance.",
      "Value": {
        "Fn::GetAtt": [
          "LoadBalancer",
          "DNSName"
        ]
      }
    },
    "ZoneMappings": {
      "Description": "The zones, vSwitches and addresses which are mapped to the zones.",
      "Value": {
        "Fn::GetAtt": [
          "LoadBalancer",
          "ZoneMappings"
        ]
      }
    },
    "LoadBalancerType": {
      "Description": "The type of the NLB instance.",
      "Value": {
        "Fn::GetAtt": [
          "LoadBalancer",
          "LoadBalancerType"
        ]
      }
    }
  }
}