Get OTA failure codes with the Amazon CLI
-
Install and configure the Amazon CLI.
-
Run
aws configureand enter following information.$aws configure Amazon Access Key ID [None]:AccessIDAmazon Secret Access Key [None]:AccessKeyDefault region name [None]:RegionDefault output format [None]: jsonFor more information, see Quick configuration with
aws configure. -
Run:
aws iot describe-job-execution --job-idJobID--thing-nameThingNameWhere
JobIDis the complete job ID string for the job whose status we want to get (it was associated with the OTA update job when it was created) andThingNameis the Amazon IoT thing name that the device is registered as in Amazon IoT -
The output will look like this:
{ "execution": { "jobId": "AFR_OTA-****************", "status": "FAILED", "statusDetails": { "detailsMap": { "reason": "0xEEEEEEEE: 0xffffffff" } }, "thingArn": "arn:aws-cn:iot:Region:AccountID:thing/ThingName", "queuedAt": 1569519049.9, "startedAt": 1569519052.226, "lastUpdatedAt": 1569519052.226, "executionNumber": 1, "versionNumber": 2 } }In this example output, the "
reason" in the "detailsmap" has two fields: the field shown as "0xEEEEEEEE" contains the generic error code from the OTA Agent; the field shown as "0xffffffff" contains the sub-code. The generic error codes are listed in https://docs.amazonaws.cn/freertos/latest/lib-ref/html1/aws__ota__agent_8h.html. See error codes with the prefix "kOTA_Err_". The sub-code can be a platform specific code or provide more details about the generic error.