Amazon IoT 如何与 IAM 协同工作 - Amazon IoT Core
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 Amazon Web Services 服务入门

Amazon IoT 如何与 IAM 协同工作

在使用 IAM 管理对 Amazon IoT 的访问之前,您应了解哪些 IAM 功能可与 Amazon IoT 结合使用。要大致了解 Amazon IoT 和其他Amazon服务如何与 IAM 一起使用,请参阅 IAM 用户指南中的与 IAM 一起使用的Amazon服务

Amazon IoT 基于身份的策略

使用 IAM 基于身份的策略,您可以指定允许或拒绝的操作和资源,以及指定在什么条件下允许或拒绝操作。Amazon IoT 支持特定操作、资源和条件键。要了解在 JSON 策略中使用的所有元素,请参阅 IAM 用户指南 中的 IAM JSON 策略元素参考

Actions

管理员可以使用 Amazon JSON 策略来指定谁有权访问什么内容。也就是说,哪个委托人 可以对什么资源 执行操作,以及在什么 条件 下执行。

JSON 策略的 Action 元素描述可用于在策略中允许或拒绝访问的操作。策略操作通常与关联的 Amazon API 操作同名。有一些例外情况,例如没有匹配 API 操作的仅限权限 操作。还有一些操作需要在策略中执行多个操作。这些附加操作称为相关操作

在策略中包含操作以授予执行相关操作的权限。

下表列出了 IAM IoT 操作、关联的 Amazon IoT API 以及操作处理的资源。

策略操作 Amazon IoT API 资源
iot:AcceptCertificateTransfer AcceptCertificateTransfer

arn:aws:iot:region:account-id:cert/cert-id

注意

ARN 中指定的 Amazon Web Services 账户 必须是证书将传输到的账户。

iot:AddThingToThingGroup AddThingToThingGroup

arn:aws:iot:region:account-id:thinggroup/thing-group-name

arn:aws:iot:region:account-id:thing/thing-name

iot:AssociateTargetsWithJob AssociateTargetsWithJob
iot:AttachPolicy AttachPolicy

arn:aws:iot:region:account-id:thinggroup/thing-group-name

arn:aws:iot:region:account-id:cert/cert-id

iot:AttachPrincipalPolicy AttachPrincipalPolicy

arn:aws:iot:region:account-id:cert/cert-id

iot:AttachSecurityProfile AttachSecurityProfile

arn:aws:iot:region:account-id:securityprofile/security-profile-name

arn:aws:iot:region:account-id:dimension/dimension-name

iot:AttachThingPrincipal AttachThingPrincipal

arn:aws:iot:region:account-id:cert/cert-id

iot:CancelCertificateTransfer CancelCertificateTransfer

arn:aws:iot:region:account-id:cert/cert-id

注意

ARN 中指定的 Amazon Web Services 账户 必须是证书将传输到的账户。

iot:CancelJob CancelJob

arn:aws:iot:region:account-id:job/job-id

iot:CancelJobExecution CancelJobExecution

arn:aws:iot:region:account-id:job/job-id

arn:aws:iot:region:account-id:thing/thing-name

iot:ClearDefaultAuthorizer ClearDefaultAuthorizer
iot:CreateAuthorizer CreateAuthorizer

arn:aws:iot:region:account-id:authorizer/authorizer-function-name

iot:CreateCertificateFromCsr CreateCertificateFromCsr *
iot:CreateDimension CreateDimension

arn:aws:iot:region:account-id:dimension/dimension-name

iot:CreateJob CreateJob

arn:aws:iot:region:account-id:job/job-id

arn:aws:iot:region:account-id:thinggroup/thing-group-name

arn:aws:iot:region:account-id:thing/thing-name

arn:aws:iot:region:account-id:jobtemplate/job-template-id

iot:CreateJobTemplate CreateJobTemplate

arn:aws:iot:region:account-id:job/job-id

arn:aws:iot:region:account-id:jobtemplate/job-template-id

iot:CreateKeysAndCertificate CreateKeysAndCertificate *
iot:CreatePolicy CreatePolicy *
iot:CreatePolicyVersion CreatePolicyVersion

arn:aws:iot:region:account-id:policy/policy-name

注意

这必须是 Amazon IoT 策略,而不是 IAM 策略。

iot:CreateRoleAlias CreateRoleAlias

(参数:roleAlias)

arn:aws:iot:region:account-id:rolealias/role-alias-name

iot:CreateSecurityProfile CreateSecurityProfile

arn:aws:iot:region:account-id:securityprofile/security-profile-name

arn:aws:iot:region:account-id:dimension/dimension-name

iot:CreateThing CreateThing

arn:aws:iot:region:account-id:thing/thing-name

iot:CreateThingGroup CreateThingGroup

arn:aws:iot:region:account-id:thinggroup/thing-group-name

针对要创建的组和父组 (如果使用)

iot:CreateThingType CreateThingType

arn:aws:iot:region:account-id:thingtype/thing-type-name

iot:CreateTopicRule CreateTopicRule

arn:aws:iot:region:account-id:rule/rule-name

iot:DeleteAuthorizer DeleteAuthorizer

arn:aws:iot:region:account-id:authorizer/authorizer-name

iot:DeleteCACertificate DeleteCACertificate

arn:aws:iot:region:account-id:cacert/cert-id

iot:DeleteCertificate DeleteCertificate

arn:aws:iot:region:account-id:cert/cert-id

iot:DeleteDimension DeleteDimension

arn:aws:iot:region:account-id:dimension/dimension-name

iot:DeleteJob DeleteJob

arn:aws:iot:region:account-id:job/job-id

iot:DeleteJobTemplate DeleteJobTemplate

arn:aws:iot:region:account-id:job/job-template-id

iot:DeleteJobExecution DeleteJobExecution

arn:aws:iot:region:account-id:job/job-id

arn:aws:iot:region:account-id:thing/thing-name

iot:DeletePolicy DeletePolicy

arn:aws:iot:region:account-id:policy/policy-name

iot:DeletePolicyVersion DeletePolicyVersion

arn:aws:iot:region:account-id:policy/policy-name

iot:DeleteRegistrationCode DeleteRegistrationCode *
iot:DeleteRoleAlias DeleteRoleAlias

arn:aws:iot:region:account-id:rolealias/role-alias-name

iot:DeleteSecurityProfile DeleteSecurityProfile

arn:aws:iot:region:account-id:securityprofile/security-profile-name

arn:aws:iot:region:account-id:dimension/dimension-name

iot:DeleteThing DeleteThing

arn:aws:iot:region:account-id:thing/thing-name

iot:DeleteThingGroup DeleteThingGroup

arn:aws:iot:region:account-id:thinggroup/thing-group-name

iot:DeleteThingType DeleteThingType

arn:aws:iot:region:account-id:thingtype/thing-type-name

iot:DeleteTopicRule DeleteTopicRule

arn:aws:iot:region:account-id:rule/rule-name

iot:DeleteV2LoggingLevel DeleteV2LoggingLevel

arn:aws:iot:region:account-id:thinggroup/thing-group-name

iot:DeprecateThingType DeprecateThingType

arn:aws:iot:region:account-id:thingtype/thing-type-name

iot:DescribeAuthorizer DescribeAuthorizer

arn:aws:iot:region:account-id:authorizer/authorizer-function-name

(参数:authorizerName)

iot:DescribeCACertificate DescribeCACertificate

arn:aws:iot:region:account-id:cacert/cert-id

iot:DescribeCertificate DescribeCertificate

arn:aws:iot:region:account-id:cert/cert-id

iot:DescribeDefaultAuthorizer DescribeDefaultAuthorizer
iot:DescribeEndpoint DescribeEndpoint *
iot:DescribeEventConfigurations DescribeEventConfigurations
iot:DescribeIndex DescribeIndex

arn:aws:iot:region:account-id:index/index-name

iot:DescribeJob DescribeJob

arn:aws:iot:region:account-id:job/job-id

iot:DescribeJobExecution DescribeJobExecution
iot:DescribeJobTemplate DescribeJobTemplate

arn:aws:iot:region:account-id:job/job-template-id

iot:DescribeRoleAlias DescribeRoleAlias

arn:aws:iot:region:account-id:rolealias/role-alias-name

iot:DescribeThing DescribeThing

arn:aws:iot:region:account-id:thing/thing-name

iot:DescribeThingGroup DescribeThingGroup

arn:aws:iot:region:account-id:thinggroup/thing-group-name

iot:DescribeThingRegistrationTask DescribeThingRegistrationTask
iot:DescribeThingType DescribeThingType

arn:aws:iot:region:account-id:thingtype/thing-type-name

iot:DetachPolicy DetachPolicy

arn:aws:iot:region:account-id:cert/cert-id

arn:aws:iot:region:account-id:thinggroup/thing-group-name

iot:DetachPrincipalPolicy DetachPrincipalPolicy

arn:aws:iot:region:account-id:cert/cert-id

iot:DetachSecurityProfile DetachSecurityProfile

arn:aws:iot:region:account-id:securityprofile/security-profile-name

arn:aws:iot:region:account-id:dimension/dimension-name

iot:DetachThingPrincipal DetachThingPrincipal

arn:aws:iot:region:account-id:cert/cert-id

iot:DisableTopicRule DisableTopicRule

arn:aws:iot:region:account-id:rule/rule-name

iot:EnableTopicRule EnableTopicRule

arn:aws:iot:region:account-id:rule/rule-name

iot:GetEffectivePolicies GetEffectivePolicies

arn:aws:iot:region:account-id:cert/cert-id

iot:GetIndexingConfiguration GetIndexingConfiguration
iot:GetJobDocument GetJobDocument

arn:aws:iot:region:account-id:job/job-id

iot:GetLoggingOptions GetLoggingOptions *
iot:GetPolicy GetPolicy

arn:aws:iot:region:account-id:policy/policy-name

iot:GetPolicyVersion GetPolicyVersion

arn:aws:iot:region:account-id:policy/policy-name

iot:GetRegistrationCode GetRegistrationCode *
iot:GetTopicRule GetTopicRule

arn:aws:iot:region:account-id:rule/rule-name

iot:ListAttachedPolicies ListAttachedPolicies

arn:aws:iot:region:account-id:thinggroup/thing-group-name

arn:aws:iot:region:account-id:cert/cert-id

iot:ListAuthorizers ListAuthorizers
iot:ListCACertificates ListCACertificates *
iot:ListCertificates ListCertificates *
iot:ListCertificatesByCA ListCertificatesByCA *
iot:ListIndices ListIndices
iot:ListJobExecutionsForJob ListJobExecutionsForJob
iot:ListJobExecutionsForThing ListJobExecutionsForThing
iot:ListJobs ListJobs

arn:aws:iot:region:account-id:thinggroup/thing-group-name

如果使用 thingGroupName 参数

iot:ListJobTemplates ListJobs
iot:ListOutgoingCertificates ListOutgoingCertificates *
iot:ListPolicies ListPolicies *
iot:ListPolicyPrincipals ListPolicyPrincipals

arn:aws:iot:region:account-id:policy/policy-name

iot:ListPolicyVersions ListPolicyVersions

arn:aws:iot:region:account-id:policy/policy-name

iot:ListPrincipalPolicies ListPrincipalPolicies

arn:aws:iot:region:account-id:cert/cert-id

iot:ListPrincipalThings ListPrincipalThings

arn:aws:iot:region:account-id:cert/cert-id

iot:ListRoleAliases ListRoleAliases
iot:ListTargetsForPolicy ListTargetsForPolicy

arn:aws:iot:region:account-id:policy/policy-name

iot:ListThingGroups ListThingGroups
iot:ListThingGroupsForThing ListThingGroupsForThing

arn:aws:iot:region:account-id:thing/thing-name

iot:ListThingPrincipals ListThingPrincipals

arn:aws:iot:region:account-id:thing/thing-name

iot:ListThingRegistrationTaskReports ListThingRegistrationTaskReports
iot:ListThingRegistrationTasks ListThingRegistrationTasks
iot:ListThingTypes ListThingTypes *
iot:ListThings ListThings *
iot:ListThingsInThingGroup ListThingsInThingGroup

arn:aws:iot:region:account-id:thinggroup/thing-group-name

iot:ListTopicRules ListTopicRules *
iot:ListV2LoggingLevels ListV2LoggingLevels
iot:RegisterCACertificate RegisterCACertificate *
iot:RegisterCertificate RegisterCertificate *
iot:RegisterThing RegisterThing
iot:RejectCertificateTransfer RejectCertificateTransfer

arn:aws:iot:region:account-id:cert/cert-id

iot:RemoveThingFromThingGroup RemoveThingFromThingGroup

arn:aws:iot:region:account-id:thinggroup/thing-group-name

arn:aws:iot:region:account-id:thing/thing-name

iot:ReplaceTopicRule ReplaceTopicRule

arn:aws:iot:region:account-id:rule/rule-name

iot:SearchIndex SearchIndex

arn:aws:iot:region:account-id:index/index-id

iot:SetDefaultAuthorizer SetDefaultAuthorizer

arn:aws:iot:region:account-id:authorizer/authorizer-function-name

iot:SetDefaultPolicyVersion SetDefaultPolicyVersion

arn:aws:iot:region:account-id:policy/policy-name

iot:SetLoggingOptions SetLoggingOptions

arn:aws:iot:region:account-id:role/role-name

iot:SetV2LoggingLevel SetV2LoggingLevel

arn:aws:iot:region:account-id:thinggroup/thing-group-name

iot:SetV2LoggingOptions SetV2LoggingOptions

arn:aws:iot:region:account-id:role/role-name

iot:StartThingRegistrationTask StartThingRegistrationTask
iot:StopThingRegistrationTask StopThingRegistrationTask
iot:TestAuthorization TestAuthorization

arn:aws:iot:region:account-id:cert/cert-id

iot:TestInvokeAuthorizer TestInvokeAuthorizer
iot:TransferCertificate TransferCertificate

arn:aws:iot:region:account-id:cert/cert-id

iot:UpdateAuthorizer UpdateAuthorizer

arn:aws:iot:region:account-id:authorizerfunction/authorizer-function-name

iot:UpdateCACertificate UpdateCACertificate

arn:aws:iot:region:account-id:cacert/cert-id

iot:UpdateCertificate UpdateCertificate

arn:aws:iot:region:account-id:cert/cert-id

iot:UpdateDimension UpdateDimension

arn:aws:iot:region:account-id:dimension/dimension-name

iot:UpdateEventConfigurations UpdateEventConfigurations
iot:UpdateIndexingConfiguration UpdateIndexingConfiguration
iot:UpdateRoleAlias UpdateRoleAlias

arn:aws:iot:region:account-id:rolealias/role-alias-name

iot:UpdateSecurityProfile UpdateSecurityProfile

arn:aws:iot:region:account-id:securityprofile/security-profile-name

arn:aws:iot:region:account-id:dimension/dimension-name

iot:UpdateThing UpdateThing

arn:aws:iot:region:account-id:thing/thing-name

iot:UpdateThingGroup UpdateThingGroup

arn:aws:iot:region:account-id:thinggroup/thing-group-name

iot:UpdateThingGroupsForThing UpdateThingGroupsForThing

arn:aws:iot:region:account-id:thing/thing-name

Amazon IoT 中的策略操作在操作前使用以下前缀:iot:。例如,要授予某人权限以使用 ListThings API 列出其 Amazon Web Services 账户 中已注册的所有 IoT 事物,请将 iot:ListThings 操作纳入其策略中。策略语句必须包括 ActionNotAction 元素。Amazon IoT 定义了自己的一组操作,这些操作描述了可使用该服务执行的任务。

要在单个语句中指定多项操作,请使用逗号将它们隔开,如下所示:

"Action": [ "ec2:action1", "ec2:action2"

您也可以使用通配符 (*) 指定多个操作。例如,要指定以单词 Describe 开头的所有操作,包括以下操作:

"Action": "iot:Describe*"

要查看 Amazon IoT 操作列表,请参阅 IAM 用户指南中的 Amazon IoT 定义的操作

Device Advisor 操作

下表列出了 IAM IoT Device Advisor 操作、关联的 Amazon IoT Device Advisor API 以及操作处理的资源。

策略操作 Amazon IoT API 资源
iotdeviceadvisor:CreateSuiteDefinition CreateSuiteDefinition

iotdeviceadvisor:DeleteSuiteDefinition DeleteSuiteDefinition

arn:aws:iotdeviceadvisor:region:account-id:suitedefinition/suite-definition-id

iotdeviceadvisor:GetSuiteDefinition GetSuiteDefinition

arn:aws:iotdeviceadvisor:region:account-id:suitedefinition/suite-definition-id

iotdeviceadvisor:GetSuiteRun GetSuiteRun

arn:aws:iotdeviceadvisor:region:account-id:suitedefinition/suite-run-id

iotdeviceadvisor:GetSuiteRunReport GetSuiteRunReport

arn:aws:iotdeviceadvisor:region:account-id:suiterun/suite-definition-id/suite-run-id

iotdeviceadvisor:ListSuiteDefinitions ListSuiteDefinitions
iotdeviceadvisor:ListSuiteRuns ListSuiteRuns

arn:aws:iotdeviceadvisor:region:account-id:suitedefinition/suite-definition-id

iotdeviceadvisor:ListTagsForResource ListTagsForResource

arn:aws:iotdeviceadvisor:region:account-id:suitedefinition/suite-definition-id

arn:aws:iotdeviceadvisor:region:account-id:suiterun/suite-definition-id/suite-run-id

iotdeviceadvisor:StartSuiteRun StartSuiteRun

arn:aws:iotdeviceadvisor:region:account-id:suitedefinition/suite-definition-id

iotdeviceadvisor:TagResource TagResource

arn:aws:iotdeviceadvisor:region:account-id:suitedefinition/suite-definition-id

arn:aws:iotdeviceadvisor:region:account-id:suiterun/suite-definition-id/suite-run-id

iotdeviceadvisor:UntagResource UntagResource

arn:aws:iotdeviceadvisor:region:account-id:suitedefinition/suite-definition-id

arn:aws:iotdeviceadvisor:region:account-id:suiterun/suite-definition-id/suite-run-id

iotdeviceadvisor:UpdateSuiteDefinition UpdateSuiteDefinition

arn:aws:iotdeviceadvisor:region:account-id:suitedefinition/suite-definition-id

iotdeviceadvisor:StopSuiteRun StopSuiteRun

arn:aws:iotdeviceadvisor:region:account-id:suiterun/suite-definition-id/suite-run-id

Amazon IoT Device Advisor 中的策略操作在操作前使用以下前缀:iotdeviceadvisor:。例如,要授予某人权限以使用 ListSuiteDefinitions API 列出其 Amazon Web Services 账户 中已注册的所有套件定义,请将 iotdeviceadvisor:ListSuiteDefinitions 操作纳入其策略中。

Resources

管理员可以使用 Amazon JSON 策略来指定谁有权访问什么内容。也就是说,哪个委托人 可以对什么资源 执行操作,以及在什么 条件 下执行。

Resource JSON 策略元素指定要向其应用操作的一个或多个对象。语句必须包含 ResourceNotResource 元素。作为最佳实践,请使用其 Amazon Resource Name (ARN)指定资源。对于支持特定资源类型(称为资源级权限)的操作,您可以执行此操作。

对于不支持资源级权限的操作(如列出操作),请使用通配符 (*) 指示语句应用于所有资源。

"Resource": "*"
Amazon IoT 资源
策略操作 Amazon IoT API 资源
iot:AcceptCertificateTransfer AcceptCertificateTransfer

arn:aws:iot:region:account-id:cert/cert-id

注意

ARN 中指定的 Amazon Web Services 账户 必须是证书将传输到的账户。

iot:AddThingToThingGroup AddThingToThingGroup

arn:aws:iot:region:account-id:thinggroup/thing-group-name

arn:aws:iot:region:account-id:thing/thing-name

iot:AssociateTargetsWithJob AssociateTargetsWithJob
iot:AttachPolicy AttachPolicy

arn:aws:iot:region:account-id:thinggroup/thing-group-name

arn:aws:iot:region:account-id:cert/cert-id

iot:AttachPrincipalPolicy AttachPrincipalPolicy

arn:aws:iot:region:account-id:cert/cert-id

iot:AttachThingPrincipal AttachThingPrincipal

arn:aws:iot:region:account-id:cert/cert-id

iot:CancelCertificateTransfer CancelCertificateTransfer

arn:aws:iot:region:account-id:cert/cert-id

注意

ARN 中指定的 Amazon Web Services 账户 必须是证书将传输到的账户。

iot:CancelJob CancelJob

arn:aws:iot:region:account-id:job/job-id

iot:CancelJobExecution CancelJobExecution

arn:aws:iot:region:account-id:job/job-id

arn:aws:iot:region:account-id:thing/thing-name

iot:ClearDefaultAuthorizer ClearDefaultAuthorizer
iot:CreateAuthorizer CreateAuthorizer

arn:aws:iot:region:account-id:authorizer/authorizer-function-name

iot:CreateCertificateFromCsr CreateCertificateFromCsr *
iot:CreateJob CreateJob

arn:aws:iot:region:account-id:job/job-id

arn:aws:iot:region:account-id:thinggroup/thing-group-name

arn:aws:iot:region:account-id:thing/thing-name

arn:aws:iot:region:account-id:jobtemplate/job-template-id

iot:CreateJobTemplate CreateJobTemplate

arn:aws:iot:region:account-id:job/job-id

arn:aws:iot:region:account-id:jobtemplate/job-template-id

iot:CreateKeysAndCertificate CreateKeysAndCertificate *
iot:CreatePolicy CreatePolicy *
CreatePolicyVersion iot:CreatePolicyVersion

arn:aws:iot:region:account-id:policy/policy-name

注意

这必须是 Amazon IoT 策略,而不是 IAM 策略。

iot:CreateRoleAlias CreateRoleAlias

(参数:roleAlias)

arn:aws:iot:region:account-id:rolealias/role-alias-name

iot:CreateThing CreateThing

arn:aws:iot:region:account-id:thing/thing-name

iot:CreateThingGroup CreateThingGroup

arn:aws:iot:region:account-id:thinggroup/thing-group-name

针对要创建的组和父组 (如果使用)

iot:CreateThingType CreateThingType

arn:aws:iot:region:account-id:thingtype/thing-type-name

iot:CreateTopicRule CreateTopicRule

arn:aws:iot:region:account-id:rule/rule-name

iot:DeleteAuthorizer DeleteAuthorizer

arn:aws:iot:region:account-id:authorizer/authorizer-name

iot:DeleteCACertificate DeleteCACertificate

arn:aws:iot:region:account-id:cacert/cert-id

iot:DeleteCertificate DeleteCertificate

arn:aws:iot:region:account-id:cert/cert-id

iot:DeleteJob DeleteJob

arn:aws:iot:region:account-id:job/job-id

iot:DeleteJobExecution DeleteJobExecution

arn:aws:iot:region:account-id:job/job-id

arn:aws:iot:region:account-id:thing/thing-name

iot:DeleteJobTemplate DeleteJobTemplate

arn:aws:iot:region:account-id:jobtemplate/job-template-id

iot:DeletePolicy DeletePolicy

arn:aws:iot:region:account-id:policy/policy-name

iot:DeletePolicyVersion DeletePolicyVersion

arn:aws:iot:region:account-id:policy/policy-name

iot:DeleteRegistrationCode DeleteRegistrationCode *
iot:DeleteRoleAlias DeleteRoleAlias

arn:aws:iot:region:account-id:rolealias/role-alias-name

iot:DeleteThing DeleteThing

arn:aws:iot:region:account-id:thing/thing-name

iot:DeleteThingGroup DeleteThingGroup

arn:aws:iot:region:account-id:thinggroup/thing-group-name

iot:DeleteThingType DeleteThingType

arn:aws:iot:region:account-id:thingtype/thing-type-name

iot:DeleteTopicRule DeleteTopicRule

arn:aws:iot:region:account-id:rule/rule-name

iot:DeleteV2LoggingLevel DeleteV2LoggingLevel

arn:aws:iot:region:account-id:thinggroup/thing-group-name

iot:DeprecateThingType DeprecateThingType

arn:aws:iot:region:account-id:thingtype/thing-type-name

iot:DescribeAuthorizer DescribeAuthorizer

arn:aws:iot:region:account-id:authorizer/authorizer-function-name

(参数:authorizerName)

iot:DescribeCACertificate DescribeCACertificate

arn:aws:iot:region:account-id:cacert/cert-id

iot:DescribeCertificate DescribeCertificate

arn:aws:iot:region:account-id:cert/cert-id

iot:DescribeDefaultAuthorizer DescribeDefaultAuthorizer
iot:DescribeEndpoint DescribeEndpoint *
iot:DescribeEventConfigurations DescribeEventConfigurations
iot:DescribeIndex DescribeIndex

arn:aws:iot:region:account-id:index/index-name

iot:DescribeJob DescribeJob

arn:aws:iot:region:account-id:job/job-id

iot:DescribeJobExecution DescribeJobExecution
iot:DescribeJobTemplate DescribeJobTemplate

arn:aws:iot:region:account-id:jobtemplate/job-template-id

iot:DescribeRoleAlias DescribeRoleAlias

arn:aws:iot:region:account-id:rolealias/role-alias-name

iot:DescribeThing DescribeThing

arn:aws:iot:region:account-id:thing/thing-name

iot:DescribeThingGroup DescribeThingGroup

arn:aws:iot:region:account-id:thinggroup/thing-group-name

iot:DescribeThingRegistrationTask DescribeThingRegistrationTask
iot:DescribeThingType DescribeThingType

arn:aws:iot:region:account-id:thingtype/thing-type-name

iot:DetachPolicy DetachPolicy

arn:aws:iot:region:account-id:cert/cert-id

arn:aws:iot:region:account-id:thinggroup/thing-group-name

iot:DetachPrincipalPolicy DetachPrincipalPolicy

arn:aws:iot:region:account-id:cert/cert-id

iot:DetachThingPrincipal DetachThingPrincipal

arn:aws:iot:region:account-id:cert/cert-id

iot:DisableTopicRule DisableTopicRule

arn:aws:iot:region:account-id:rule/rule-name

iot:EnableTopicRule EnableTopicRule

arn:aws:iot:region:account-id:rule/rule-name

iot:GetEffectivePolicies GetEffectivePolicies

arn:aws:iot:region:account-id:cert/cert-id

iot:GetIndexingConfiguration GetIndexingConfiguration
iot:GetJobDocument GetJobDocument

arn:aws:iot:region:account-id:job/job-id

iot:GetLoggingOptions GetLoggingOptions *
iot:GetPolicy GetPolicy

arn:aws:iot:region:account-id:policy/policy-name

iot:GetPolicyVersion GetPolicyVersion

arn:aws:iot:region:account-id:policy/policy-name

iot:GetRegistrationCode GetRegistrationCode *
iot:GetTopicRule GetTopicRule

arn:aws:iot:region:account-id:rule/rule-name

iot:ListAttachedPolicies ListAttachedPolicies

arn:aws:iot:region:account-id:thinggroup/thing-group-name

arn:aws:iot:region:account-id:cert/cert-id

iot:ListAuthorizers ListAuthorizers
iot:ListCACertificates ListCACertificates *
iot:ListCertificates ListCertificates *
iot:ListCertificatesByCA ListCertificatesByCA *
iot:ListIndices ListIndices
iot:ListJobExecutionsForJob ListJobExecutionsForJob
iot:ListJobExecutionsForThing ListJobExecutionsForThing
iot:ListJobs ListJobs

arn:aws:iot:region:account-id:thinggroup/thing-group-name

如果使用 thingGroupName 参数

iot:ListJobTemplates ListJobTemplates
iot:ListOutgoingCertificates ListOutgoingCertificates *
iot:ListPolicies ListPolicies *
iot:ListPolicyPrincipals ListPolicyPrincipals

arn:aws:iot:region:account-id:policy/policy-name

iot:ListPolicyVersions ListPolicyVersions

arn:aws:iot:region:account-id:policy/policy-name

iot:ListPrincipalPolicies ListPrincipalPolicies

arn:aws:iot:region:account-id:cert/cert-id

iot:ListPrincipalThings ListPrincipalThings

arn:aws:iot:region:account-id:cert/cert-id

iot:ListRoleAliases ListRoleAliases
iot:ListTargetsForPolicy ListTargetsForPolicy

arn:aws:iot:region:account-id:policy/policy-name

iot:ListThingGroups ListThingGroups
iot:ListThingGroupsForThing ListThingGroupsForThing

arn:aws:iot:region:account-id:thing/thing-name

iot:ListThingPrincipals ListThingPrincipals

arn:aws:iot:region:account-id:thing/thing-name

iot:ListThingRegistrationTaskReports ListThingRegistrationTaskReports
iot:ListThingRegistrationTasks ListThingRegistrationTasks
iot:ListThingTypes ListThingTypes *
iot:ListThings ListThings *
iot:ListThingsInThingGroup ListThingsInThingGroup

arn:aws:iot:region:account-id:thinggroup/thing-group-name

iot:ListTopicRules ListTopicRules *
iot:ListV2LoggingLevels ListV2LoggingLevels
iot:RegisterCACertificate RegisterCACertificate *
iot:RegisterCertificate RegisterCertificate *
iot:RegisterThing RegisterThing
iot:RejectCertificateTransfer RejectCertificateTransfer

arn:aws:iot:region:account-id:cert/cert-id

iot:RemoveThingFromThingGroup RemoveThingFromThingGroup

arn:aws:iot:region:account-id:thinggroup/thing-group-name

arn:aws:iot:region:account-id:thing/thing-name

iot:ReplaceTopicRule ReplaceTopicRule

arn:aws:iot:region:account-id:rule/rule-name

iot:SearchIndex SearchIndex

arn:aws:iot:region:account-id:index/index-id

iot:SetDefaultAuthorizer SetDefaultAuthorizer

arn:aws:iot:region:account-id:authorizer/authorizer-function-name

iot:SetDefaultPolicyVersion SetDefaultPolicyVersion

arn:aws:iot:region:account-id:policy/policy-name

iot:SetLoggingOptions SetLoggingOptions

arn:aws:iot:region:account-id:role/role-name

iot:SetV2LoggingLevel SetV2LoggingLevel

arn:aws:iot:region:account-id:thinggroup/thing-group-name

iot:SetV2LoggingOptions SetV2LoggingOptions

arn:aws:iot:region:account-id:role/role-name

iot:StartThingRegistrationTask StartThingRegistrationTask
iot:StopThingRegistrationTask StopThingRegistrationTask
iot:TestAuthorization TestAuthorization

arn:aws:iot:region:account-id:cert/cert-id

iot:TestInvokeAuthorizer TestInvokeAuthorizer
iot:TransferCertificate TransferCertificate

arn:aws:iot:region:account-id:cert/cert-id

iot:UpdateAuthorizer UpdateAuthorizer

arn:aws:iot:region:account-id:authorizerfunction/authorizer-function-name

iot:UpdateCACertificate UpdateCACertificate

arn:aws:iot:region:account-id:cacert/cert-id

iot:UpdateCertificate UpdateCertificate

arn:aws:iot:region:account-id:cert/cert-id

iot:UpdateEventConfigurations UpdateEventConfigurations
iot:UpdateIndexingConfiguration UpdateIndexingConfiguration
iot:UpdateRoleAlias UpdateRoleAlias

arn:aws:iot:region:account-id:rolealias/role-alias-name

iot:UpdateThing UpdateThing

arn:aws:iot:region:account-id:thing/thing-name

iot:UpdateThingGroup UpdateThingGroup

arn:aws:iot:region:account-id:thinggroup/thing-group-name

iot:UpdateThingGroupsForThing UpdateThingGroupsForThing

arn:aws:iot:region:account-id:thing/thing-name

有关 ARN 格式的更多信息,请参阅 Amazon Resource Name (ARN) 和 Amazon 服务命名空间

无法对特定资源执行某些 Amazon IoT 操作,例如,用于创建资源的操作。在这些情况下,您必须使用通配符 (*)。

"Resource": "*"

要查看 Amazon IoT 资源类型及其 ARN 的列表,请参阅 IAM 用户指南中的 Amazon IoT 定义的资源。要了解您可以在哪些操作中指定每个资源的 ARN,请参阅 Amazon IoT 定义的操作

Device Advisor 资源

要为 Amazon IoT Device Advisor IAM 策略定义资源级别限制,请使用以下资源 ARN 格式进行套件定义和套件运行。

套件定义资源 ARN 格式

arn:aws:iotdeviceadvisor:region:account-id:suitedefinition/suite-definition-id

套件运行资源 ARN 格式

arn:aws:iotdeviceadvisor:region:account-id:suiterun/suite-definition-id/suite-run-id

条件键

管理员可以使用 Amazon JSON 策略来指定谁有权访问什么内容。也就是说,哪个委托人 可以对什么资源 执行操作,以及在什么 条件 下执行。

Condition 元素(或 Condition )中,可以指定语句生效的条件。Condition 元素是可选的。您可以创建使用条件运算符(例如,等于或小于)的条件表达式,以使策略中的条件与请求中的值相匹配。

如果您在一个语句中指定多个 Condition 元素,或在单个 Condition 元素中指定多个键,则 Amazon 使用逻辑 AND 运算评估。如果您为单个条件键指定多个值,则 Amazon 使用逻辑 OR 运算来评估条件。在授予语句的权限之前必须满足所有的条件。

在指定条件时,您也可以使用占位符变量。例如,只有在使用 IAM 用户名标记 IAM 用户时,您才能为其授予访问资源的权限。有关更多信息,请参阅 IAM 用户指南 中的 IAM 策略元素:变量和标签

Amazon 支持全局条件键和特定于服务的条件键。要查看所有 Amazon 全局条件键,请参阅 IAM 用户指南中的 Amazon 全局条件上下文键。

Amazon IoT 定义了自己的一组条件键,还支持使用一些全局条件键。要查看所有 Amazon 全局条件键,请参阅《IAM 用户指南》中的 Amazon 全局条件上下文键

Amazon IoT 条件键
Amazon IoT 条件键 描述 Type
aws:RequestTag/${tag-key} 用户向 Amazon IoT 发出的请求中包含的标签键。 字符串
aws:ResourceTag/${tag-key} 附加到 Amazon IoT 资源的标签的标签键组件。 字符串
aws:TagKeys 与请求中的资源关联的所有标签键名称的列表。 字符串

要查看 Amazon IoT 条件键的列表,请参阅 IAM 用户指南中的 Amazon IoT 条件键。要了解您可以对哪些操作和资源使用条件键,请参阅 Amazon IoT 定义的操作

Examples

要查看 Amazon IoT 基于身份的策略的示例,请参阅Amazon IoT 基于身份的策略示例

Amazon IoT 基于资源的策略

基于资源的策略是 JSON 策略文档,它们指定了指定委托人可在 Amazon IoT 资源上执行的操作以及在什么条件下可执行。

Amazon IoT 不支持基于 IAM 资源的策略。不过,它支持 Amazon IoT 基于资源的策略。

基于 Amazon IoT 标签的授权

您可以将标签附加到 Amazon IoT 资源或将请求中的标签传递到 Amazon IoT。要基于标签控制访问,您需要使用 iot:ResourceTag/key-nameaws:RequestTag/key-nameaws:TagKeys 条件键在策略的条件元素中提供标签信息。有关更多信息,请参阅 在 IAM 策略中使用标签。有关标记 Amazon IoT 资源的更多信息,请参阅给您的 Amazon IoT 资源加标签

要查看基于身份的策略(用于根据资源上的标签来限制对该资源的访问)的示例,请参阅根据标签查看 Amazon IoT 资源

Amazon IoT IAM 角色

IAM 角色是 Amazon Web Services 账户 中具有特定权限的实体。

将临时凭证用于 Amazon IoT

您可以使用临时凭证进行联合身份登录,担任 IAM 角色或担任跨账户角色。您可以通过调用 Amazon STS API 操作(如 AssumeRoleGetFederationToken)获得临时安全凭证。

Amazon IoT 支持使用临时凭证。

服务相关角色

服务相关角色允许 Amazon 服务访问其他服务中的资源以代表您完成操作。服务相关角色显示在您的 IAM 账户中,并归该服务所有。IAM 管理员可以查看但不能编辑服务相关角色的权限。

Amazon IoT 不支持服务相关角色。

服务角色

此功能允许服务代表您担任服务角色。此角色允许服务访问其他服务中的资源以代表您完成操作。服务角色显示在您的 IAM 账户中,并归该账户所有。这意味着,IAM 管理员可以更改该角色的权限。但是,这样做可能会中断服务的功能。