使用 Amazon CLI 获取 CreateOTAUpdate 失败的详细信息 - FreeRTOS
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

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

使用 Amazon CLI 获取 CreateOTAUpdate 失败的详细信息

如果创建 OTA 更新作业的过程失败,则可以采取一些措施来解决问题。当您创建 OTA 更新任务时,OTA 管理器服务会创建一个 IoT 作业并将其调度到目标设备,此过程还会在您的账户中创建或使用其他类型的 Amazon 资源(代码签名作业、Amazon IoT 流、Amazon S3 对象)。遇到任何错误都可能导致处理失败而不会创建 Amazon IoT 作业。在此故障排除部分,我们提供了有关如何检索失败详细信息的说明。

  1. 安装和配置 Amazon CLI

  2. 运行 aws configure 并输入以下信息。

    $ aws configure Amazon Access Key ID [None]: AccessID Amazon Secret Access Key [None]: AccessKey Default region name [None]: Region Default output format [None]: json

    有关更多信息,请参阅使用 aws configure 进行快速配置

  3. 运行:

    aws iot get-ota-update --ota-update-id ota_update_job_001

    其中 ota_update_job_001 是在创建时为 OTA 更新提供的 ID。

  4. 输出如下所示:

    { "otaUpdateInfo": { "otaUpdateId": "ota_update_job_001", "otaUpdateArn": "arn:aws:iot:region:account_id:otaupdate/ota_update_job_001", "creationDate": 1584646864.534, "lastModifiedDate": 1584646865.913, "targets": [ "arn:aws:iot:region:account_id:thing/thing_001" ], "protocols": [ "MQTT" ], "awsJobExecutionsRolloutConfig": {}, "awsJobPresignedUrlConfig": {}, "targetSelection": "SNAPSHOT", "otaUpdateFiles": [ { "fileName": "/12ds", "fileLocation": { "s3Location": { "bucket": "bucket_name", "key": "demo.bin", "version": "Z7X.TWSAS7JSi4rybc02nMdcE41W1tV3" } }, "codeSigning": { "startSigningJobParameter": { "signingProfileParameter": {}, "signingProfileName": "signing_profile_name", "destination": { "s3Destination": { "bucket": "bucket_name", "prefix": "SignedImages/" } } }, "customCodeSigning": {} } } ], "otaUpdateStatus": "CREATE_FAILED", "errorInfo": { "code": "AccessDeniedException", "message": "S3 object demo.bin not accessible. Please check your permissions (Service: AWSSigner; Status Code: 403; Error Code: AccessDeniedException; Request ID: 01d8e7a1-8c7c-4d85-9fd7-dcde975fdd2d)" } } }

    如果创建失败,则命令输出中的 otaUpdateStatus 字段将包含 CREATE_FAILED,而 errorInfo 字段将包含失败的详细信息。