Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS IoT Core topic filter wildcards

According to the docs wildcard characters we use for topics throughout the mqtt protocol like + or # are treated as literals in policies. The docs recomend using * as a wildcard character instead but do not describe its effects.

For example will the topic filter :topicfilter:/foo/bar/* match topic foo/bar/baz/gaz or only foo/bar/baz?

Specifically I am trying to allow access to any topic which begins with the thing name of the policy holder. So I would like to allow access to any topic beginning with ${thingName}/ and having any number of forward slashes and url parameters following a matching thingName. Would topicfilter:${thingName}/* work or would that only work for topics with one url parameter after thingName?

like image 574
Zachscs Avatar asked Sep 07 '25 11:09

Zachscs


1 Answers

Turns out the wildcard * is a catch all i.e. it will match unlimited trailing url parameters. An important thing to keep in mind is that topicfilter and topic are different and are different resources for different MQTT actions as outlined here.

like image 165
Zachscs Avatar answered Sep 09 '25 16:09

Zachscs