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

Before you proceed, take note of the following items: For more information about IoT Platform instances, see Overview.

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

  1. Log on to the IoT Platform console. In the top navigation bar, select the region where the instance whose details you want to view resides
    Select a region
  2. On the Overview page, click the instance that you want to manage. The Instance Details page appears.
  3. On the Instance Details page, click View Developer Configurations in the upper-right corner. In the Developer Configurations panel, click the MQTT, CoAP, or HTTP tab to view the endpoint based on the protocol that is used by your device.
    View developer configurations
    You can click Copy to copy the instance endpoint. View configurations

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.

Note The IP address may change due to reasons such as the relocation of the data center of your carrier. If your device is connected to IoT Platform by using a fixed IP address instead of an endpoint, you must send commands in the IoT Platform console or perform an over-the-air (OTA) update to synchronize the IP address to the device. Otherwise, the device cannot be connected to IoT Platform.

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.

  1. On the Instance Details page of an instance, click View Developer Configurations in the upper-right corner of the page.
  2. In the Developer Configurations panel, click Settings to the right of Fixed IP address on the MQTT tab. Fixed IP address
  3. 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.