I’ve implemented shell scripts to create Rules and Policies you’re likely to need when using AWS Iot, as well as sample JSON files containing the same. You can get these here
There’s three AWS IoT concepts to know about:
“Rules” are added add to the Message Broker to decide what to do with messages coming in from your Things. You can filter on “topics” and the contents of the message received.
Rules are given permission to do things by “Roles”. You have to associate a Role with a Rule if you want the Rule to do anything.
Here’s the complicated bit. Roles don’t actually hold the permissions. Instead, you create “Policies” and add them to the Roles. The Policies actually determine what the Role, and hence the Rule can do.
So there’s a level of indirection in there provided by Roles, which basically acts as a bucket of Policies.
See more here: