Auto Provisioning Basics

Auto Provisioning is the ability of Foundry to automatically create a Foundry record whenever an MQTT message is sent to a specific topic for the first time. Foundry uses a combination of AWS IoT, AWS Kinesis, AWS Lamba, and AWS DynamoDB behind the scenes so you never have to worry about manually creating a new object every time you want to add a new object or device to Foundry.

To create an Auto Provisioning rule you will need at most five things, but most of the time you will only :

  • Device Type: If you have not already you will need to create a Foundry Device Type. This will be the model for the object you are trying to create. For more on creating Device Types click here.
  • Topic: This will be MQTT Topic your messages are coming in on.
  • Group: Having a Group is not required, but if you would like all your newly created devices to be added to a specific Foundry group you will need to create one. For more on creating Foundry Groups click here.
  • Attribute Name - This is the name (json_name) of that attribute that foundry will use to determine if a record already exists. For most Auto Provisioning rules you'll be using the mqtt_topic. More complex attribute names can be used too. For example, you can use the key "email_address".
  • Attribute Value - This is the value that Foundry will use for its query to determine if a record already exists. For most Auto Provisioning rules you'll be using the topic(). Working off the example above if an incoming payload has an attribute called "email_address" the Auto Provisioning rule will see if an Object with that email address already exists in Foundry.

Creating Your First Auto Provisioning Rule

Navigate to Object Type -> Auto Provision Tab and click the "Add New Rule" button

  1. Name - a User Friendly Name for the Rule
  2. MQTT Topic - this is the topic that Foundry will listen on for new records of THIS (i.e. the object type that you are currently editing). The Topic should only contain domain and/or a category and end with a # so that any record that is published on that topic will get created

This will result in a new record being creating in Foundry any time a UNIQUE Topic is published

In the Advanced section you will be able add the following information:

  1. Attribute Name - If you do NOT want to use the MQTT Topic as the unique identifier, then you could add the Object Attribute in Foundry that you want to use as the Unique Identifier, e.g. MacAddress, Serial Number, etc.
  2. Attribute Value - this is the JSON name in the payload that would hold the Unique Identifier, and would be used to check to see if a record already exists.
  3. Account - is the Foundry Account you want to use for the Rule... 
  4. Group - is the name of a Group that you might want to put Newly created objects

Examples - Unique MQTT topics

I have a bunch of devices that are chirping on data on the topic "com.rastovich/family/#" and I want to create a new object of type "Customer" every time data is chirped on a topic Foundry has not seen.

In the following example, this is way to have Foundry Use (as it's unique identifier) a value that you send in the payload