Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

aws iot thing policy variable is not working in IAM role #42

Closed
ffoysal opened this issue Mar 3, 2021 · 2 comments
Closed

aws iot thing policy variable is not working in IAM role #42

ffoysal opened this issue Mar 3, 2021 · 2 comments

Comments

@ffoysal
Copy link

ffoysal commented Mar 3, 2021

trying to connection mqtt over websocket. using golang paho mqtt library.
The following policy in IAM role not working

        {
            "Effect": "Allow",
            "Action": [
                "iot:Publish"
            ],
            "Resource": [
                "arn:aws:iot:<REGION>:*******:topic/$aws/things/${iot:Connection.Thing.ThingName}/jobs/start-next",
                "arn:aws:iot:<REGION>:*******:topic/$aws/things/${iot:Connection.Thing.ThingName}/jobs/*/update"
            ]
        }

but this policy works

        {
            "Effect": "Allow",
            "Action": [
                "iot:Publish"
            ],
            "Resource": [
                "arn:aws:iot:<REGION>:*******:topic/$aws/things/${iot:ClientId}/jobs/start-next",
                "arn:aws:iot:<REGION>:*******:topic/$aws/things/${iot:ClientId}/jobs/*/update"
            ]
        }

Those are not Iot core policy, those are IAM policy. these policies are attached to a role which has trusted relationship with credentials.iot.amazonaws.com to assume role.
Help is very much appreciated.

@tivaliy
Copy link
Contributor

tivaliy commented Apr 5, 2021

Not sure that this is the exact place for such type of Issues/Questions.

But anyway can you double check that client IDs are registered thing's name in the AWS IoT Core service. Because iot:Connection.Thing.ThingName is a useful thing policy variable to enforce client ID restrictions require a registered thing's name to be used as the client ID for MQTT connections to the AWS IoT message broker.

@gausekha
Copy link
Contributor

Closing this issue as it doesn't look like there is action needed from the documentation side.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants