本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
使用 取得 CreateOTAUpdate 失敗詳細資訊 AWS CLI
如果建立 OTA 更新任務的程序失敗,您可能會採取一些動作來修正問題。當您建立 OTA 更新任務時,OTA 管理員服務會建立 IoT 任務並為目標裝置排程,而且此程序也會在您的帳戶中建立或使用其他類型的 AWS 資源 (程式碼簽署任務、 AWS IoT 串流、Amazon S3 物件)。遇到的任何錯誤都可能導致程序失敗,而無需建立 AWS IoT 任務。在此故障診斷區段中,我們會提供如何擷取失敗詳細資訊的說明。
-
安裝及設定 AWS CLI。
-
執行
aws configure並輸入下列資訊。$aws configure AWS Access Key ID [None]:AccessIDAWS Secret Access Key [None]:AccessKeyDefault region name [None]:RegionDefault output format [None]: json如需詳細資訊,請參閱使用 的快速組態
aws configure。 -
執行:
aws iot get-ota-update --ota-update-idota_update_job_001其中
ota_update_job_001是您在建立 OTA 更新時提供的 ID。 -
輸出看起來像這樣:
{ "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欄位將包含失敗的詳細資訊。