This CloudFormation template attaches a policy to a principal in AWS IoT, allowing the principal to access and perform actions on IoT resources.

CloudFormation Template