1 Answer
- Newest
- Most votes
- Most comments
2
Hi Giuseppe. OTA updates, as distinct from jobs, don't currently support retries out of the box. There are ways you can still access the feature however. The following article explains the problem and two solutions: https://repost.aws/articles/AR0K6J8BJtSm6PQFNDaI2xRw/using-retries-scheduling-and-package-versions-with-aws-iot-ota-updates.
Relevant content
asked 3 years ago
asked 6 years ago
asked 4 years ago
- AWS OFFICIALUpdated 2 months ago

Hi @Greg_B while I have successfully been using your trick to add the retries to the FreeRTOS OTA jobs, I periodically have the situation that a device hits the maximum of 10 retries. Is there a way to increase that number, or at least to log an event to cloudwatch when this happens? I have been trying to add a Message Routing->Rules with the filter "SELECT * FROM '$aws/events/jobExecution/+'" after advise from Google Gemini but got no events out of it.
Hi. You should get a job execution terminal status message: https://docs.aws.amazon.com/iot/latest/developerguide/events-jobs.html. But you first need to enable
JOB_EXECUTIONevents: https://docs.aws.amazon.com/iot/latest/developerguide/iot-events.html#iot-events-enable. If your job target is a dynamic group, you could use this event to remove the failed device from the group, and then re-add it. This will create a new job execution, with up to 10 new retries.Are your 10 retries all timeouts, or are there failures? If failures, what's the cause?
Hi Greg, many thanks I missed the part where I have to enable those events, I can see the events now! To answer your question, our OTA is upgrading a Yocto Linux, the download can take a long time and it happens in the background, so for a slow internet connection the user can power cycle multiple times before completion, each time the OTA declares a fail and restarts(resumes) the download. Our job is a dynamic group, the tip of removing and adding again the thing would be gold for us, but I am still failing to identify the number of retries in the failed job execution to isolate the 10th failed retry. I subscribed to $aws/events/jobExecution/# in the console test MQTT but I cannot find executionNumber which I would be looking at (Google Gemini pointed me to it). Other fields I see: {"eventType": "JOB_EXECUTION","operation": "failed","status": "FAILED","statusDetails": {"reason": "rejected: 0x00000010"}}.
The OTA suspend/resume functionality is designed for this purpose, so that you don't get a failure from the interruption: https://www.freertos.org/Documentation/03-Libraries/07-Modular-over-the-air-updates/02-Demos/02-mqtt-ota-agent-orchestrator.
You might have to call DescribeJobExecution: https://docs.aws.amazon.com/iot/latest/apireference/API_DescribeJobExecution.html
Thanks you so much @Greg_B much appreciated