All Products
Search
Document Center

Alibaba Cloud SDK:Configure an endpoint

Last Updated:Feb 23, 2022

An endpoint is a domain name of an Alibaba Cloud service API. For example, an endpoint of the Elastic Compute Service (ECS) API can be ecs.cn-hangzhou.aliyuncs.com.

Configure an endpoint

Related source code

  1. User-defined addressing mode

    User-defined addressing mode: This mode is assigned the highest priority. In this mode, you can specify an exact endpoint.

    # The mode globally takes effect.
    client = AcsClient()
    client.add_endpoint("<region_id>", "<product>", "<endpoint>")
    
    # The mode takes effect only on the current request.
    request = DescribeRegionsRequest()
    request.set_endpoint("<endpoint>")

  2. Concatenation-based addressing mode

    In this mode, an endpoint is generated by concatenating data. This mode takes effect only when API requests are sent over a virtual private cloud (VPC) or the SDK for an Alibaba Cloud service uses an endpoint data file. For more information about an endpoint data file, visit ECS endpoint data file.

    # Send an request over the Internet.
    request.request_network = "public" // The default value of the productNetwork parameter is public. You do not need to configure the parameter.
    
    # Send a cross-origin request.
    request.request_network = "share"
    
    # Send an IPv6 request.
    request.request_network = "ipv6"
    
    # Send a request by using a network proxy.
    request.request_network = "proxy"
    
    # Send a request over an internal network.
    request.request_network = "inner"
    
    // Send a request over a network that supports both IPv4 and IPv6.
    request.request_network = "dualstack"
    
    # Send a request over a VPC.
    request.request_network = "vpc"

  3. Core library-based addressing mode: In this mode, an endpoint is found based on the data file endpoints.json in the core library. For more information about the data file, visit endpoints.json.

  4. The addressing mode that is based on the Location Service API: The Location Service API is called to find an endpoint from the server side.

    In this mode, the SDK for an Alibaba Cloud service must provide a service code.