You can change the network type of an Application Load Balancer (ALB) instance as needed.

Network types

ALB provides Internet-facing instances and internal-facing instances. Differences between Internet-facing ALB instances and internal-facing ALB instances:
  • Internal-facing: If you create an internal-facing ALB instance, a private IP address is assigned to each zone. The ALB instance is accessible only over the internal network.
  • Internet-facing: If you create an Internet-facing ALB instance, a public IP address and a private IP address are assigned to each zone. Internet-facing ALB instances use elastic IP addresses (EIPs) to provide services over the Internet. If you create an Internet-facing ALB instance, you are charged for EIPs, bandwidth resources, and data transfer. If you want your ALB instance to use an Anycast EIP to provide services, you must associate your ALB instance with an Anycast EIP. For more information, see Associate an Anycast EIP with an ALB instance.

IP versions

ALB supports IPv4 and dual-stack networking. The following table describes the differences between IPv4 and dual stack.
IP versionDefault valueDescription
IPv4
  • An IPv4 Internet-facing ALB instance is assigned a public IPv4 address and a private IPv4 address in each zone.
  • An IPv4 internal-facing ALB instance is assigned a private IPv4 address in each zone.
Clients can use only IPv4 addresses (such as 192.0.2.1) to access an IPv4 ALB instance.

IPv4 ALB instances forward requests only from IPv4 clients to IPv4 backend servers. You can specify ECS instances, ENIs, elastic container instances, IP addresses, and Function Compute functions as backend servers.

Dual-stack
  • A dual-stack Internet-facing ALB instance is assigned a public IPv4 address and a private IPv6 address in each zone.
  • A dual-stack internal-facing ALB instance is assigned a private IPv4 address and a private IPv6 address in each zone.
Note By default, the dual-stack feature of ALB is unavailable. To use this feature, log on to the Quota Center console. On the Whitelist Quotas page, enter the quota ID slb_user_visible_gray_label/support_ipv6, and then apply for the privilege to use the feature. For more information, see Manage ALB quotas.
Clients can use IPv4 addresses (such as 192.168.0.1) and IPv6 addresses (such as 2001:db8:1:1:1:1:1:1) to access a dual-stack ALB instance.
Dual-stack ALB instances can forward requests from both IPv4 and IPv6 clients to the backend servers.
  • If you use a dual-stack ALB instance to forward requests from IPv6 clients to IPv4 backend servers, you can specify ECS instances, ENIs, elastic container instances, and IP addresses as backend servers. You cannot specify Function Compute functions as backend servers.
  • If you use a dual-stack ALB instance to forward requests from IPv6 clients to IPv6 backend servers, you can specify ECS instances, ENIs, and elastic container instances as backend servers. You cannot specify IP addresses or Function Compute functions as backend servers.
ALB provides services through domain names. You can map custom domain names to the domain name of ALB. This allows users to access your services in a more convenient manner.
  • We recommend that you use CNAME records to map custom domain names to the domain name of your ALB instance. This allows users to access your services in a more convenient manner.
  • If you want to resolve a custom domain name to a specific IP address, we recommend that you use an ALB instance with a specific IP address and use A records to resolve the custom domain name to the IP address of the ALB instance.

Public IP address types

ALB supports the following types of public IP address:
  • EIP: An EIP is a public IP address that you can purchase and use as an independent resource. You can associate an EIP with a Classic Load Balancer (CLB) instance in a virtual private cloud (VPC), an internal-facing ALB instance, or an Internet NAT gateway. For more information, see What is EIP?.
  • Anycast EIP: An Anycast EIP is a public IP address that you can purchase and use as an independent resource. Each Anycast EIP is assigned an IP address that has Internet access. For more information, see What is Anycast EIP?.
Note For more information about the differences between Anycast EIPs and EIPs, see Comparison between Anycast EIPs and EIPs.

Limits

By default, the feature to associate Anycast EIPs with ALB instances is unavailable. To use this feature, log on to the Quota Center console, go to the Whitelist Quotas page, enter the quota ID slb_user_visible_gray_label/anycast_eip, and then click Apply in the Actions column. For more information, see Manage ALB quotas.

When you associate EIPs with ALB instances, take note of the following limits:
  • The EIPs that are specified for different zones of the same ALB instance must be of the same type. For more information about the types of EIPs that are supported by ALB, see FAQ about ALB.
  • The EIP that you want to associate with an ALB instance cannot be associated with an EIP bandwidth plan. If you want to use EIP bandwidth plans, you can associate an EIP bandwidth plan with the ALB instance in the ALB console after you associate an EIP with the ALB instance. The line type of the EIP must be the same as the line type of the EIP bandwidth plan. For more information about how to associate an EIP bandwidth plan with an ALB instance, see Modify the maximum bandwidth.

Billing

  • ALB is billed on an hourly basis. If you use an ALB instance for less than 1 hour, the usage duration is rounded up to 1 hour. Network type changes immediately take effect. After you change the network type of an ALB instance, you are charged based on the previous network type within the current hour. The usage duration is rounded up to 1 hour. For more information, see ALB billing rules.
  • The following table describes the impacts of network changes on billing.
    ActionScenarioMethodImpact on billingReferences
    Private IPv4 address to public IPv4 addressThe ALB instance needs to use a public IPv4 address to provide services over the Internet. Associate with an EIP or an Anycast EIP. After you associate the ALB instance with an EIP or an Anycast EIP, you are charged Internet data transfer fees.
    Public IPv4 address to private IPv4 addressThe ALB instance no longer needs to use the public IPv4 address to provide services over the Internet. Disassociate from the EIP or Anycast EIP. After you disassociate the ALB instance from the EIP or Anycast EIP, you are no longer charged Internet data transfer fees. N/A
    Private IPv6 address to public IPv6 addressThe ALB instance needs to use a public IPv6 address to provide services over the Internet. Enable Internet bandwidth for the IPv6 gateway. You are charged for the IPv6 gateway and Internet bandwidth resources. IPv6 gateway billing rules
    Public IPv6 address to private IPv6 addressThe ALB instance no longer needs to use the public IPv6 address to provide services over the Internet. Disable Internet bandwidth for the IPv6 gateway. You are no longer charged for Internet bandwidth resources. The ALB instance can no longer use the IPv6 address to provide services over the Internet. N/A

Prerequisites

An ALB instance is created. For more information, see Create an ALB instance.

Change the IPv4 network type for an ALB instance

Private IPv4 address to public IPv4 address

After you change the network type of an ALB instance from private IPv4 to public IPv4, you must assign an EIP or an Anycast EIP to the ALB instance. EIPs and Anycast EIPs incur Internet data transfer fees. For more information, see EIP billing and Anycast EIP billing.

  1. Log on to the ALB console.
  2. In the top navigation bar, select the region where the ALB instance is deployed.
  3. On the Instances page, find the ALB instance that you want to manage and click its ID.
  4. On the Instance Details tab, find the Basic Information section, and click Change Network Type on the right side of Network Type.
  5. In the Change Network Type dialog box, set IP Address Type, select a public IP address for the ALB instance, and then click OK.
    • Allocate an EIP
      1. Set IP Address Type to EIP.
      2. Select Purchase EIP from the Assign EIP drop-down list.
      Note
      • You must assign an EIP to each zone in the list.
      • When you select Purchase EIP, take note of the following rules:
        • After an ALB instance switches to a private IP address or is released, the EIP associated with the ALB instance is automatically disassociated and released.
        • You can view the details about an EIP in the EIP console.
        • The EIP uses the pay-as-you-go billing method and the pay-by-data-transfer metering method. The EIP uses BGP (Multi-ISP) lines and is protected by Anti-DDoS Origin Basic.
    • Assign an Anycast EIP

      For more information about the limits and procedure of Anycast EIPs, see Associate an Anycast EIP with an ALB instance.

      1. Set IP Address Type to Anycast EIP.
      2. Select Purchase Anycast EIP from the Assign EIP drop-down list, or select an existing Anycast EIP.
        Note
        • You must assign Anycast EIPs to all zones in the list.
        • When you select Purchase Anycast EIP, take note of the following items:
          • When you switch an ALB instance from Internet-facing to internal-facing, or you release the ALB instance, the associated Anycast EIP is automatically disassociated and released.
          • You can view the parameters of an Anycast EIP in the Anycast EIP console.
  6. Return to the Instance Details tab to check the value of the Network Type parameter.
    It takes about 1 minute to apply the change. If the value of the Network Type parameter on the Instance Details tab changes to Public, it indicates that the ALB instance has switched to a public IP address.

Public IPv4 address to private IPv4 address

After an ALB instance switches to a private IPv4 address, all public IP addresses are disassociated from the ALB instance. The DNS records of the ALB instance are also updated. Proceed with caution.

  1. Log on to the ALB console.
  2. In the top navigation bar, select the region where the ALB instance is deployed.
  3. On the Instances page, find the ALB instance that you want to manage and click its ID.
  4. On the Instance Details tab, find the Basic Information section, and click Change Network Type on the right side of Network Type.
  5. In the Change Network Type dialog box, modify and confirm the settings, and click OK.
  6. Return to the Instance Details tab to check the value of the Network Type parameter.
    It takes about 1 minute to apply the change. If the value of the Network Type parameter on the Instance Details tab changes to Private, it indicates that the ALB instance has switched to a private IPv4 address.

Change the network type of dual stack for an ALB instance

Private dual stack to public dual stack

  • For more information about how to switch to a public IPv4 address, see Change the IPv4 network type for an ALB instance.
  • The following procedure shows how to switch to a public IPv6 address.
    Note After an ALB instance switches from a private IPv6 address to a public IPv6 address, Internet bandwidth is enabled for the IPv6 gateway. You can view the details in the VPC console. Internet bandwidth incurs fees and is automatically enabled or disabled based on the network type of the ALB instance. For more information, see IPv6 gateway billing.
  1. Log on to the ALB console.
  2. In the top navigation bar, select the region where the ALB instance is deployed.
  3. On the Instances page, find the ALB instance that you want to manage and click its ID.
  4. On the Instance Details tab, find the Basic Information section, and click Change Network Type on the right side of Network Type.
  5. In the Change Network Type dialog box, modify and confirm the settings, and click OK.
    Note If the VPC where the ALB instance is deployed does not have an IPv6 gateway, you are prompted to create one. Create an IPv6 gateway in the console as prompted.
  6. Return to the Instance Details tab to check the value of the Network Type parameter.
    It takes about 1 minute to apply the change. If the value of the Network Type parameter on the Instance Details tab changes to Public, it indicates that the ALB instance has switched to a public IPv6 address.

Public dual stack to private dual stack

  1. Log on to the ALB console.
  2. In the top navigation bar, select the region where the ALB instance is deployed.
  3. On the Instances page, find the ALB instance that you want to manage and click its ID.
  4. On the Instance Details tab, find the Basic Information section, and click Change Network Type on the right side of Network Type.
  5. In the Change Network Type dialog box, modify and confirm the settings, and click Disable.
  6. Return to the Instance Details tab to check the value of the Network Type parameter.
    It takes about 1 minute to apply the change. If the value of the Network Type parameter on the Instance Details tab changes to Private, it indicates that the ALB instance has switched to a private IPv6 address.

References