基本任务策略示例 - Amazon IoT Core
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 Amazon Web Services 服务入门

基本任务策略示例

此示例说明了任务目标所需的策略状态,任务目标是接收任务请求并与 Amazon IoT 通信任务执行状态的单个设备。

us-west-2:57EXAMPLE833 替换为您的 Amazon Web Services 区域、冒号字符 (:) 和 12 位数字 Amazon Web Services 账户 编号,然后将 uniqueThingName 替换为表示 Amazon IoT 中设备的事物资源名称。

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iot:Connect" ], "Resource": [ "arn:aws:iot:us-west-2:57EXAMPLE833:client/uniqueThingName" ] }, { "Effect": "Allow", "Action": [ "iot:Publish" ], "Resource": [ "arn:aws:iot:us-west-2:57EXAMPLE833:topic/test/dc/pubtopic", "arn:aws:iot:us-west-2:57EXAMPLE833:topic/$aws/events/job/*", "arn:aws:iot:us-west-2:57EXAMPLE833:topic/$aws/events/jobExecution/*", "arn:aws:iot:us-west-2:57EXAMPLE833:topic/$aws/things/uniqueThingName/jobs/*" ] }, { "Effect": "Allow", "Action": [ "iot:Subscribe" ], "Resource": [ "arn:aws:iot:us-west-2:57EXAMPLE833:topicfilter/test/dc/subtopic", "arn:aws:iot:us-west-2:57EXAMPLE833:topic/$aws/events/jobExecution/*", "arn:aws:iot:us-west-2:57EXAMPLE833:topicfilter/$aws/things/uniqueThingName/jobs/*" ] }, { "Effect": "Allow", "Action": [ "iot:Receive" ], "Resource": [ "arn:aws:iot:us-west-2:57EXAMPLE833:topic/test/dc/subtopic", "arn:aws:iot:us-west-2:57EXAMPLE833:topic/$aws/things/uniqueThingName/jobs/*" ] }, { "Effect": "Allow", "Action": [ "iot:DescribeJobExecution", "iot:GetPendingJobExecutions", "iot:StartNextPendingJobExecution", "iot:UpdateJobExecution" ], "Resource": [ "arn:aws:iot:us-west-2:57EXAMPLE833:topic/$aws/things/uniqueThingName" ] } ] }