本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
基本任務政策範例
此範例展示任務目標所需的政策陳述式,該目標為單一裝置,可接收任務請求並與 AWS IoT溝通任務執行狀態。
Replace (取代) us-west-2:57EXAMPLE833
使用 AWS 區域、冒號字元 (:) 和 12 位數字 AWS 帳戶 ,然後取代 uniqueThingName
在 中使用代表裝置之物件資源的名稱 AWS 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
:topicfilter/$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": [ "iotjobsdata:DescribeJobExecution", "iotjobsdata:GetPendingJobExecutions", "iotjobsdata:StartNextPendingJobExecution", "iotjobsdata:UpdateJobExecution" ], "Resource": [ "arn:aws:iot:us-west-2:57EXAMPLE833
:topic/$aws/things/uniqueThingName
" ] } ] }