Certificate policy examples
For devices registered in AWS IoT Core registry, the following policy grants
                    permission to connect to AWS IoT Core with a client ID that matches a thing name,
                    and to publish to a topic whose name is equal to the certificateId
                    of the certificate the device used to authenticate itself:
For devices not registered in the AWS IoT Core registry, the following policy
                    grants permission to connect to AWS IoT Core with client IDs, client1,
                        client2, and client3 and to publish to a topic
                    whose name is equal to the certificateId of the certificate the
                    device used to authenticate itself:
For devices registered in AWS IoT Core registry, the following policy grants
                    permission to connect to AWS IoT Core with a client ID that matches the thing name,
                    and to publish to a topic whose name is equal to the subject's
                        CommonName field of the certificate the device used to
                    authenticate itself:
Note
In this example, the certificate's subject common name is used as the topic identifier, with the assumption that the subject common name is unique for each registered certificate. If the certificates are shared across multiple devices, the subject common name is the same for all the devices that share this certificate, thereby allowing publish privileges to the same topic from multiple devices (not recommended).
For devices not registered in AWS IoT Core registry, the following policy grants
                    permission to connect to AWS IoT Core with client IDs, client1,
                        client2, and client3 and to publish to a topic
                    whose name is equal to the subject's CommonName field of the
                    certificate the device used to authenticate itself:
Note
In this example, the certificate's subject common name is used as the topic identifier, with the assumption that the subject common name is unique for each registered certificate. If the certificates are shared across multiple devices, the subject common name is the same for all the devices that share this certificate, thereby allowing publish privileges to the same topic from multiple devices (not recommended).
For devices registered in the AWS IoT Core registry, the following policy grants
                    permission to connect to AWS IoT Core with a client ID that matches the thing name,
                    and to publish to a topic whose name is prefixed with admin/ when
                    the certificate used to authenticate the device has its
                        Subject.CommonName.2 field set to
                    Administrator:
For devices not registered in AWS IoT Core registry, the following policy grants
                    permission to connect to AWS IoT Core with client IDs client1,
                        client2, and client3 and to publish to a topic
                    whose name is prefixed with admin/ when the certificate used to
                    authenticate the device has its Subject.CommonName.2 field set to
                        Administrator:
For devices registered in AWS IoT Core registry, the following policy allows a
                    device to use its thing name to publish on a specific topic that consists of
                        admin/ followed by the ThingName when the
                    certificate used to authenticate the device has any one of its
                        Subject.CommonName fields set to
                    Administrator:
For devices not registered in AWS IoT Core registry, the following policy grants
                    permission to connect to AWS IoT Core with client IDs client1,
                        client2, and client3 and to publish to the topic
                        admin when the certificate used to authenticate the device has
                    any one of its Subject.CommonName fields set to
                        Administrator: