Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Thing policy examples

Focus mode
Thing policy examples - AWS IoT Core

The following policy allows a device to connect if the certificate used to authenticate with AWS IoT Core is attached to the thing for which the policy is being evaluated:

{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":["iot:Connect"], "Resource":[ "*" ], "Condition": { "Bool": { "iot:Connection.Thing.IsAttached": ["true"] } } } ] }

The following policy allows a device to publish if the certificate is attached to a thing with a particular thing type and if the thing has an attribute of attributeName with value attributeValue. For more information about thing policy variables, see Thing policy variables.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iot:Publish" ], "Resource": "arn:aws:iot:us-east-1:123456789012:topic/device/stats", "Condition": { "StringEquals": { "iot:Connection.Thing.Attributes[attributeName]": "attributeValue", "iot:Connection.Thing.ThingTypeName": "Thing_Type_Name" }, "Bool": { "iot:Connection.Thing.IsAttached": "true" } } } ] }

The following policy allows a device to publish to a topic that starts with an attribute of the thing. If the device certificate is not associated with the thing, this variable won't be resolved and will result in an access denied error. For more information about thing policy variables, see Thing policy variables.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iot:Publish" ], "Resource": "arn:aws:iot:us-east-1:123456789012:topic/${iot:Connection.Thing.Attributes[attributeName]}/*" } ] }
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.