ALIYUN::NLB::LoadBalancer类型用于创建网络型负载均衡实例。

语法

{
  "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
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
LoadBalancerName String 负载均衡实例的名称。
AddressIpVersion String 负载均衡实例的IP版本。 取值:
  • Ipv4
  • DualStack
ResourceGroupId String 资源组ID。
VpcId String 负载均衡实例的所属VPC ID。
LoadBalancerBillingConfig Map 负载均衡实例的计费配置。 详情请参见LoadBalancerBillingConfig属性
TrafficAffinityEnabled Boolean 是否启用流量相关性。 取值:
  • true:启用流量相关性。
  • false:未启用流量相关性。
BandwidthPackageId String 公网类型实例关联的共享带宽包ID。
AddressType String 负载均衡IPv4的网络地址类型。 取值:
  • Internet:公网。负载均衡具有公网IP地址,DNS域名被解析到公网IP,因此可以在公网环境访问。
  • Intranet:私网。负载均衡只有私网IP地址,DNS域名被解析到私网IP,因此只能被负载均衡所在VPC的内网环境访问。
ZoneMappings List 可用区及交换机映射列表。 请参见ZoneMappings属性
CrossZoneEnabled Boolean 是否启用跨区域负载均衡。 取值:
  • true:启用跨区域。
  • false:未启用跨区域。
LoadBalancerType String 负载均衡实例类型。

LoadBalancerBillingConfig语法

"LoadBalancerBillingConfig": {
  "PayType": String
}

LoadBalancerBillingConfig属性

属性名称 类型 必须 允许更新 描述 约束
PayType String 实例的计费类型。 取值:
  • PayAsYouGo
  • PostPaid
  • PayOnDemand
  • Postpaid
  • PostPay

ZoneMappings语法

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

ZoneMappings属性

属性名称 类型 必须 允许更新 描述 约束
ZoneId String 负载均衡实例的可用区ID。 您可以通过调用DescribeZones接口获取可用区ID对应的可用区的信息。
VSwitchId String 可用区对应的交换机。 每个可用区只能使用一台交换机。
AllocationId String 弹性公网IP的实例ID。
PrivateIPv4Address String IPv4地址。

返回值

Fn::GetAtt

  • AddressIpVersion:负载均衡实例的IP版本。
  • VpcId:负载均衡实例的所属的VPC ID。
  • LoadBalancerId:负载均衡实例的ID。
  • AddressType:负载均衡IPv4的网络地址类型。
  • DNSName:DNS域名。
  • ZoneMappings:可用区及交换机映射列表。
  • LoadBalancerType:负载均衡实例类型。

示例

JSON格式

{
  "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"
        ]
      }
    }
  }
}