AWS IoT 如何使用 IAM - AWS IoT Core

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

AWS IoT 如何使用 IAM

在使用管理IAM访问权限之前 AWS IoT,您应该了解哪些IAM功能可供使用 AWS IoT。要全面了解如何使用 AWS IoT 和其他 AWS 服务IAM,请参阅《IAM用户指南》IAM中的 “与之配合使用的AWS 服务”。

AWS IoT 基于身份的策略

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

操作

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

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

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

下表列出了IAM物联网操作 AWS IoT API、关联的操作以及操作所操纵的资源。

策略操作 AWS IoT API 资源
物联网:AcceptCertificateTransfer AcceptCertificateTransfer

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

注意

中 AWS 账户 指定的ARN必须是证书要转移到的账户。

物联网:AddThingToThingGroup AddThingToThingGroup

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

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

物联网:AssociateTargetsWithJob AssociateTargetsWithJob none
物联网:AttachPolicy AttachPolicy

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

或者

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

物联网:AttachPrincipalPolicy AttachPrincipalPolicy

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

物联网:AttachSecurityProfile AttachSecurityProfile

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

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

物联网:AttachThingPrincipal AttachThingPrincipal

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

物联网:CancelCertificateTransfer CancelCertificateTransfer

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

注意

中 AWS 账户 指定的ARN必须是证书要转移到的账户。

物联网:CancelJob CancelJob

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

物联网:CancelJobExecution CancelJobExecution

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

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

物联网:ClearDefaultAuthorizer ClearDefaultAuthorizer
物联网:CreateAuthorizer CreateAuthorizer

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

物联网:CreateCertificateFromCsr CreateCertificateFromCsr *
物联网:CreateDimension CreateDimension

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

物联网: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

物联网:CreateJobTemplate CreateJobTemplate

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

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

物联网:CreateKeysAndCertificate CreateKeysAndCertificate *
物联网:CreatePolicy CreatePolicy

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

物联网:CreatePolicyVersion CreatePolicyVersion

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

注意

这必须是一项 AWS IoT 政策,而不是一项IAM政策。

物联网:CreateRoleAlias CreateRoleAlias

(参数:roleAlias)

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

物联网:CreateSecurityProfile CreateSecurityProfile

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

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

物联网:CreateThing CreateThing

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

物联网:CreateThingGroup CreateThingGroup

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

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

物联网:CreateThingType CreateThingType

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

物联网:CreateTopicRule CreateTopicRule

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

物联网:DeleteAuthorizer DeleteAuthorizer

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

物联网:D eleteCACertificate D eleteCACertificate

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

物联网:DeleteCertificate DeleteCertificate

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

物联网:DeleteDimension DeleteDimension

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

物联网:DeleteJob DeleteJob

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

物联网:DeleteJobTemplate DeleteJobTemplate

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

物联网:DeleteJobExecution DeleteJobExecution

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

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

物联网:DeletePolicy DeletePolicy

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

物联网:DeletePolicyVersion DeletePolicyVersion

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

物联网:DeleteRegistrationCode DeleteRegistrationCode *
物联网:DeleteRoleAlias DeleteRoleAlias

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

物联网:DeleteSecurityProfile DeleteSecurityProfile

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

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

物联网:DeleteThing DeleteThing

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

物联网:DeleteThingGroup DeleteThingGroup

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

物联网:DeleteThingType DeleteThingType

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

物联网:DeleteTopicRule DeleteTopicRule

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

物联网:deletev2 LoggingLevel deleteV2 LoggingLevel

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

物联网:DeprecateThingType DeprecateThingType

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

物联网:DescribeAuthorizer DescribeAuthorizer

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

(参数:authorizerName)

none
物联网:D escribeCACertificate D escribeCACertificate

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

物联网:DescribeCertificate DescribeCertificate

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

物联网:DescribeDefaultAuthorizer DescribeDefaultAuthorizer
物联网:DescribeEndpoint DescribeEndpoint *
物联网:DescribeEventConfigurations DescribeEventConfigurations none
物联网:DescribeIndex DescribeIndex

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

物联网:DescribeJob DescribeJob

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

物联网:DescribeJobExecution DescribeJobExecution
物联网:DescribeJobTemplate DescribeJobTemplate

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

物联网:DescribeRoleAlias DescribeRoleAlias

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

物联网:DescribeThing DescribeThing

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

物联网:DescribeThingGroup DescribeThingGroup

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

物联网:DescribeThingRegistrationTask DescribeThingRegistrationTask
物联网:DescribeThingType DescribeThingType

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

物联网:DetachPolicy DetachPolicy

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

或者

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

物联网:DetachPrincipalPolicy DetachPrincipalPolicy

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

物联网:DetachSecurityProfile DetachSecurityProfile

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

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

物联网:DetachThingPrincipal DetachThingPrincipal

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

物联网:DisableTopicRule DisableTopicRule

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

物联网:EnableTopicRule EnableTopicRule

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

物联网:GetEffectivePolicies GetEffectivePolicies

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

物联网:GetIndexingConfiguration GetIndexingConfiguration
物联网:GetJobDocument GetJobDocument

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

物联网:GetLoggingOptions GetLoggingOptions *
物联网:GetPolicy GetPolicy

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

物联网:GetPolicyVersion GetPolicyVersion

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

物联网:GetRegistrationCode GetRegistrationCode *
物联网:GetTopicRule GetTopicRule

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

物联网:ListAttachedPolicies ListAttachedPolicies

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

或者

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

物联网:ListAuthorizers ListAuthorizers
物联网:istCACertificates L istCACertificates *
物联网:ListCertificates ListCertificates *
物联网:ListCertificatesByCA ListCertificatesByCA *
物联网:ListIndices ListIndices
物联网:ListJobExecutionsForJob ListJobExecutionsForJob
物联网:ListJobExecutionsForThing ListJobExecutionsForThing
物联网:ListJobs ListJobs

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

如果使用 thingGroupName 参数

物联网:ListJobTemplates ListJobs
物联网:ListOutgoingCertificates ListOutgoingCertificates *
物联网:ListPolicies ListPolicies *
物联网:ListPolicyPrincipals ListPolicyPrincipals *
物联网:ListPolicyVersions ListPolicyVersions

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

物联网:ListPrincipalPolicies ListPrincipalPolicies

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

物联网:ListPrincipalThings ListPrincipalThings

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

物联网:ListRoleAliases ListRoleAliases
物联网:ListTargetsForPolicy ListTargetsForPolicy

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

物联网:ListThingGroups ListThingGroups
物联网:ListThingGroupsForThing ListThingGroupsForThing

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

物联网:ListThingPrincipals ListThingPrincipals

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

物联网:ListThingRegistrationTaskReports ListThingRegistrationTaskReports
物联网:ListThingRegistrationTasks ListThingRegistrationTasks
物联网:ListThingTypes ListThingTypes *
物联网:ListThings ListThings *
物联网:ListThingsInThingGroup ListThingsInThingGroup

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

物联网:ListTopicRules ListTopicRules *
IoT: listv2 LoggingLevels Listv2 LoggingLevels
IoTR: egisterCACertificate R egisterCACertificate *
物联网:RegisterCertificate RegisterCertificate *
物联网:RegisterThing RegisterThing
物联网:RejectCertificateTransfer RejectCertificateTransfer

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

物联网:RemoveThingFromThingGroup RemoveThingFromThingGroup

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

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

物联网:ReplaceTopicRule ReplaceTopicRule

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

物联网:SearchIndex SearchIndex

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

物联网:SetDefaultAuthorizer SetDefaultAuthorizer

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

物联网:SetDefaultPolicyVersion SetDefaultPolicyVersion

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

物联网:SetLoggingOptions SetLoggingOptions

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

IoT: setv2 LoggingLevel setv2 LoggingLevel

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

IoT: setv2 LoggingOptions setv2 LoggingOptions

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

物联网:StartThingRegistrationTask StartThingRegistrationTask
物联网:StopThingRegistrationTask StopThingRegistrationTask
物联网:TestAuthorization TestAuthorization

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

物联网:TestInvokeAuthorizer TestInvokeAuthorizer
物联网:TransferCertificate TransferCertificate

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

物联网:UpdateAuthorizer UpdateAuthorizer

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

物联网:u pdateCACertificate U pdateCACertificate

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

物联网:UpdateCertificate UpdateCertificate

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

物联网:UpdateDimension UpdateDimension

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

物联网:UpdateEventConfigurations UpdateEventConfigurations
物联网:UpdateIndexingConfiguration UpdateIndexingConfiguration
物联网:UpdateRoleAlias UpdateRoleAlias

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

物联网:UpdateSecurityProfile UpdateSecurityProfile

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

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

物联网:UpdateThing UpdateThing

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

物联网:UpdateThingGroup UpdateThingGroup

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

物联网:UpdateThingGroupsForThing UpdateThingGroupsForThing

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

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

正在执行的策略操作在操作前 AWS IoT 使用以下前缀:iot:. 例如,要授予某人列出他们在 AWS 账户 中注册的所有物联网事物的权限 ListThingsAPI,您需要将该iot:ListThings操作包含在他们的策略中。策略声明必须包含ActionNotAction元素。 AWS IoT 定义了它自己的一组操作,这些操作描述了您可以使用此服务执行的任务。

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

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

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

"Action": "iot:Describe*"

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

Device Advisor 操作

下表列出了 IAM IoT 设备顾问操作、关联的 AWS IoT 设备顾问API以及该操作操纵的资源。

策略操作 AWS 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

AWS IoT 设备顾问中的策略操作在操作前使用以下前缀:iotdeviceadvisor:. 例如,要授予某人列出他们在中注册的所有套件定义 AWS 账户 的权限 ListSuiteDefinitions API,您需要将该iotdeviceadvisor:ListSuiteDefinitions操作包含在他们的策略中。

资源

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

ResourceJSON策略元素指定要应用操作的一个或多个对象。语句必须包含 ResourceNotResource 元素。最佳做法是,使用资源的 Amazon 资源名称 (ARN) 来指定资源。对于支持特定资源类型(称为资源级权限)的操作,您可以执行此操作。

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

"Resource": "*"
AWS IoT 资源
策略操作 AWS IoT API 资源
物联网:AcceptCertificateTransfer AcceptCertificateTransfer

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

注意

中 AWS 账户 指定的ARN必须是证书要转移到的账户。

物联网:AddThingToThingGroup AddThingToThingGroup

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

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

物联网:AssociateTargetsWithJob AssociateTargetsWithJob
物联网:AttachPolicy AttachPolicy

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

或者

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

物联网:AttachPrincipalPolicy AttachPrincipalPolicy

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

物联网:AttachThingPrincipal AttachThingPrincipal

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

物联网:CancelCertificateTransfer CancelCertificateTransfer

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

注意

中 AWS 账户 指定的ARN必须是证书要转移到的账户。

物联网:CancelJob CancelJob

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

物联网:CancelJobExecution CancelJobExecution

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

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

物联网:ClearDefaultAuthorizer ClearDefaultAuthorizer
物联网:CreateAuthorizer CreateAuthorizer

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

物联网:CreateCertificateFromCsr CreateCertificateFromCsr *
物联网: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

物联网:CreateJobTemplate CreateJobTemplate

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

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

物联网:CreateKeysAndCertificate CreateKeysAndCertificate *
物联网:CreatePolicy CreatePolicy

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

CreatePolicyVersion 物联网:CreatePolicyVersion

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

注意

这必须是一项 AWS IoT 政策,而不是一项IAM政策。

物联网:CreateRoleAlias CreateRoleAlias

(参数:roleAlias)

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

物联网:CreateThing CreateThing

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

物联网:CreateThingGroup CreateThingGroup

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

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

物联网:CreateThingType CreateThingType

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

物联网:CreateTopicRule CreateTopicRule

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

物联网:DeleteAuthorizer DeleteAuthorizer

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

物联网:D eleteCACertificate D eleteCACertificate

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

物联网:DeleteCertificate DeleteCertificate

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

物联网:DeleteJob DeleteJob

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

物联网:DeleteJobExecution DeleteJobExecution

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

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

物联网:DeleteJobTemplate DeleteJobTemplate

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

物联网:DeletePolicy DeletePolicy

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

物联网:DeletePolicyVersion DeletePolicyVersion

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

物联网:DeleteRegistrationCode DeleteRegistrationCode *
物联网:DeleteRoleAlias DeleteRoleAlias

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

物联网:DeleteThing DeleteThing

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

物联网:DeleteThingGroup DeleteThingGroup

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

物联网:DeleteThingType DeleteThingType

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

物联网:DeleteTopicRule DeleteTopicRule

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

物联网:deletev2 LoggingLevel deleteV2 LoggingLevel

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

物联网:DeprecateThingType DeprecateThingType

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

物联网:DescribeAuthorizer DescribeAuthorizer

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

(参数:authorizerName)

none
物联网:D escribeCACertificate D escribeCACertificate

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

物联网:DescribeCertificate DescribeCertificate

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

物联网:DescribeDefaultAuthorizer DescribeDefaultAuthorizer
物联网:DescribeEndpoint DescribeEndpoint *
物联网:DescribeEventConfigurations DescribeEventConfigurations none
物联网:DescribeIndex DescribeIndex

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

物联网:DescribeJob DescribeJob

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

物联网:DescribeJobExecution DescribeJobExecution
物联网:DescribeJobTemplate DescribeJobTemplate

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

物联网:DescribeRoleAlias DescribeRoleAlias

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

物联网:DescribeThing DescribeThing

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

物联网:DescribeThingGroup DescribeThingGroup

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

物联网:DescribeThingRegistrationTask DescribeThingRegistrationTask
物联网:DescribeThingType DescribeThingType

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

物联网:DetachPolicy DetachPolicy

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

或者

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

物联网:DetachPrincipalPolicy DetachPrincipalPolicy

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

物联网:DetachThingPrincipal DetachThingPrincipal

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

物联网:DisableTopicRule DisableTopicRule

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

物联网:EnableTopicRule EnableTopicRule

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

物联网:GetEffectivePolicies GetEffectivePolicies

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

物联网:GetIndexingConfiguration GetIndexingConfiguration
物联网:GetJobDocument GetJobDocument

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

物联网:GetLoggingOptions GetLoggingOptions *
物联网:GetPolicy GetPolicy

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

物联网:GetPolicyVersion GetPolicyVersion

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

物联网:GetRegistrationCode GetRegistrationCode *
物联网:GetTopicRule GetTopicRule

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

物联网:ListAttachedPolicies ListAttachedPolicies

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

或者

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

物联网:ListAuthorizers ListAuthorizers
物联网:istCACertificates L istCACertificates *
物联网:ListCertificates ListCertificates *
物联网:ListCertificatesByCA ListCertificatesByCA *
物联网:ListIndices ListIndices
物联网:ListJobExecutionsForJob ListJobExecutionsForJob
物联网:ListJobExecutionsForThing ListJobExecutionsForThing
物联网:ListJobs ListJobs

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

如果使用 thingGroupName 参数

物联网:ListJobTemplates ListJobTemplates
物联网:ListOutgoingCertificates ListOutgoingCertificates *
物联网:ListPolicies ListPolicies *
物联网:ListPolicyPrincipals ListPolicyPrincipals

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

物联网:ListPolicyVersions ListPolicyVersions

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

物联网:ListPrincipalPolicies ListPrincipalPolicies

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

物联网:ListPrincipalThings ListPrincipalThings

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

物联网:ListRoleAliases ListRoleAliases
物联网:ListTargetsForPolicy ListTargetsForPolicy

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

物联网:ListThingGroups ListThingGroups
物联网:ListThingGroupsForThing ListThingGroupsForThing

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

物联网:ListThingPrincipals ListThingPrincipals

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

物联网:ListThingRegistrationTaskReports ListThingRegistrationTaskReports
物联网:ListThingRegistrationTasks ListThingRegistrationTasks
物联网:ListThingTypes ListThingTypes *
物联网:ListThings ListThings *
物联网:ListThingsInThingGroup ListThingsInThingGroup

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

物联网:ListTopicRules ListTopicRules *
IoT: listv2 LoggingLevels Listv2 LoggingLevels
IoTR: egisterCACertificate R egisterCACertificate *
物联网:RegisterCertificate RegisterCertificate *
物联网:RegisterThing RegisterThing
物联网:RejectCertificateTransfer RejectCertificateTransfer

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

物联网:RemoveThingFromThingGroup RemoveThingFromThingGroup

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

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

物联网:ReplaceTopicRule ReplaceTopicRule

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

物联网:SearchIndex SearchIndex

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

物联网:SetDefaultAuthorizer SetDefaultAuthorizer

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

物联网:SetDefaultPolicyVersion SetDefaultPolicyVersion

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

物联网:SetLoggingOptions SetLoggingOptions *
IoT: setv2 LoggingLevel setv2 LoggingLevel *
IoT: setv2 LoggingOptions setv2 LoggingOptions *
物联网:StartThingRegistrationTask StartThingRegistrationTask
物联网:StopThingRegistrationTask StopThingRegistrationTask
物联网:TestAuthorization TestAuthorization

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

物联网:TestInvokeAuthorizer TestInvokeAuthorizer
物联网:TransferCertificate TransferCertificate

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

物联网:UpdateAuthorizer UpdateAuthorizer

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

物联网:u pdateCACertificate U pdateCACertificate

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

物联网:UpdateCertificate UpdateCertificate

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

物联网:UpdateEventConfigurations UpdateEventConfigurations
物联网:UpdateIndexingConfiguration UpdateIndexingConfiguration
物联网:UpdateRoleAlias UpdateRoleAlias

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

物联网:UpdateThing UpdateThing

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

物联网:UpdateThingGroup UpdateThingGroup

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

物联网:UpdateThingGroupsForThing UpdateThingGroupsForThing

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

有关格式的更多信息ARNs,请参阅 Amazon 资源名称 (ARNs) 和 AWS 服务命名空间

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

"Resource": "*"

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

Device Advisor 资源

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

套件定义资源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

条件键

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

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

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

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

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

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

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

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

示例

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

AWS IoT 基于资源的策略

基于资源的JSON策略是政策文件,它规定了指定的委托人可以在什么条件下对 AWS IoT 资源执行哪些操作。

AWS IoT 不支持IAM基于资源的策略。但是,它确实支持 AWS IoT 基于资源的政策。有关更多信息,请参阅 AWS IoT Core 政策

基于 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角色或代入跨账户角色。您可以通过调用AssumeRole或之类的 AWS STS API操作来获取临时安全证书GetFederationToken

AWS IoT 支持使用临时证书。

服务相关角色

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

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

服务角色

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