← Credentials | Endpoint(中文) | Transport →
Default
If
Endpointis not specified, the SDK uses Automatic Endpoint Resolution.
import com.volcengine.ApiClient;
import com.volcengine.sign.Credentials;
public class SampleCode {
public static void main(String[] args) {
String region = "cn-beijing";
ApiClient apiClient = new ApiClient()
.setCredentials(Credentials.getEnvCredentials())
.setRegion(region)
.setEndpoint("<example>.<regionId>.volcengineapi.com");
}
}import com.volcengine.ApiClient;
import com.volcengine.sign.Credentials;
public class SampleCode {
public static void main(String[] args) {
String regionId = "cn-beijing";
ApiClient apiClient = new ApiClient()
.setCredentials(Credentials.getEnvCredentials())
.setRegion(regionId);
}
}Volcengine provides a flexible endpoint resolution mechanism. The SDK automatically builds the endpoint based on service name and region, and supports DualStack.
-
Whether the region is in the bootstrap list
Built-in list:
./volcengine-java-sdk-core/src/main/java/com/volcengine/endpoint/DefaultEndpointProvider.java#BOOTSTRAP_REGION.Only predefined regions (e.g.,
cn-beijing-autodriving,ap-southeast-2) or user-configured regions are auto-resolved; others fall back toopen.volcengineapi.com.You can extend the list via env var
VOLC_BOOTSTRAP_REGION_LIST_CONForcustomBootstrapRegion. -
DualStack support (IPv6)
Enable via
setUseDualStack(true)or env varVOLC_ENABLE_DUALSTACK=true. Priority:useDualStack>VOLC_ENABLE_DUALSTACK.When enabled, the suffix changes from
volcengineapi.comtovolcengine-api.com. -
Construct endpoint based on service name and region
- Global services (e.g.,
CDN,IAM):<service>.volcengineapi.com(orvolcengine-api.comwhen DualStack is enabled). Example:cdn.volcengineapi.com. - Regional services (e.g.,
ECS,RDS):<service>.<region>.volcengineapi.comis used as the default endpoint. Example:ecs.cn-beijing.volcengineapi.com.
- Global services (e.g.,
import com.volcengine.ApiClient;
import com.volcengine.sign.Credentials;
import java.util.HashSet;
public class SampleCode {
public static void main(String[] args) {
String regionId = "cn-beijing";
ApiClient apiClient = new ApiClient()
.setCredentials(Credentials.getEnvCredentials())
.setRegion(regionId)
.setUseDualStack(true)
.setCustomBootstrapRegion(new HashSet<String>() {{
add("custom_example_region1");
add("custom_example_region2");
}});
}
}| Global service | DualStack | Format |
|---|---|---|
| Yes | Yes | {Service}.volcengine-api.com |
| Yes | No | {Service}.volcengineapi.com |
| No | Yes | {Service}.{region}.volcengine-api.com |
| No | No | {Service}.{region}.volcengineapi.com |
Whether a service is global depends on the service itself and cannot be changed. See: ./volcengine-java-sdk-core/src/main/java/com/volcengine/endpoint/StandardEndpointProvider.java#SERVICE_INFOS.
import com.volcengine.ApiClient;
import com.volcengine.sign.Credentials;
import com.volcengine.endpoint.StandardEndpointProvider;
public class SampleCode {
public static void main(String[] args) {
String regionId = "cn-beijing";
ApiClient apiClient = new ApiClient()
.setCredentials(Credentials.getEnvCredentials())
.setEndpointResolver(new StandardEndpointProvider())
.setRegion(regionId)
.setUseDualStack(true);
}
}← Credentials | Endpoint(中文) | Transport →