All Products
Search
Document Center

Server Load Balancer:Use OpenAPI Explorer to create an ALB instance and assign private IP addresses

Last Updated:Dec 01, 2023

Alibaba Cloud OpenAPI Explorer allows you to manage IP addresses and assign private IP addresses to an Application Load Balancer (ALB) instance. When you create an Internet-facing or internal-facing ALB instance, you can use Alibaba Cloud OpenAPI Explorer to specify an IPv4 address in the CIDR block of each vSwitch to which the ALB instance belongs as the private IP address of the ALB instance.

Usage notes

  • You can assign private IPv4 addresses only to IPv4 or dual-stack ALB instances. Private IPv6 addresses are not supported by dual-stack ALB instances.

  • You can assign private IPv4 addresses only to ALB instances in static IP mode. Private IPv4 addresses are not supported by ALB instances in dynamic IP mode.

Procedure

  1. Log on to OpenAPI Explorer.

  2. On the CreateLoadBalancer page, set the request parameters. In this example, Region is set to China (Hangzhou).

    The following table describes only the parameters that are relevant to this topic. For more information about how to specify the other parameters, see CreateLoadBalancer.

    Parameter

    Description

    Example

    VpcId

    The ID of the virtual private cloud (VPC) in which the ALB instance resides.

    To view the VPC ID, log on to the VPC console, select China (Hangzhou) from the top navigation bar, click VPC in the left-side navigation pane, and then find the VPC that you want to view.

    vpc-bp1wfo2ytjbr9zs3y****

    AddressType

    The network type of the IPv4 address that you want to assign to the ALB instance.

    • Internet: a public IPv4 address. Domain names are resolved to the public IPv4 address, which is accessible over the Internet.

    • Intranet: a private IPv4 address. Domain names are resolved to the private IPv4 address, which is accessible only within the VPC of the ALB instance.

    Specify Internet or Intranet based on your business requirements.

    Intranet

    LoadBalancerName

    The name of the ALB instance.

    ALB-test01

    ZoneMappings

    The mappings between zones and vSwitches. If the region has two or more zones, select at least two zones to ensure service high availability.

    • VSwitchId: the ID of the vSwitch in the zone.

      You can call the DescribeVSwitches operation to query the vSwitch IDs.

    • ZoneId: the ID of the zone.

      You can call the DescribeZones operation to query zone IDs.

    • IntranetAddress: the IPv4 address that you want to assign to the ALB instance.

      Important

      When you assign the private IP address to the ALB instance, make sure that the address belongs to the destination CIDR block of the vSwitch and is not in use.

    To view vSwitch IDs and CIDR blocks, log on to the VPC console, select China (Hangzhou) from the top navigation bar, click VPC in the left-side navigation pane, and then find the VPC of the ALB instance. On the Resource Management tab, click the number below the vSwitch parameter. Then, you can view the vSwitch IDs and CIDR blocks.

    In this example, Zone G and Zone I are specified. Specify zones based on the region of your ALB instance.

    Zone G settings:

    • ZoneMappings.1.VSwitchI: vsw-bp1jiciza3mpuyphn****

    • ZoneMappings.1.ZoneId: cn-hangzhou-g

    • ZoneMappings.1.IntranetAddress: 192.168.1.13

    Zone I settings:

    • ZoneMappings.0.VSwitchId: vsw-bp1uwoih7uwew975k****

    • ZoneMappings.0.ZoneId: cn-hangzhou-i

    • ZoneMappings.0.IntranetAddress: 192.168.0.230

    LoadBalancerEdition

    The edition of the ALB instance. The features and billing rules vary based on the edition of the ALB instance. Valid values:

    • Basic

    • Standard

    • StandardWithWaf

    Basic

    AddressAllocatedMode

    The mode in which IP addresses are allocated. Valid values:

    • Fixed: assigns a static IP address to the ALB instance.

    • Dynamic: dynamically assigns an IP address to each zone of the ALB instance.

    Fixed is specified in this example.

    Fixed

    LoadBalancerBillingConfig

    The configuration of the billing method of the ALB instance.

    • PayType: the billing method of the ALB instance.

      Set the value to PostPay, which specifies the pay-as-you-go billing method.

    • BandwidthPackageId: the ID of the Internet Shared Bandwidth instance if the ALB instance is Internet-facing.

    • PayType: PostPay is specified in this example.

    • BandwidthPackageId: Set this parameter based on your business requirements.

    AddressIpVersion

    The protocol version. Valid values:

    • IPv4 (default)

    • DualStack

    IPv4 and DualStack are supported. Specify an IP version based on your business requirements. If you specify DualStack, make sure that the vSwitch of the ALB instance has IPv6 enabled. For more information, see Enable IPv6 for a vSwitch.

    IPv4

  3. Click Initiate Call.

    The following result is returned. If the returned HTTP status code is 200, the NLB instance is created. If other HTTP status codes are returned, troubleshoot the error based on the error message. For more information, see ALB status codes.

    {
      "RequestId": "0A1F39B6-4BDE-5923-A3BE-E98708413D1B",
      "LoadBalancerId": "alb-gokux4i116yiqf****"
    }

    After the request is sent, you can call the GetLoadBalancerAttribute operation to query the configurations of the ALB instance.

  4. Optional. After the ALB instance is created, you can log on to the ALB console to check whether the private IP addresses of the ALB instance are 192.168.1.13 and 192.168.0.230.

    1. In the top navigation bar, select the China (Hangzhou) region.

    2. On the Instances page, click the ID of the ALB instance that you want to manage.

    3. On the Instance Details tab, view the private IP addresses of the ALB instance.

References