If you use a device SDK, an IoT Platform SDK, or an 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
The type of the instance and the region in which the instance resides are obtained.
Instance | Region | Description | Method |
Public instances of the previous version | China (Shanghai), Japan (Tokyo), Singapore, Germany (Frankfurt), US (Silicon Valley), and US (Virginia) | On the Overview tab of the IoT Platform console, no instance ID is displayed. Therefore, you cannot click an instance to go to the Instance Details page. Note Public instances of the new version are available only in the China (Shanghai) region. Public instances in other regions are of the previous version. | You cannot view the development configurations of an instance in the IoT Platform console. This topic describes all endpoint information that is required to connect your device to IoT Platform. For more information, see View the endpoint of a public instance of the previous version. |
Public instances of the new version | China (Shanghai) | On the Overview tab of the IoT Platform console, an instance ID is displayed. Click the instance ID to go to the Instance Details page. | In the upper-right corner of the Instance Details page in the IoT Platform console, click View Development Configurations to open the Development Configurations panel that displays the endpoint information. For more information, see the "View the endpoint of a public instance of the new version or an Enterprise Edition instance" section of this topic. |
Enterprise Edition instances | China (Shanghai), China (Beijing), China (Shenzhen), Japan (Tokyo), Singapore, Germany (Frankfurt), US (Silicon Valley), and US (Virginia) |
For more information, see Overview of IoT Platform instances.
Background information
For information about how to configure SDKs, see Use a device SDK to connect a device to IoT Platform, Download IoT Platform SDKs, and Connect an AMQP client to IoT Platform.
Usage notes
If you use AMQP-based server-side subscriptions or call IoT Platform API operations to connect devices to an IoT Platform instance over the Internet by using Message Queuing Telemetry Transport (MQTT), Constrained Application Protocol (CoAP), or HTTP, you must specify a public endpoint when you configure the devices.
If you use IoT Device ID to verify and connect devices to an IoT Platform instance over the Internet, you must specify the public endpoint as the value of the ID² parameter.
ImportantThe format of the ID² parameter values for public instances and Enterprise Edition instances is the same. For more information about the format, see View the endpoint of a public instance of the previous version.
If you use AMQP-based server-side subscriptions or call IoT Platform API operations to connect devices to an IoT Platform instance over a virtual private cloud (VPC) by using MQTT, you must specify a VPC endpoint when you configure the devices.
If you want to connect devices to an Enterprise Edition instance by using MQTT, you can bind a fixed IP address to the instance endpoint.
If you use an Exclusive Enterprise Edition instance, you must create a separate MQTT endpoint. Then, you can specify a custom port number and certificate for the endpoint.
View the endpoint of a public instance of the previous version
Communication type | Endpoint format | Port number |
MQTT |
| 1883 or 443 If MQTT over WebSocket is used, set this parameter to 443. |
CoAP |
|
|
HTTP | Unique-certificate-per-device verification: | 443 |
Pre-registration unique-certificate-per-product verification: Important The HTTPS-based pre-registration unique-certificate-per-product verification method is supported only if you connect devices to instances that reside in the China (Shanghai) region. | ||
AMQP |
|
|
IoT Platform API request | The API request is in the | N/A |
ID² |
This parameter is available only in the Japan (Tokyo) region. | 1883 |
Configure the parameters based on your business requirements. The following table describes the parameters.
Parameter | Description |
| The ProductKey of the product to which the device belongs. You can log on to the IoT Platform console and obtain the ProductKey on the Device Details page of the instance. |
| The ID of the region in which your device resides. For information about the format of region IDs, see Supported regions. |
| The ID of your Alibaba Cloud account. 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
Log on to the IoT Platform console. In the top navigation bar, select the region where the instance that you want to manage resides.
On the Overview tab, click the name or ID of the instance that you want to manage.
In the upper-right corner of the Instance Details page, click View Development Configurations.
In the Development Configurations panel, click the MQTT, CoAP, or HTTP tab to view the endpoint that is used by your device based on the protocol.
ImportantIf you use an Exclusive instance, you must create an MQTT endpoint. For more information, see Create a separate MQTT endpoint for an Exclusive instance.
If IoT Device ID is enabled for Enterprise Edition instances, the ID² parameter is not available on the Manage ID² tab of the Development Configurations panel. For more information about the format of the ID² parameter, see the "View the endpoint of a public instance of the previous version" section in this topic.
If you connect devices to IoT Platform over HTTPS, the unique-certificate-per-device verification method and the pre-registration unique-certificate-per-product verification method are supported. However, the endpoints of the verification methods are different.
If you use the unique-certificate-per-device verification method, the endpoint is displayed on the HTTP tab.
If you use the pre-registration unique-certificate-per-product verification method, the IoT Platform instances to which you want to connect devices must reside in the China (Shanghai) region and use the
iot-auth.cn-shanghai.aliyuncs.com
endpoint.
On each tab, perform the following operations:
Click Copy to copy the instance endpoint.
Move the pointer over the icon to the right of the endpoint to view the port number.
NoteFor information about the port, see the "View the endpoint of a public instance of the previous version" section of this topic.
Bind a fixed IP address to an endpoint
Fixed IP addresses prevent your Domain Name System (DNS) records from being updated when IoT Platform expands the 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 list of directional IP addresses of the carrier.
The IP address may change due to various reasons, such as the relocation of the data center of your carrier. If your device accesses a fixed IP address, you must send commands from IoT Platform or perform an over-the-air (OTA) update to synchronize the IP address to your device. Otherwise, your device cannot connect 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.
To bind fixed IP addresses to the endpoint to which you want to connect devices over the Internet by using MQTT, perform the following steps:
If you use a non-Exclusive Enterprise Edition instance, you can bind two fixed IP addresses to the endpoint.
In the upper-right corner of the Instance Details page of the non-Exclusive Enterprise Edition instance, click View Developer Configurations.
On the MQTT tab of the Development Configurations panel, click Configure to the right of Fixed IP.
In the dialog box that appears, click OK to obtain two fixed IP addresses.
If an MQTT device no longer requires fixed IP addresses, click Unbind.
After you create a public MQTT endpoint for an Exclusive instance, the system automatically associates a fixed IP address with the instance. You do not need to perform additional operations. You cannot disassociate the fixed IP address from the instance.
Create a separate MQTT endpoint for an Exclusive instance
To create an MQTT endpoint for an Exclusive instance, perform the following steps:
In the upper-right corner of the Instance Details page of the Exclusive instance, click View Development Configurations.
On the MQTT tab of the Development Configurations panel, click Create.
In the Create Endpoint dialog box, configure the parameters. The following table describes the parameters.
Parameter
Description
Custom Port Number
The port number of the MQTT endpoint. Default value: 1883.
Enable VPC
Yes: Enable VPCs. If you select Yes, you must specify a VPC, a zone, a vSwitch, and a security group.
The system automatically creates a public MQTT endpoint and a VPC MQTT endpoint.
ImportantIf you want to enable VPCs for MQTT endpoints, you must activate PrivateLink for VPCs. If PrivateLink is not activated for your Alibaba Cloud account, you must go to the VPC console to activate PrivateLink.
No (default): Disable VPCs.
The system automatically creates a public MQTT endpoint.
ImportantIf you select No, you cannot enable VPCs.
Authorization
If you want to enable VPCs, you must complete authorization.
Click Authorize. The system automatically creates a role and a policy that grant devices the permissions on VPCs over which you want to connect the devices to IoT Platform. For more information, see Service-linked roles.
VPC
After you enable VPCs and complete authorization, you must configure these parameters.
Select an existing VPC and vSwitch in the current Alibaba Cloud account.
You can click CreateVPC and CreateVSwitch to create a VPC and a vSwitch. For more information, see Create a VPC and Create a vSwitch.
vSwitch Zone
VSwitch
Security Group
After you enable VPCs and complete authorization, you must configure this parameter.
Select an existing security group in the current Alibaba Cloud account.
You can click Create Security Group to create a security group. For more information, see Create a security group.
In the message that appears, click OK.
After you create the endpoint, the endpoint is displayed in the Connect to MQTT Devices section.
Create a custom certificate for the MQTT endpoint of the Exclusive instance
To create a custom certificate and a domain name for the MQTT endpoint, perform the following steps:
The public endpoint and VPC endpoint use the same custom certificate.
In the upper-right corner of the Instance Details page of the Exclusive instance, click View Development Configurations.
In the Development Configurations panel, click MQTT. On the MQTT tab, click Configure in the Custom Certificate section.
In the Custom Certificate dialog box, set the Customize Configurations parameter to Enable.
NoteIf the Customize Configurations parameter is already set to Enable, skip this step.
Specify the PEM-formatted content and key of a certificate that is obtained from a certificate authority (CA) and click OK.
WarningIf you want to update the certificate information after you specify the content and key of the certificate, certificate verification may fail. In this case, devices may fail to connect to IoT Platform or your business may be interrupted. Proceed with caution.
The Development Configurations panel displays a custom domain name that is parsed from the custom certificate. You can use a custom endpoint to connect devices to IoT Platform over MQTT.
ImportantYou must configure a CNAME record at the domain name provider to resolve the custom domain name to the default MQTT endpoint of the instance.