IoT Fleet Provisioning

June 28, 2026 · View on GitHub

AWS IoT fleet provisioning lets you register large numbers of devices from a shared provisioning template. osls wires a Lambda function as the template's pre-provisioning hook, which AWS invokes to validate each device before it is provisioned. See the AWS IoT fleet provisioning documentation.

Simple event definition

This will create an IoT Provisioning Template with a pre-provision hook lambda. Both templateBody and provisioningRoleArn are required fields.

functions:
  smartHomeValidation:
    handler: smartHomeValidation.handler
    events:
      - iotFleetProvisioning:
          templateBody: ${file(template.json)}
          provisioningRoleArn: arn:aws:iam::12345678910:role/provisioning-role

Example of template.json file

Enabling / Disabling

Note: IoT templates provisioned via iotFleetProvisioning events are enabled by default.

This will disable the template.

functions:
  smartHomeValidation:
    handler: smartHomeValidation.handler
    events:
      - iotFleetProvisioning:
          templateBody: ${file(template.json)}
          provisioningRoleArn: arn:aws:iam::12345678910:role/provisioning-role
          enabled: false

Specify a template name

Created template name can be enforced using the templateName property.

functions:
  smartHomeValidation:
    handler: smartHomeValidation.handler
    events:
      - iotFleetProvisioning:
          templateName: SmartBulbTemplate
          templateBody: ${file(template.json)}
          provisioningRoleArn: arn:aws:iam::12345678910:role/provisioning-role

← All Events · Docs Home