Skip to content

Instantly share code, notes, and snippets.

@dpjanes
Created March 24, 2016 15:20
Show Gist options
  • Save dpjanes/80aa89b6dadae75c7d79 to your computer and use it in GitHub Desktop.
Save dpjanes/80aa89b6dadae75c7d79 to your computer and use it in GitHub Desktop.
Why won't this AWS IoT Policy Work?
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iot:Connect"
],
"Resource": [
"*"
]
},
{
"Effect": "Allow",
"Action": [
"iot:Publish",
"iot:Subscribe"
],
"Resource": [
"arn:aws:iot:us-east-1:896348747311:topic/iotdb/homestar/867ed8c6-710a-421c-90db-cd9ba6c30f27",
"arn:aws:iot:us-east-1:896348747311:topicfilter/iotdb/homestar/867ed8c6-710a-421c-90db-cd9ba6c30f27/*"
]
}
]
}
@dpjanes
Copy link
Author

dpjanes commented Mar 24, 2016

I can successfully connect to AWS using this Policy, but I cannot Publish with MQTT to the following topic

iotdb/homestar/867ed8c6-710a-421c-90db-cd9ba6c30f27/urn:iotdb:thing:SmartThings:0fc60c38-65f0-43fe-a17b-aa00829d80a1:motion:smart-things-motion/meta

Note that if I attach a highly permissive Policy (iot:*, resource *) it works fine.

@dpjanes
Copy link
Author

dpjanes commented Mar 26, 2016

The issue is you can't publish using a topicfilter. Here's the working solution
https://gist.github.com/dpjanes/c884baa64b52c3b74f22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment