An endpoint is the domain name used to access a service API, such as ecs.cn-hangzhou.aliyuncs.com for ECS in the China (Hangzhou) region. Endpoints vary by service and region. The V2.0 SDK supports two methods to configure them.
Endpoint types
Two types are available: public and VPC endpoints. Endpoints.
Endpoint settings
The V2.0 SDK provides two methods to set an endpoint, listed by priority:
We recommend specifying a custom endpoint.
-
Specify an endpoint: Set the endpoint during client initialization. Find product endpoints in the OpenAPI Developer Portal.
AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config { // Required. Make sure that the ALIBABA_CLOUD_ACCESS_KEY_ID environment variable is set. AccessKeyId = Environment.GetEnvironmentVariable("ALIBABA_CLOUD_ACCESS_KEY_ID"), // Required. Make sure that the ALIBABA_CLOUD_ACCESS_KEY_SECRET environment variable is set. AccessKeySecret = Environment.GetEnvironmentVariable("ALIBABA_CLOUD_ACCESS_KEY_SECRET"), }; // Specify a custom endpoint. config.Endpoint = "dysmsapi.aliyuncs.com"; AlibabaCloud.SDK.Dysmsapi20170525.Client client = new AlibabaCloud.SDK.Dysmsapi20170525.Client(config); -
Specify a RegionId: The SDK resolves the endpoint automatically.
-
If the SDK includes a RegionId-to-endpoint mapping for your RegionId, it uses the mapped endpoint.
-
Otherwise, the SDK generates the endpoint as
${Product ID}.${RegionId}.aliyuncs.com.
-
Appendix: Find an endpoint
Find service endpoints in OpenAPI Explorer:
-
From the top menu, select Products, and then choose a service such as ECS.
2. On the product homepage, find the list of regions.
3. Select the endpoint for your region ID, then copy and paste it.
Alternatively, on the API Debugging page, click Regions in the left-side navigation pane to view available endpoints.