Preparing AWS IoT Jobs - AWS IoT Core

Preparing AWS IoT Jobs

AWS IoT Device Management Software Package Catalog extends AWS IoT Jobs through substitution parameters, and integration with AWS IoT fleet indexing, dynamic thing groups, and the AWS IoT thing’s reserved named shadow.


To use all the functionality that Software Package Catalog offers, you must create these AWS Identity and Access Management (IAM) roles and policies: AWS IoT Jobs rights to deploy package versions and AWS IoT Jobs rights to update the reserved named shadow. For more information, see Preparing security.

Substitution parameters for AWS IoT jobs

You can use substitution parameters as a placeholder within your AWS IoT job document. When the job service encounters a substitution parameter, it points the job to a named software version’s attribute for the parameter value. You can use this process to create a single job document and pass the metadata into the job through general-purpose attributes. For example, you might pass an Amazon Simple Storage Service(Amazon S3) URL, a software package Amazon Resource Name (ARN), or a signature into the job document through package version attributes.

The substitution parameter should be formatted in the job document as follows:


In this example, there is a software package named, samplePackage, and it has a package version named 2.1.5 that has the following attributes:

  • name: s3URL, value:

    • This attribute identifies the location of the code file that’s stored within Amazon S3.

  • name: signature, value: aaaaabbbbbcccccdddddeeeeefffffggggghhhhhiiiiijjjj

    • This attribute provides a code signature value that the device requires as a security measure. For more information, see Code Signing for jobs. Note: This attribute is an example and not required as part of Software Package Catalog or jobs.

For downloads, the job document parameter is written as follows:

{ "samplePackage": "${aws:iot:package:samplePackage1:version:2.1.5:attributes:s3URL}" }

For signature, the job document parameter is written as follows:

{ "samplePackage": "${aws:iot:package:samplePackage1:version:2.1.5:attributes:signature}" }

The complete job document is written as follows:

{ ... "Steps": { "uninstall": ["samplePackage"], "download": [ { "samplePackage": "${aws:iot:package:samplePackage1:version:2.1.5:attributes:s3URL}" }, ], "signature": [ "samplePackage" : "${aws:iot:package:samplePackage1:version:2.1.5:attributes:signature}" ] } }

After the substitution is made, the following job document is deployed to the devices:

{ ... "Steps": { "uninstall": ["samplePackage"], "download": [ { "samplePackage": "" }, ], "signature": [ "samplePackage" : "aaaaabbbbbcccccdddddeeeeefffffggggghhhhhiiiiijjjj" ] } }

For more information about AWS IoT Jobs, creating job documents, and deploying jobs, see Jobs.

Preparing the job document and package version for deployment

When a package version is created, it’s in a draft state indicating that it’s being prepared for deployment. To complete this process, you must create a job document, save the document in a location that the job can access (such as Amazon S3), confirm that the package version has the attribute values that you want the job document to use, and publish the package version.

Transitioning the package version to published

When you have the job document complete and you're ready to deploy, review your package version and its attributes to ensure that any information you pass to the job is included and accurate. You can update attributes for a package version while it’s in the draft state.

When you have reviewed the package version and are satisfied with its configuration, transition it to published either through the software package details page in the AWS IoT console, or by issuing the UpdatePackageVersion API operation.

Naming the packages and versions when deploying

When you deploy an AWS IoT job, you must name the same software packages and package versions that are named in the job document in the job deployment (destinationPackageVersions). If you don’t, you'll receive an error message stating the missing package versions.

You can include additional software packages and package versions that aren't included within the job document. If you do this, the job doesn't provide instructions to the device about what to do with those files and the device is expected to know what to do. For example, you might send additional files to the device if they contain data that the device might reference.

Targeting jobs through AWS IoT dynamic thing groups

Software Package Catalog works with fleet indexing, AWS IoT jobs, and AWS IoT dynamic thing groups to filter and target devices within your fleet to select which package version to deploy to your devices. You can run a fleet indexing query based on your device's current package information and target those things for an AWS IoT job. You can also release software updates, but only to eligible target devices. For example, you can specify that you want to deploy a configuration only to those devices that currently run the iot-device-client v1.5.09. For more information, see Create a dynamic thing group.

Reserved named shadow and package versions

If configured, AWS IoT Jobs can update a thing’s reserved named shadow when the job successfully completes. If you do so, you don’t need to manually associate a package version to a thing’s reserved named shadow.

You might choose to manually associate or update a package version to the thing’s reserved named shadow in the following situations:

  • You register a thing to AWS IoT Core without associating the installed package version.

  • AWS IoT Jobs isn’t configured to update the thing’s reserved named shadow.

  • You use an in-house process to dispatch package versions to your fleet and that process doesn’t update AWS IoT Core when it completes.


Associating a package version to an AWS IoT thing doesn’t directly update the device software. You must deploy the package version to the device to update the device software.

You can add or update a package version to a thing’s reserved named shadow ($package) through the console or the UpdateThingShadow API operation. For more information, see Associating a package version to an AWS IoT thing.