Skip to content

Instantly share code, notes, and snippets.

@pveller
pveller / pubsub.js
Last active August 23, 2022 07:41
AWS Amplify PubSub with IoT and Cognito
/*
In order to subscribe to the AWS IoT topic over WS (over MQQT),
you have to make sure that your Cognito identity has a proper IoT policy attached to it.
More details and the message from the official AWS support:
https://github.com/aws/aws-amplify/issues/749
This code shows how you can dynamically attach a policy to the authenticated identity.
Make sure that your Authenticated IAM in the Cognito User Pool has proper IoT permissions.