This topic describes how to configure an endpoint in the Classic SDK.
Note
An endpoint is a domain name of an Alibaba Cloud service API. For example, an endpoint of Elastic Compute Service (ECS) can be ecs.cn-hangzhou.aliyuncs.com.
The Classic SDK provides two comprehensible addressing modes for endpoints. The following list describes the addressing modes by priority in descending order:
User-defined addressing mode: This mode is assigned the highest priority. In this mode, you can specify an exact endpoint.
use AlibabaCloud\Client\AlibabaCloud;
// Specify an exact endpoint for an Alibaba Cloud service in the China (Hangzhou) region.
AlibabaCloud::addHost('product', 'product.cn-hangzhou.aliyuncs.com', 'cn-hangzhou');
// Specify a global endpoint for an Alibaba Cloud service. If you do not specify an exact endpoint for the service in a region, the global endpoint is used.
AlibabaCloud::addHost('product', 'product.aliyuncs.com');
$request = AlibabaCloud::rpc()
->product('Sts')
->version('2015-04-01')
->action('GenerateSessionAccessKey')
->host('product.ap-northeast-1.aliyuncs.com') // Specify an exact endpoint.
->request();
2. Core library-based addressing mode: In this mode, an endpoint is obtained based on the data file Data.php in the core library. For more information about the data file, visit Data.php.