如何在 AWS IoT 中找到我的个人终端节点?

Sav*_*vas 1 amazon-web-services aws-iot

我正在尝试编写一个 Java 应用程序,它的行为类似于事物,在 AWS 中发布数据。文档有这个代码示例:

String clientEndpoint = "<prefix>.iot.<region>.amazonaws.com";       // replace <prefix> and <region> with your own
String clientId = "<unique client id>";                              // replace with your own client ID. Use unique client IDs for concurrent connections.
String certificateFile = "<certificate file>";                       // X.509 based certificate file
String privateKeyFile = "<private key file>";                        // PKCS#1 or PKCS#8 PEM encoded private key file

// SampleUtil.java and its dependency PrivateKeyReader.java can be copied from the sample source code.
// Alternatively, you could load key store directly from a file - see the example included in this README.
KeyStorePasswordPair pair = SampleUtil.getKeyStorePasswordPair(certificateFile, privateKeyFile);
AWSIotMqttClient client = new AWSIotMqttClient(clientEndpoint, clientId, pair.keyStore, pair.keyPassword);

// optional parameters can be set before connect()
client.connect();
Run Code Online (Sandbox Code Playgroud)

我知道 clientId 是什么以及如何找到我的 ID,但我无法理解 clientEndpoint。

Sav*_*vas 5

它不是帐户的个人端点,而是事物的端点。

转到 IoT 核心 -> 管理 -> 事物,选择您的事物 -> 交互。它是 HTTPS 部分下的 URL。它应该是 xxxxxxxxxxxxxxxxxx.iot.region.amazonaws.com 的形式,其中 x 应该主要包含小写字母,可能还有一些数字。

  • 这也可以在 IoT Core 的“设置”部分下找到。只需点击一下即可到达那里:) (3认同)