步骤 1:下载并保存 Amazon IoTDevice Client - Amazon IoT Core
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

步骤 1:下载并保存 Amazon IoTDevice Client

本节中的步骤下载 Amazon IoTDevice Client,编译,然后将其安装在 Raspberry Pi 上。测试安装后,您可以保存 Raspberry Pi的 microSD卡映像,以便以后需要再次尝试教程时使用。

下载并构建 Amazon IoTDevice Client

此过程安装 Raspberry Pi 中的Amazon IoT Device Client。

在连接到 Raspberry Pi 的本地主机上的终端窗口中执行这些命令。

要在 Raspberry Pi 中安装 Amazon IoTDevice Client
  1. 输入以下命令可下载并构建 Raspberry Pi 中的 Amazon IoTDevice Client。

    cd ~ git clone https://github.com/awslabs/aws-iot-device-client aws-iot-device-client mkdir ~/aws-iot-device-client/build && cd ~/aws-iot-device-client/build cmake ../
  2. 运行此命令来构建 Amazon IoTDevice Client。完成此命令可能最多需要 15 分钟。

    cmake --build . --target aws-iot-device-client

    警告消息显示为可以忽略 Amazon IoTDevice Client 的编译文件。

    这些教程已经通过 gcc上构建的 Amazon IoTDevice Client测试,gcc 上的 Raspberry Pi OS (bullseye) 2021年10月30日版本 (Raspbian 10.2.1-6+rpi1) 10.2.1 20210110,Raspberry Pi OS (buster) 2021年5月7日版本,(Raspbian 8.3.0-6+rpi1) 8.3.0 版本。

  3. Amazon IoT Device Client 完成构建后,通过运行此命令进行测试。

    ./aws-iot-device-client --help

如果您看到的命令行帮助 Amazon IoTDevice Client,Amazon IoT Device Client 已成功构建,可供您使用。

创建教程使用的目录

此过程将在 Raspberry Pi 上创建目录,用于存储教程在此学习路径中使用的文件。

要在此学习路径中创建教程使用的目录,请执行以下操作:
  1. 运行这些命令创建所需的目录。

    mkdir ~/dc-configs mkdir ~/policies mkdir ~/messages mkdir ~/certs/testconn mkdir ~/certs/pubsub mkdir ~/certs/jobs
  2. 运行这些命令设置新目录的权限。

    chmod 745 ~ chmod 700 ~/certs/testconn chmod 700 ~/certs/pubsub chmod 700 ~/certs/jobs

创建这些目录并设置权限后,请继续 (可选)保存 microSD 卡映像