Skip to content

Custom policy

An AWS device has permissions to publish and subscribe to any topic prefixed with its groupId by default. i.e {groupId}/* where,

  • {groupId} is the unique identifier of a group
  • can be any number of strings separated by slashes

For example, {groupId}/gps, **{groupId}/commands**, **{groupId}/device/location** etc.

To change the default behavior of a device, you can create a custom policy.

A custom policy comprises publish and subscribe topics prefixed with groupId. It can be attached to a device to restrict the access to the topics a device can publish and subscribe to.

For example, if a device has to publish only to the topic {groupId}/gps and subscribe only to the topic {groupId}/ping/location, then custom policy should be defined as below.

"topics": {
    "publish": [
      "995d37c7-0f07-4414-8760-79388927c222/gps"
    ],
    "subscribe": [
      "995d37c7-0f07-4414-8760-79388927c222/ping/location"
    ]
  }