Skip to content

Exchanging AWS Cognito token to get AWS temporary credentials for publishing to AWS IoT Core MQTT topic #2533

Discussion options

You must be logged in to vote

Hi Ashish,

I figured out the root cause. For IoT specifically, Cognito identities will need to be given permissions (RBAC) via IoT Policies.
Solution:

  1. Create your thing
  2. Create a policy with the required iot permissions. I used iot:publish to the required topics and iot:connect to the above thing.
  3. Use AWS CLI to attach the above policy with the Cognito Identity principal, using:
    aws iot attach-principal-policy --principal --policy-name "" --region
  4. You should now see the cognito identity IDs listed under targets of the above created policy, along with your thing certificate - that was also created above

Kind regards,
Vijay

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Vijay-Karthick
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. credentials
2 participants