Using retries, scheduling and package versions with AWS IoT OTA updates

4 minute read
Content level: Expert
1

Does your IoT device use AWS IoT OTA to manage software or firmware updates? Do you want to use advanced job features such as automated retry, scheduled jobs, recurring maintenance windows and Software Package Catalog? This article explains two approaches you can take to enrich your OTA updates with these advanced features.

Introduction

AWS IoT OTA update is a feature built on top of AWS IoT Jobs. AWS IoT Jobs offer some advanced job configuration features that are not yet directly supported by AWS IoT OTA updates, such as automated retries, job scheduling, recurring maintenance windows and Software Package Catalog versions. You can enrich your AWS IoT OTA updates with these features, using the following two methods:

  1. Custom job composition
  2. Job templates

The main advantage of the job templates method is that it's a procedure that you can follow in either the console, or with the AWS CLI, without needing to develop any code. By contrast, the custom job composition method is a programmatic solution.

Custom job composition

An AWS IoT OTA update is created using the CreateOTAUpdate API operation. This operation is used by the AWS IoT console, the AWS CLI and the AWS SDKs (such as boto3) to create an OTA update job. Depending on the parameters you pass, CreateOTAUpdate may in turn call:

The aws-samples/aws-iot-create-ota-update-deconstructed GitHub repository demonstrates how you can make these calls to compose an OTA update yourself, but also access the retry configuration, scheduling configuration, maintenance windows configuration and the Software Package Catalog versions that are exposed by the CreateJob operation.

Job templates

AWS IoT job templates allow you to preconfigure your jobs. You can create a custom job template as an original template or create it from an existing job. You can use job templates in a three step procedure to create an OTA job that is enriched with advanced job configurations:

  1. Create your OTA update in the normal way.
  2. Create a job template from your OTA update job.
  3. Create a new job from your job template.

At steps 2 and 3, you can enrich the job template or the new job with advanced job configurations. These steps can be performed using the console or the AWS CLI, and the console method is outlined below.

Step 1: Create your OTA update job

Firstly, you need a dummy thing registered in the IoT Core registry, or you need a device that you know is offline. You can then create your desired OTA Update job in the normal way, but targeting the dummy or inactive thing, as shown in Figure 1. We create this job, purely to have a job from which to create a template.

Figure 1: Create your OTA Update job

Figure 1: Create your OTA Update job

Step 2: Create your job template from your OTA update job

You can then cancel the dummy job and create a job template from it, as show in Figure 2.

Figure 2: Create your job template from your OTA update job

Figure 2: Create your job template from your OTA update job

As per Figure 3, when creating the template you can already enrich it with advanced job configuration options.

Figure 3: Enriching your job template

Figure 3: Enriching your job template

Step 3: Create a new job from your job template

Using the template, you can create a new job as shown in Figure 4.

Figure 4: Create a new job from your job template

Figure 4: Create a new job from your job template

You can then add package versions, as highlighted in Figure 5.

Figure 5: Enriching your job with package versions

Figure 5: Enriching your job with package versions

And finally, you can further modify or enrich the advanced job configuration before completing the job creation, as seen in Figure 6.

Figure 6: Enriching your job with scheduling and retries

Figure 6: Enriching your job with scheduling and retries

Related questions

profile pictureAWS
EXPERT
Greg_B
published 7 months ago909 views