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

AWS IoT 如何与 IAM 协同工作

在使用 IAM 管理对 AWS IoT 的访问之前,您应了解哪些 IAM 功能可与 AWS IoT 结合使用。要概括了解 AWS IoT 及其他 AWS 服务如何与 IAM 协同工作,请参阅 IAM 用户指南 中的可与 IAM 协同工作的 AWS 服务

AWS IoT 基于身份的策略

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

操作

基于 IAM 身份的策略的 Action 元素描述该策略将允许或拒绝的特定操作。策略操作通常与关联的 AWS API 操作同名。此策略用于策略中以授予执行关联操作的权限。

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

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

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

注意

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

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 中指定的 AWS 账户必须是证书将传输到的账户。

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

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

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

注意

这必须是 AWS 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: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: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: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

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

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

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

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

"Action": "iot:Describe*"

要查看 AWS IoT 操作的列表,请参阅 IAM 用户指南 中的 Actions Defined by AWS IoT

资源

Resource 元素指定要向其应用操作的对象。语句必须包含 ResourceNotResource 元素。您可使用 ARN 来指定资源,或使用通配符 (*) 以指明该语句适用于所有资源。

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

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

注意

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

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 中指定的 AWS 账户必须是证书将传输到的账户。

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

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

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

注意

这必须是 AWS 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: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: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: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 资源名称 (ARN) 和 AWS 服务命名空间

某些 AWS IoT 操作(例如用于创建资源的那些操作)不能在特定资源上执行。在这些情况下,您必须使用通配符 (*)。

"Resource": "*"

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

条件键

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

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

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

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

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

要查看 AWS IoT 条件键的列表,请参阅 IAM 用户指南 中的 Condition Keys for AWS IoT。要了解您可以对哪些操作和资源使用条件键,请参阅 Actions Defined by AWS IoT

示例

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

AWS IoT 基于资源的策略

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

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

基于 AWS IoT 标签的授权

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

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

AWS IoT IAM 角色

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

将临时凭证用于 AWS IoT

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

AWS IoT 支持使用临时凭证。

服务相关角色

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

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

服务角色

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

AWS IoT 不支持服务角色。