When you configure a device SDK, IoT Platform SDK, or Advanced Message Queuing Protocol (AMQP) SDK, you must specify the endpoint of the instance to which you want to connect your device. This topic describes how to obtain the endpoint of an instance.
Prerequisites
- If you use a public instance of the old version, see View the endpoint of a public instance of the old version.
- If you use a public instance of the new version or an Enterprise Edition instance, see View the endpoint of a public instance of the new version or an Enterprise Edition instance.
Background information
For more information about how to configure SDKs, see Device SDKs, IoT Platform SDKs, and Connect an AMQP client to IoT Platform.
Usage notes
- If you want to connect devices to an IoT Platform instance over a public network by using Message Queuing Telemetry Transport (MQTT), Constrained Application Protocol (CoAP), or HTTP, use AMQP-based server-side subscription, or call IoT Platform API operations, you must specify a public endpoint when you configure the devices.
- If you want to connect devices to an IoT Platform instance over a virtual private cloud (VPC) by using MQTT, use AMQP-based server-side subscription, or call IoT Platform API operations, you must specify a VPC endpoint when you configure the devices.
- If you want to connect devices to an Enterprise Edition instance over MQTT, you can bind a fixed IP address to the instance.
Regions
A region is a geographic location where Alibaba Cloud data centers are deployed. After a resource is created, you cannot change the region of the resource. The following table describes the mappings between the supported regions, cities where the regions reside, and region IDs.
If you use a public instance of the old version in a region, the endpoint of the instance contains the ID of the region.
- In the Chinese mainland
Region City Region ID China (Shanghai) Shanghai cn-shanghai - Outside the Chinese mainland
Country Region Region ID Singapore Singapore (Singapore) ap-southeast-1 Japan Japan (Tokyo) ap-northeast-1 US US (Silicon Valley) us-west-1 US US (Virginia) us-east-1 Germany Germany (Frankfurt) eu-central-1
For more information, see Regions.
View the endpoint of a public instance of the old version
Communication type | Endpoint format |
---|---|
MQTT | ${YourProductKey}.iot-as-mqtt.${YourRegionId}.aliyuncs.com:1883 .
|
CoAP | ${YourProductKey}.coap.cn-shanghai.link.aliyuncs.com:${port} .
|
HTTP | https://iot-as-http.${YourRegionId}.aliyuncs.com .
|
AMQP | ${uid}.iot-amqp.${YourRegionId}.aliyuncs.com .
|
API requests | The API request is in the http://Endpoint/?Action=**&Parameters format. For more information, see Initiate API requests.
|
Replace the following variables with actual values:
${YourProductKey}
: Replace the value of the variable with the ProductKey of the product to which your device belongs. You can log on to the IoT Platform console and obtain the ProductKey on the device details page of the instance.${YourRegionId}
: Replace this variable with the ID of the region where your IoT Platform device resides. For information about the format of region IDs, see the "Regions" section of this topic.${port}
: the number of the port that is used to connect your device to IoT Platform over Constrained Application Protocol (CoAP). Port 5684 is used for Datagram Transport Layer Security (DTLS). Port 5682 is used for symmetric encryption.${uid}
: the ID of your Alibaba Cloud account that is used to connect your device to IoT Platform over AMQP. You can log on to the IoT Platform console and move the pointer over the profile picture to view the account ID.
View the endpoint of a public instance of the new version or an Enterprise Edition instance
Bind a fixed IP address to an endpoint
Fixed IP addresses prevent your DNS records from being updated when IoT Platform expands its list of IP addresses. If you use IoT cards and your carrier does not support endpoints, you can add your fixed IP address to the directional IP address list of the carrier.
We recommend that you use endpoints to connect your device to IoT Platform. This way, you are notified before an IP address is changed.
Perform the following steps to bind fixed IP addresses to the endpoint that is accessed by devices over the Internet by using MQTT: You can allocate two fixed IP addresses to each MQTT device.
- On the Instance Details page of an instance, click View Developer Configurations in the upper-right corner of the page.
- In the Developer Configurations panel, click Settings to the right of Fixed IP address on the MQTT tab.
- In the dialog box that appears, click OK to obtain two fixed IP addresses.
If MQTT devices no longer require the fixed IP addresses, click Unbind.