## Serverless Framework

# [IoT Fleet Provisioning](/content/framework/docs/providers/aws/events/iot-fleet-provisioning#iot-fleet-provisioning/index.html)

## [Simple event definition](/content/framework/docs/providers/aws/events/iot-fleet-provisioning#simple-event-definition/index.html)

This will create an [IoT Provisioning Template](https://docs.aws.amazon.com/iot/latest/developerguide/provision-template.html) with a [pre-provision hook](https://docs.aws.amazon.com/iot/latest/developerguide/pre-provisioning-hook.html) lambda. Both `templateBody` and `provisioningRoleArn` are required fields.

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

[Example of template.json file](https://docs.amazonaws.cn/en_us/iot/latest/developerguide/provision-template.html#bulk-template-example)

## [Enabling / Disabling](/content/framework/docs/providers/aws/events/iot-fleet-provisioning#enabling--disabling/index.html)

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

This will disable the template.

```yml
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](/content/framework/docs/providers/aws/events/iot-fleet-provisioning#specify-a-template-name/index.html)

Created template name can be enforced using the `templateName` property.

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