Updated on 2026-01-09 GMT+08:00

Copying a Listener

Function

This API is used to copy a listener from a load balancer to another in the same VPC.

Note the following when copying a listener:

  • You can only copy a listener from a load balancer to another in the same VPC.

  • Listeners of gateway load balancers cannot be copied, and listeners of other types of load balancers cannot be copied to gateway load balancers.

  • You can only copy a listener from a load balancer to another of the same type.

  • The original listener cannot have more than 1,000 backend servers and 100 forwarding policies.

  • The source and destination load balancers cannot be frozen or migrated.

  • If quic_config of the original listener is configured, quic_config of the new listener will be null.

  • If a redirection is configured for the original listener, this forwarding policy will not be copied.

Calling Method

For details, see Calling APIs.

URI

POST /v3/{project_id}/elb/listeners/{listener_id}/clone

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition: Specifies the project ID. For details about how to obtain a project ID, see Obtaining a Project ID.

Constraints: N/A

Range: The value can contain a maximum of 32 characters, including digits and lowercase letters.

Default value: N/A

listener_id

Yes

String

Definition: Specifies the ID of the listener to be copied.

Constraints: N/A

Range: The ID must be in UUID format and can contain up to 36 characters.

Default value: N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition: Specifies the token used for IAM authentication.

Constraints: N/A

Range: N/A

Default value: N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

target_listener_params

Yes

Array of CloneListenerOption objects

Definition: Specifies the configurations of the new listener.

Constraints: N/A

Table 4 CloneListenerOption

Parameter

Mandatory

Type

Description

name

No

String

Definition: Specifies the name of the new listener.

Constraints: N/A

Range: The value contains 0 to 255 characters. If an empty string is specified, the default value is used.

Default value: original listener name-copy

loadbalancer_id

Yes

String

Definition: Specifies the ID of the load balancer to which the new listener is copied.

Constraints:

  • Listeners cannot be copied to gateway load balancers.

  • The destination load balancer must support the protocol of the original listener. If the original listener uses HTTP or HTTPS, the destination load balancer must be an application load balancer. If the original listener uses TCP, UDP, or TLS, the destination load balancer must be a network load balancer.

  • Listeners of shared load balancers can be copied to shared load balancers, and those of dedicated load balancers can be copied to dedicated load balancers.

  • If IP as a Backend is enabled for the source load balancer, it must also be enabled for the destination load balancer.

  • If the original listener uses TLS, the destination load balancer must support TLS listeners.

Range: The ID must be in UUID format and can contain up to 36 characters.

Default value: N/A

protocol_port

No

Integer

Definition: Specifies the port used by the new listener.

Constraints:

  • The port cannot be the same as that of any existing listener on the destination load balancer.

  • If this parameter is set to 0, port_ranges is required.

  • The port of HTTP and TERMINATED_HTTPS listeners added to a shared load balancer cannot be 21.

Range: 0 to 65535

Default value: N/A

port_ranges

No

Array of PortRange objects

Definition: Specifies one or more port ranges, including the start and end port numbers. A maximum of 10 port ranges can be specified. Port ranges cannot overlap with each other.

Constraints:

  • This parameter can be specified only when protocol_port is set to 0 or protocol_port is not specified.

  • This parameter is available for TCP, UDP, and TLS listeners.

  • The port cannot conflict with that of any existing listener on the destination load balancer.

reuse_pool

No

Boolean

Definition: Specifies whether to reuse or copy the backend server groups and backend servers of the original listener.

  • Reuse: The destination load balancer directly uses the backend server group of the original listener.

  • Copy: New backend server groups with the same settings as those of the original listener will be created and associated with the destination load balancer.

  • If this parameter is set to true, the backend server groups of the original listener must be associated with multiple load balancers.

  • This parameter is available only for copying a listener from a dedicated load balancer to another in the same VPC.

  • true: The backend server groups of the original listener will be used.

  • false: New backend server groups with the same settings as those of the original listener will be created and associated with the destination load balancer.

Constraints:

Range:

Default value: false

subnet_mapping_list

No

Array of SubnetMappingList objects

Definition: Specifies the IDs of the subnets where the original and new listeners' backend servers are running.

Constraints:

  • This parameter is mandatory when you copy a listener to a load balancer in a different VPC. This parameter is not required when you copy a listener to a load balancer in the same VPC.

  • If ip_target_enable is set to true (false by default) for the source load balancer, you cannot copy a listener to a load balancer in a different VPC. In this case, this parameter cannot be specified.

  • The value of subnet_cidr_id must be the ID of the subnet in the VPC where the original listener's backend servers are running, and the value of dst_subnet_cidr_id must be the ID of the subnet in the VPC where the new listener's backend servers are running. Each pair of subnets must have a unique one-to-one mapping.

  • Each pair of subnets specified by subnet_cidr_id and dst_subnet_cidr_id must exist and have the same CIDR block.

Table 5 PortRange

Parameter

Mandatory

Type

Description

start_port

No

Integer

Definition: Specifies the start port number.

Constraints: N/A

Range: 1-65535

Default value: N/A

end_port

No

Integer

Definition: Specifies the end port number.

Constraints: The value must be greater than or equal to the start port number.

Range: 1-65535

Default value: N/A

Table 6 SubnetMappingList

Parameter

Mandatory

Type

Description

subnet_cidr_id

Yes

String

Definition: Specifies the ID of the subnet in the VPC where the original listener's backend servers are running.

Constraints: N/A

Range: The ID must be in UUID format and can contain up to 36 characters.

Default value: N/A

dst_subnet_cidr_id

Yes

String

Definition: Specifies the ID of the subnet in the VPC where the new listener's backend servers are running.

Constraints: The VPC subnet ID must exist and must have the same CIDR block as that defined by subnet_cidr_id.

Range: The ID must be in UUID format and can contain up to 36 characters.

Default value: N/A

Response Parameters

Status code: 200

Table 7 Response body parameters

Parameter

Type

Description

listener_list

Array of CloneListenerResp objects

Definition: Specifies the information about the new listener.

request_id

String

Definition: Specifies the request ID.

Range: The value is automatically generated, and can contain characters including digits, lowercase letters, and hyphens (-).

job_id

String

Definition: Specifies the ID of the listener copy task. You can query the task details by calling the API (GET /v3/{project_id}/elb/jobs/{job_id}).

Range: The ID must be in UUID format and can contain up to 36 characters.

Table 8 CloneListenerResp

Parameter

Type

Description

id

String

Definition: Specifies the ID of the new listener.

Range: The ID must be in UUID format and can contain up to 36 characters.

loadbalancer_id

String

Definition: Specifies the ID of the destination load balancer.

Range: The ID must be in UUID format and can contain up to 36 characters.

protocol_port

Integer

Definition: Specifies the port used by the new listener.

Range: 1 to 65535

port_ranges

Array of ResPortRange objects

Definition: Specifies one or more port ranges, including the start and end ports.

Table 9 ResPortRange

Parameter

Type

Description

start_port

Integer

Definition: Specifies the start port.

Range: 1 to 65535

end_port

Integer

Definition: Specifies the end port.

Range: 1 to 65535

Example Requests

Copying a listener

POST https://{ELB_Endpoint}/v3/{project_id}/elb/listeners/{listener_id}/clone

{
  "target_listener_params" : [ {
    "name" : "xx-clone",
    "loadbalancer_id" : "fb624475-734a-470a-85ed-bd8828bae924",
    "protocol_port" : 425,
    "reuse_pool" : false
  } ]
}

Example Responses

Status code: 200

Successful request.

{
  "request_id" : "11750ade-148f-4498-bd7a-e07190a1f5fe",
  "job_id" : "aa132002-c0a8-473b-82b4-69fd2d6f87d2",
  "listener_list" : [ {
    "id" : "81fdfab0-35c0-476e-96df-e00797076843",
    "loadbalancer_id" : "fb624475-734a-470a-85ed-bd8828bae924",
    "protocol_port" : 425,
    "port_ranges" : null
  } ]
}

Status Codes

Status Code

Description

200

Successful request.

Error Codes

See Error Codes.