

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 的身分和存取管理 AWS IoT
<a name="security-iam"></a>

AWS Identity and Access Management (IAM) 是一種 AWS 服務 ，可協助管理員安全地控制對 AWS 資源的存取。IAM 管理員可控制誰可以*進行驗證 *（登入） 和*授權* （具有許可） 來使用 AWS IoT 資源。IAM 是您可以免費使用 AWS 服務 的 。

**Topics**
+ [目標對象](#security_iam_audience)
+ [使用 IAM 身分來驗證](#security_iam_authentication)
+ [使用政策管理存取權](#security_iam_access-manage)
+ [AWS IoT 如何使用 IAM](security_iam_service-with-iam.md)
+ [AWS IoT 身分型政策範例](security_iam_id-based-policy-examples.md)
+ [AWS 的 受管政策 AWS IoT](security-iam-awsmanpol.md)
+ [對 AWS IoT 身分和存取進行故障診斷](security_iam_troubleshoot.md)

## 目標對象
<a name="security_iam_audience"></a>

如何使用 AWS Identity and Access Management (IAM) 會因您的角色而有所不同：
+ **服務使用者** — 若無法存取某些功能，請向管理員申請所需許可 (請參閱 [對 AWS IoT 身分和存取進行故障診斷](security_iam_troubleshoot.md))
+ **服務管理員** — 負責設定使用者存取權並提交相關許可請求 (請參閱 [AWS IoT 如何使用 IAM](security_iam_service-with-iam.md))
+ **IAM 管理員** — 撰寫政策以管理存取控制 (請參閱 [AWS IoT 身分型政策範例](security_iam_id-based-policy-examples.md))

## 使用 IAM 身分來驗證
<a name="security_iam_authentication"></a>

身分可以是裝置 AWS IoT (X.509) 憑證、Amazon Cognito 身分或 IAM 使用者或群組。本主題僅討論 IAM 身分。如需 AWS IoT 支援的其他身分的詳細資訊，請參閱 [用戶端身分驗證](client-authentication.md)。

身分驗證是您 AWS 使用身分憑證登入 的方式。您必須以 AWS 帳戶根使用者、IAM 使用者或擔任 IAM 角色身分進行身分驗證。

您可以使用身分來源的登入資料，例如 AWS IAM Identity Center (IAM Identity Center)、單一登入身分驗證或 Google/Facebook 登入資料，以聯合身分的形式登入。如需有關登入的詳細資訊，請參閱《AWS 登入 使用者指南》**中的[如何登入您的 AWS 帳戶](https://docs.aws.amazon.com/signin/latest/userguide/how-to-sign-in.html)。

對於程式設計存取， AWS 提供 SDK 和 CLI 以密碼編譯方式簽署請求。如需詳細資訊，請參閱《IAM 使用者指南》**中的 [API 請求的AWS 第 4 版簽署程序](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv.html)。

### AWS 帳戶 根使用者
<a name="security_iam_authentication-rootuser"></a>

 當您建立 時 AWS 帳戶，您會從一個名為 AWS 帳戶 *theroot 使用者的*登入身分開始，該身分具有對所有 AWS 服務 和 資源的完整存取權。強烈建議不要使用根使用者來執行日常任務。有關需要根使用者憑證的任務，請參閱《IAM 使用者指南》**中的[需要根使用者憑證的任務](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-user.html#root-user-tasks)。

### IAM 使用者和群組
<a name="security_iam_authentication-iamuser"></a>

*IAM 使用者*[https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users.html](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users.html)是一種身分具備單人或應用程式的特定許可權。建議以臨時憑證取代具備長期憑證的 IAM 使用者。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[要求人類使用者使用聯合身分提供者來 AWS 使用臨時憑證存取](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#bp-users-federation-idp) 。

[IAM 群組](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html)**會指定 IAM 使用者集合，使管理大量使用者的許可權更加輕鬆。如需詳細資訊，請參閱《IAM 使用者指南》**中的 [IAM 使用者的使用案例](https://docs.aws.amazon.com/IAM/latest/UserGuide/gs-identities-iam-users.html)。

### IAM 角色
<a name="security_iam_authentication-iamrole"></a>

*IAM 角色*[https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html)的身分具有特定許可權，其可以提供臨時憑證。您可以透過[從使用者切換到 IAM 角色 （主控台） ](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-console.html)或呼叫 AWS CLI 或 AWS API 操作來擔任角色。如需詳細資訊，請參閱《IAM 使用者指南》**中的[擔任角色的方法](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_manage-assume.html)。

IAM 角色適用於聯合身分使用者存取、臨時 IAM 使用者許可、跨帳戶存取權與跨服務存取，以及在 Amazon EC2 執行的應用程式。如需詳細資訊，請參閱《*IAM 使用者指南*》中的 [IAM 中的快帳戶資源存取](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-cross-account-resource-access.html)。

## 使用政策管理存取權
<a name="security_iam_access-manage"></a>

您可以透過建立政策並將其連接到身分或資源 AWS 來控制 AWS 中的存取。政策定義與身分或資源相關聯的許可。當委託人提出請求時 AWS ， 會評估這些政策。大多數政策會以 JSON 文件 AWS 形式存放在 中。如需進一步了解 JSON 政策文件，請參閱《*IAM 使用者指南*》中的 [JSON 政策概觀](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policies-json)。

管理員會使用政策，透過定義哪些**主體**可在哪些**條件**下對哪些**資源**執行**動作**，以指定可存取的範圍。

預設情況下，使用者和角色沒有許可。IAM 管理員會建立 IAM 政策並將其新增至角色，供使用者後續擔任。IAM 政策定義動作的許可，無論採用何種方式執行。

### 身分型政策
<a name="security_iam_access-manage-id-based-policies"></a>

身分型政策是附加至身分 (使用者、使用者群組或角色) 的 JSON 許可政策文件。這類政策控制身分可對哪些資源執行哪些動作，以及適用的條件。如需了解如何建立身分型政策，請參閱《*IAM 使用者指南*》中的[透過客戶管理政策定義自訂 IAM 許可](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create.html)。

身分型政策可分為*內嵌政策* (直接內嵌於單一身分) 與*受管政策* (可附加至多個身分的獨立政策)。如需了解如何在受管政策及內嵌政策之間做選擇，請參閱《IAM 使用者指南》**中的[在受管政策與內嵌政策之間選擇](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-choosing-managed-or-inline.html)。

### 資源型政策
<a name="security_iam_access-manage-resource-based-policies"></a>

資源型政策是附加到資源的 JSON 政策文件。範例包括 IAM *角色信任政策*與 Amazon S3 *儲存貯體政策*。在支援資源型政策的服務中，服務管理員可以使用它們來控制對特定資源的存取權限。您必須在資源型政策中[指定主體](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html)。

資源型政策是位於該服務中的內嵌政策。您無法在資源型政策中使用來自 IAM 的 AWS 受管政策。

### 存取控制清單 (ACL)
<a name="security_iam_access-manage-acl"></a>

存取控制清單 (ACL) 可控制哪些主體 (帳戶成員、使用者或角色) 擁有存取某資源的許可。ACL 類似於資源型政策，但它們不使用 JSON 政策文件格式。

Amazon S3 AWS WAF和 Amazon VPC 是支援 ACLs的服務範例。如需進一步了解 ACL，請參閱《Amazon Simple Storage Service 開發人員指南》**中的[存取控制清單 (ACL) 概觀](https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html)。

### 其他政策類型
<a name="security_iam_access-manage-other-policies"></a>

AWS 支援其他政策類型，可設定更多常見政策類型授予的最大許可：
+ **許可界限** — 設定身分型政策可授與 IAM 實體的最大許可。如需詳細資訊，請參閱《 IAM 使用者指南》**中的 [IAM 實體許可界限](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html)。
+ **服務控制政策 (SCP)** — 為 AWS Organizations中的組織或組織單位指定最大許可。如需詳細資訊，請參閱《AWS Organizations 使用者指南》**中的[服務控制政策](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps.html)。
+ **資源控制政策 (RCP)** — 設定您帳戶中資源可用許可的上限。如需詳細資訊，請參閱《AWS Organizations 使用者指南》**中的[資源控制政策 (RCP)](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_rcps.html)。
+ **工作階段政策** — 在以程式設計方式為角色或聯合身分使用者建立臨時工作階段時，以參數形式傳遞的進階政策。如需詳細資訊，請參《*IAM 使用者指南*》中的[工作階段政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)。

### 多種政策類型
<a name="security_iam_access-manage-multiple-policies"></a>

當多種類型的政策適用於請求時，產生的許可會更複雜而無法理解。若要了解如何 AWS 在涉及多種政策類型時決定是否允許請求，請參閱《*IAM 使用者指南*》中的[政策評估邏輯](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html)。

# AWS IoT 如何使用 IAM
<a name="security_iam_service-with-iam"></a>

在您使用 IAM 管理對 的存取之前 AWS IoT，您應該了解哪些 IAM 功能可與 搭配使用 AWS IoT。若要全面了解 AWS IoT 和其他 AWS 服務如何與 IAM 搭配使用，請參閱《[AWS IAM 使用者指南》中的與 IAM 搭配使用的 服務](https://docs.aws.amazon.com/service-authorization/latest/reference/reference_aws-services-that-work-with-iam.html)。 **

**Topics**
+ [AWS IoT 身分型政策](#security_iam_service-with-iam-id-based-policies)
+ [AWS IoT 資源型政策](#security_iam_service-with-iam-resource-based-policies)
+ [以 AWS IoT 標籤為基礎的授權](#security_iam_service-with-iam-tags)
+ [AWS IoT IAM 角色](#security_iam_service-with-iam-roles)

## AWS IoT 身分型政策
<a name="security_iam_service-with-iam-id-based-policies"></a>

使用 IAM 身分類型政策，您可以指定允許或拒絕的動作和資源，以及在何種條件下會允許或拒絕動作。 AWS IoT 支援特定動作、資源及條件索引鍵。若要了解您在 JSON 政策中使用的所有元素，請參閱《*IAM 使用者指南*》中的 [JSON 政策元素參考](https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_elements.html)。

### 動作
<a name="security_iam_service-with-iam-id-based-policies-actions"></a>

管理員可以使用 AWS JSON 政策來指定誰可以存取內容。也就是說，哪個**主體**在什麼**條件**下可以對什麼**資源**執行哪些**動作**。

JSON 政策的 `Action` 元素描述您可以用來允許或拒絕政策中存取的動作。政策會使用動作來授予執行相關聯動作的許可。

下表列出 IAM IoT 動作、相關聯的 AWS IoT API，以及動作操作的資源。


****  

| 政策動作 | AWS IoT API | Resources | 
| --- | --- | --- | 
| 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 | \$1 | 
| 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 | \$1 | 
| iot:CreatePolicy | CreatePolicy | `arn:aws:iot:region:account-id:policy/policy-name` | 
| 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: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 | \$1 | 
| 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 | \$1 | 
| 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 | \$1 | 
| 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 | \$1 | 
| 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 | \$1 | 
| iot:ListCertificates | ListCertificates | \$1 | 
| iot:ListCertificatesByCA | ListCertificatesByCA | \$1 | 
| 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 | \$1 | 
| iot:ListPolicies | ListPolicies | \$1 | 
| iot:ListPolicyPrincipals | ListPolicyPrincipals | \$1 | 
| 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 | \$1 | 
| iot:ListThings | ListThings | \$1 | 
| iot:ListThingsInThingGroup | ListThingsInThingGroup |  `arn:aws:iot:region:account-id:thinggroup/thing-group-name`  | 
| iot:ListTopicRules | ListTopicRules | \$1 | 
| iot:ListV2LoggingLevels | ListV2LoggingLevels | 無 | 
| iot:RegisterCACertificate | RegisterCACertificate | \$1 | 
| iot:RegisterCertificate | RegisterCertificate | \$1 | 
| 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` `arn:aws:iot:region:account-id:thinggroup/thing-group-name`  | 

中的政策動作在動作之前 AWS IoT 使用下列字首：`iot:`。例如，若要授予某人許可，以列出在 中 AWS 帳戶 向 `ListThings` API 註冊的所有 IoT 物件，請在其政策中包含 `iot:ListThings`動作。政策陳述式必須包含 `Action`或 `NotAction`元素。 AWS IoT 會定義自己的一組動作，描述您可以使用此服務執行的任務。

若要在單一陳述式中指定多個動作，請用逗號分隔，如下所示：

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

您也可以使用萬用字元 (\$1) 來指定多個動作。例如，若要指定開頭是 `Describe` 文字的所有動作，請包含以下動作：

```
"Action": "iot:Describe*"
```

若要查看 AWS IoT 動作清單，請參閱《*IAM 使用者指南*》中的 [定義的動作 AWS IoT](https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions)。

#### Device Advisor 動作
<a name="security_iam_service-actions-device-advisor"></a>

下表列出 IAM IoT Device Advisor 動作、相關的 AWS IoT Device Advisor API，以及動作所操控的資源。


****  

| 政策動作 | AWS IoT API | Resources | 
| --- | --- | --- | 
| 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 Device Advisor 中的政策動作在動作之前使用以下字首：`iotdeviceadvisor:`。例如，若要授予某人使用 AWS 帳戶 ListSuiteDefinitions API 列出在其中註冊的所有套件定義的許可，請在其政策中包含 `iotdeviceadvisor:ListSuiteDefinitions`動作。

### Resources
<a name="security_iam_service-with-iam-id-based-policies-resources"></a>

管理員可以使用 AWS JSON 政策來指定誰可以存取內容。也就是說，哪個**主體**在什麼**條件**下可以對什麼**資源**執行哪些**動作**。

`Resource` JSON 政策元素可指定要套用動作的物件。最佳實務是使用其 [Amazon Resource Name (ARN)](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html) 來指定資源。若動作不支援資源層級許可，使用萬用字元 (\$1) 表示該陳述式適用於所有資源。

```
"Resource": "*"
```


**AWS IoT 資源**  

| 政策動作 | AWS IoT API | Resources | 
| --- | --- | --- | 
| 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 | \$1 | 
| 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 | \$1 | 
| iot:CreatePolicy | CreatePolicy | `arn:aws:iot:region:account-id:policy/policy-name` | 
| 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: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 | \$1 | 
| 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 | \$1 | 
| 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 | \$1 | 
| 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 | \$1 | 
| 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 | \$1 | 
| iot:ListCertificates | ListCertificates | \$1 | 
| iot:ListCertificatesByCA | ListCertificatesByCA | \$1 | 
| 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 | \$1 | 
| iot:ListPolicies | ListPolicies | \$1 | 
| 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 | \$1 | 
| iot:ListThings | ListThings | \$1 | 
| iot:ListThingsInThingGroup | ListThingsInThingGroup |  `arn:aws:iot:region:account-id:thinggroup/thing-group-name`  | 
| iot:ListTopicRules | ListTopicRules | \$1 | 
| iot:ListV2LoggingLevels | ListV2LoggingLevels | 無 | 
| iot:RegisterCACertificate | RegisterCACertificate | \$1 | 
| iot:RegisterCertificate | RegisterCertificate | \$1 | 
| 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 | \$1 | 
| iot:SetV2LoggingLevel | SetV2LoggingLevel | \$1 | 
| iot:SetV2LoggingOptions | SetV2LoggingOptions | \$1 | 
| 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`  | 

如需 ARNs 格式的詳細資訊，請參閱 [Amazon Resource Name (ARNs) AWS 和服務命名空間](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)。

有些 AWS IoT 動作無法對特定資源執行，例如用於建立資源的動作。在這些情況下，您必須使用萬用字元 (\$1)。

```
"Resource": "*"
```

若要查看 AWS IoT 資源類型及其 ARNs的清單，請參閱《*IAM 使用者指南*》中的 [定義的資源 AWS IoT](https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-resources-for-iam-policies)。若要了解您可以使用哪些動作指定每個資源的 ARN，請參閱 [AWS IoT定義的動作](https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions)。

#### Device Advisor 資源
<a name="security_iam_service-device-advisor-resources"></a>

若要定義 AWS 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`

### 條件索引鍵
<a name="security_iam_service-with-iam-id-based-policies-conditionkeys"></a>

管理員可以使用 AWS JSON 政策來指定誰可以存取內容。也就是說，哪個**主體**在什麼**條件**下可以對什麼**資源**執行哪些**動作**。

`Condition` 元素會根據定義的條件，指定陳述式的執行時機。您可以建立使用[條件運算子](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html)的條件運算式 (例如等於或小於)，來比對政策中的條件和請求中的值。若要查看所有 AWS 全域條件索引鍵，請參閱《*IAM 使用者指南*》中的[AWS 全域條件內容索引鍵](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html)。

AWS IoT 會定義自己的一組條件金鑰，也支援使用一些全域條件金鑰。若要查看所有 AWS 全域條件金鑰，請參閱《*IAM 使用者指南*》中的[AWS 全域條件內容金鑰](https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_condition-keys.html)。


**AWS IoT 條件索引鍵**  

| AWS IoT 條件索引鍵 | 描述 | Type | 
| --- | --- | --- | 
| aws:RequestTag/\$1\$1tag-key\$1 | 在使用者對 AWS IoT提出的請求中存在的標籤金鑰。 | String | 
| aws:ResourceTag/\$1\$1tag-key\$1 | 連接至 AWS IoT 資源之標籤的標籤索引鍵元件。 | String | 
| aws:TagKeys | 與請求中資源相關聯的所有標籤鍵名稱清單。 | String | 

若要查看 AWS IoT 條件金鑰清單，請參閱《*IAM 使用者指南*》中的 [的條件金鑰 AWS IoT](https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-policy-keys)。若要了解您可以使用條件金鑰的動作和資源，請參閱 [定義的動作 AWS IoT](https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions)。

### 範例
<a name="security_iam_service-with-iam-id-based-policies-examples"></a>



若要檢視 AWS IoT 身分型政策的範例，請參閱 [AWS IoT 身分型政策範例](security_iam_id-based-policy-examples.md)。

## AWS IoT 資源型政策
<a name="security_iam_service-with-iam-resource-based-policies"></a>

以資源為基礎的政策是 JSON 政策文件，指定指定委託人可以在 AWS IoT 資源上執行的動作，以及在哪些條件下執行的動作。

AWS IoT 不支援 IAM 資源型政策。不過，它支援以 AWS IoT 資源為基礎的政策。如需詳細資訊，請參閱[AWS IoT Core 政策](iot-policies.md)。

## 以 AWS IoT 標籤為基礎的授權
<a name="security_iam_service-with-iam-tags"></a>

您可以將標籤連接至 AWS IoT 資源，或將請求中的標籤傳遞至 AWS IoT。如需根據標籤控制存取，請使用 `iot:ResourceTag/key-name`、`aws:RequestTag/key-name` 或 `aws:TagKeys` 條件索引鍵，在政策的[條件元素](https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_elements_condition.html)中，提供標籤資訊。如需詳細資訊，請參閱[搭配 IAM 政策使用標籤](tagging-iot-iam.md)。如需標記 AWS IoT 資源的詳細資訊，請參閱 [標記您的 AWS IoT 資源](tagging-iot.md)。

若要檢視身分型原則範例，以根據該資源上的標籤來限制存取資源，請參閱[根據標籤檢視 AWS IoT 資源](security_iam_id-based-policy-examples.md#security_iam_id-based-policy-examples-view-thing-tags)。

## AWS IoT IAM 角色
<a name="security_iam_service-with-iam-roles"></a>

[IAM 角色](https://docs.aws.amazon.com/service-authorization/latest/reference/id_roles.html)是 中具有特定許可 AWS 帳戶 的實體。

### 搭配 使用臨時登入資料 AWS IoT
<a name="security_iam_service-with-iam-roles-tempcreds"></a>

您可以搭配聯合使用暫時憑證、擔任 IAM 角色，或是擔任跨帳戶角色。您可以透過呼叫 [AssumeRole](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html) 或 [GetFederationToken](https://docs.aws.amazon.com/STS/latest/APIReference/API_GetFederationToken.html) 等 AWS STS API 操作來取得臨時安全登入資料。

AWS IoT 支援使用臨時登入資料。

### 服務連結角色
<a name="security_iam_service-with-iam-roles-service-linked"></a>

[服務連結角色](https://docs.aws.amazon.com/service-authorization/latest/reference/id_roles_terms-and-concepts.html#iam-term-service-linked-role)可讓 AWS 服務存取其他服務中的資源，以代表您完成 動作。服務連結角色會顯示在您的 IAM 帳戶中，並由該服務所擁有。IAM 管理員可以檢視，但不能編輯服務連結角色的許可。

AWS IoT 不支援服務連結角色。

### 服務角色
<a name="security_iam_service-with-iam-roles-service"></a>

此功能可讓服務代表您擔任[服務角色](https://docs.aws.amazon.com/service-authorization/latest/reference/id_roles_terms-and-concepts.html#iam-term-service-role)。此角色可讓服務存取其他服務中的資源，以代表您完成動作。服務角色會出現在您的 IAM 帳戶中，且由該帳戶所擁有。這表示 IAM 管理員可以變更此角色的許可。不過，這樣可能會破壞此服務的功能。

# AWS IoT 身分型政策範例
<a name="security_iam_id-based-policy-examples"></a>

根據預設，IAM 使用者和角色不具備建立或修改 AWS IoT 資源的許可。他們也無法使用 AWS 管理主控台 AWS CLI或 AWS API 執行任務。IAM 管理員必須建立 IAM 政策，授予使用者和角色在指定資源上執行特定 API 操作的所需許可。管理員接著必須將這些政策連接至需要這些許可的使用者或群組。

若要了解如何使用這些範例 JSON 政策文件建立 IAM 身分型政策，請參閱 *IAM 使用者指南*中的[在 JSON 索引標籤上建立政策](https://docs.aws.amazon.com/service-authorization/latest/reference/access_policies_create.html#access_policies_create-json-editor)。

**Topics**
+ [政策最佳實務](#security_iam_service-with-iam-policy-best-practices)
+ [使用 AWS IoT 主控台](#security_iam_id-based-policy-examples-console)
+ [允許使用者檢視他們自己的許可](#security_iam_id-based-policy-examples-view-own-permissions)
+ [根據標籤檢視 AWS IoT 資源](#security_iam_id-based-policy-examples-view-thing-tags)
+ [根據標籤檢視 AWS IoT Device Advisor 資源](#security_iam-device-advisor-tags)

## 政策最佳實務
<a name="security_iam_service-with-iam-policy-best-practices"></a>

身分型政策會判斷您帳戶中的某個人員是否可以建立、存取或刪除 AWS IoT 資源。這些動作可能會讓您的 AWS 帳戶產生費用。當您建立或編輯身分型政策時，請遵循下列準則及建議事項：
+ **開始使用 AWS 受管政策並轉向最低權限許可** – 若要開始將許可授予您的使用者和工作負載，請使用將許可授予許多常見使用案例的 *AWS 受管政策*。它們可在您的 中使用 AWS 帳戶。我們建議您定義特定於使用案例 AWS 的客戶受管政策，進一步減少許可。如需更多資訊，請參閱《*IAM 使用者指南*》中的 [AWS 受管政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#aws-managed-policies)或[任務職能的AWS 受管政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_job-functions.html)。
+ **套用最低權限許可** – 設定 IAM 政策的許可時，請僅授予執行任務所需的許可。為實現此目的，您可以定義在特定條件下可以對特定資源採取的動作，這也稱為*最低權限許可*。如需使用 IAM 套用許可的更多相關資訊，請參閱《*IAM 使用者指南*》中的 [IAM 中的政策和許可](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html)。
+ **使用 IAM 政策中的條件進一步限制存取權** – 您可以將條件新增至政策，以限制動作和資源的存取。例如，您可以撰寫政策條件，指定必須使用 SSL 傳送所有請求。如果透過特定 例如 使用服務動作 AWS 服務，您也可以使用條件來授予其存取權 CloudFormation。如需詳細資訊，請參閱《*IAM 使用者指南*》中的 [IAM JSON 政策元素：條件](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html)。
+ **使用 IAM Access Analyzer 驗證 IAM 政策，確保許可安全且可正常運作** – IAM Access Analyzer 驗證新政策和現有政策，確保這些政策遵從 IAM 政策語言 (JSON) 和 IAM 最佳實務。IAM Access Analyzer 提供 100 多項政策檢查及切實可行的建議，可協助您撰寫安全且實用的政策。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[使用 IAM Access Analyzer 驗證政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-policy-validation.html)。
+ **需要多重要素驗證 (MFA)** – 如果您的案例需要 IAM 使用者或 中的根使用者 AWS 帳戶，請開啟 MFA 以提高安全性。如需在呼叫 API 操作時請求 MFA，請將 MFA 條件新增至您的政策。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[透過 MFA 的安全 API 存取](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_configure-api-require.html)。

如需 IAM 中最佳實務的相關資訊，請參閱《*IAM 使用者指南*》中的 [IAM 安全最佳實務](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)。

## 使用 AWS IoT 主控台
<a name="security_iam_id-based-policy-examples-console"></a>

若要存取 AWS IoT 主控台，您必須擁有一組最低的許可。這些許可必須允許您列出和檢視 中 AWS IoT 資源的詳細資訊 AWS 帳戶。如果您建立比最基本必要許可更嚴格的身分型政策，則對於具有該政策的實體 (使用者或角色) 而言，主控台就無法如預期運作。

為了確保這些實體仍然可以使用 AWS IoT 主控台，請將下列 AWS 受管政策連接至實體：`AWSIoTFullAccess`。如需詳細資訊，請參閱《IAM 使用者指南》**中的[新增許可到使用者](https://docs.aws.amazon.com/service-authorization/latest/reference/id_users_change-permissions.html#users_change_permissions-add-console)。

對於僅呼叫 AWS CLI 或 AWS API 的使用者，您不需要允許最低主控台許可。反之，只需允許存取符合您嘗試執行之 API 操作的動作就可以了。

## 允許使用者檢視他們自己的許可
<a name="security_iam_id-based-policy-examples-view-own-permissions"></a>

此範例會示範如何建立政策，允許 IAM 使用者檢視附加到他們使用者身分的內嵌及受管政策。此政策包含在主控台或使用 或 AWS CLI AWS API 以程式設計方式完成此動作的許可。

```
{
    "Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "ViewOwnUserInfo",
            "Effect": "Allow",
            "Action": [
                "iam:GetUserPolicy",
                "iam:ListGroupsForUser",
                "iam:ListAttachedUserPolicies",
                "iam:ListUserPolicies",
                "iam:GetUser"
            ],
            "Resource": ["arn:aws:iam::*:user/${aws:username}"]
        },
        {
            "Sid": "NavigateInConsole",
            "Effect": "Allow",
            "Action": [
                "iam:GetGroupPolicy",
                "iam:GetPolicyVersion",
                "iam:GetPolicy",
                "iam:ListAttachedGroupPolicies",
                "iam:ListGroupPolicies",
                "iam:ListPolicyVersions",
                "iam:ListPolicies",
                "iam:ListUsers"
            ],
            "Resource": "*"
        }
    ]
}
```

## 根據標籤檢視 AWS IoT 資源
<a name="security_iam_id-based-policy-examples-view-thing-tags"></a>

您可以在身分型政策中使用條件，以根據標籤控制存取 AWS IoT 資源。此範例會示範如何建立政策，允許檢視物件。但是，只有在物件標籤 `Owner` 的值是該使用者的使用者名稱時，才會授予該許可。此政策也會授予在主控台完成此動作的必要許可。

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "ListBillingGroupsInConsole",
            "Effect": "Allow",
            "Action": "iot:ListBillingGroups",
            "Resource": "*"
        },
        {
            "Sid": "ViewBillingGroupsIfOwner",
            "Effect": "Allow",
           "Action": "iot:DescribeBillingGroup",
            "Resource": "arn:aws:iot:*:*:billinggroup/*",
            "Condition": {
                "StringEquals": {"aws:ResourceTag/Owner": "${aws:username}"}
        }
        }
    ]
}
```

您可以將此政策連接到您帳戶中的 IAM 使用者。如果名為 的使用者`richard-roe`嘗試檢視 AWS IoT 帳單群組，則帳單群組必須加上標籤 `Owner=richard-roe`或 `owner=richard-roe`。否則，他便會被拒絕存取。條件標籤鍵 `Owner` 符合 `Owner` 和 `owner`，因為條件索引鍵名稱不區分大小寫。如需詳細資訊，請參閱*《IAM 使用者指南》*中的 [IAM JSON 政策元素：條件](https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_elements_condition.html)。

## 根據標籤檢視 AWS IoT Device Advisor 資源
<a name="security_iam-device-advisor-tags"></a>

您可以在身分類型政策中使用條件，根據標籤來控制存取 AWS IoT Device Advisor 資源。以下範例顯示如何建立政策，允許檢視特定套件定義。不過，只在套件定義標籤已將 `SuiteType` 設定為值 `MQTT` 時，才會授予許可。此政策也會授予在主控台完成此動作的必要許可。

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "ViewSuiteDefinition",
            "Effect": "Allow",
            "Action": "iotdeviceadvisor:GetSuiteDefinition",
            "Resource": "arn:aws:iotdeviceadvisor:*:*:suitedefinition/*",
            "Condition": {
                "StringEquals": {"aws:ResourceTag/SuiteType": "MQTT"}
        }
        }
    ]
}
```

# AWS 的 受管政策 AWS IoT
<a name="security-iam-awsmanpol"></a>







若要新增許可給使用者、群組和角色，使用 AWS 受管政策比自行撰寫政策更容易。建立 [IAM 客戶受管政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create-console.html)需要時間和專業知識，而受管政策可為您的團隊提供其所需的許可。若要快速開始使用，您可以使用我們的 AWS 受管政策。這些政策涵蓋常見的使用案例，並可在您的 AWS 帳戶中使用。如需 AWS 受管政策的詳細資訊，請參閱《*IAM 使用者指南*》中的 [AWS 受管政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#aws-managed-policies)。

AWS 服務會維護和更新 AWS 受管政策。您無法變更 AWS 受管政策中的許可。服務偶爾會在 AWS 受管政策中新增其他許可以支援新功能。此類型的更新會影響已連接政策的所有身分識別 (使用者、群組和角色)。當新功能啟動或新操作可用時，服務很可能會更新 AWS 受管政策。服務不會從 AWS 受管政策移除許可，因此政策更新不會破壞您現有的許可。

此外， AWS 支援跨多個 服務之任務函數的受管政策。例如，**ReadOnlyAccess** AWS 受管政策提供所有 AWS 服務和資源的唯讀存取權。當服務啟動新功能時， AWS 會為新的操作和資源新增唯讀許可。如需任務職能政策的清單和說明，請參閱 *IAM 使用者指南*中[有關任務職能的AWS 受管政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_job-functions.html)。

**注意**  
AWS IoT 適用於 AWS IoT 和 IAM 政策。此主題僅討論 IAM 政策，此政策定義控制平面和資料平面 API 操作的政策動作。另請參閱[AWS IoT Core 政策](iot-policies.md)。









## AWS 受管政策：AWSIoTConfigAccess
<a name="security-iam-awsmanpol-AWSIoTConfigAccess"></a>





您可將 `AWSIoTConfigAccess` 政策連接到 IAM 身分。



此政策授予相關的身分許可，允許存取所有 AWS IoT 組態操作。此政策會影響資料處理和儲存。若要在 中檢視此政策 AWS 管理主控台，請參閱 [AWSIoTConfigAccess](https://console.aws.amazon.com//iam/home#/policies/arn:aws:iam::aws:policy/AWSIoTConfigAccess$jsonEditor?section=permissions)。



**許可詳細資訊**

此政策包含以下許可。




+ `iot` – 擷取 AWS IoT 資料並執行 IoT 組態動作。



****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "iot:AcceptCertificateTransfer",
                "iot:AddThingToThingGroup",
                "iot:AssociateTargetsWithJob",
                "iot:AttachPolicy",
                "iot:AttachPrincipalPolicy",
                "iot:AttachThingPrincipal",
                "iot:CancelCertificateTransfer",
                "iot:CancelJob",
                "iot:CancelJobExecution",
                "iot:ClearDefaultAuthorizer",
                "iot:CreateAuthorizer",
                "iot:CreateCertificateFromCsr",
                "iot:CreateJob",
                "iot:CreateKeysAndCertificate",
                "iot:CreateOTAUpdate",
                "iot:CreatePolicy",
                "iot:CreatePolicyVersion",
                "iot:CreateRoleAlias",
                "iot:CreateStream",
                "iot:CreateThing",
                "iot:CreateThingGroup",
                "iot:CreateThingType",
                "iot:CreateTopicRule",
                "iot:DeleteAuthorizer",
                "iot:DeleteCACertificate",
                "iot:DeleteCertificate",
                "iot:DeleteJob",
                "iot:DeleteJobExecution",
                "iot:DeleteOTAUpdate",
                "iot:DeletePolicy",
                "iot:DeletePolicyVersion",
                "iot:DeleteRegistrationCode",
                "iot:DeleteRoleAlias",
                "iot:DeleteStream",
                "iot:DeleteThing",
                "iot:DeleteThingGroup",
                "iot:DeleteThingType",
                "iot:DeleteTopicRule",
                "iot:DeleteV2LoggingLevel",
                "iot:DeprecateThingType",
                "iot:DescribeAuthorizer",
                "iot:DescribeCACertificate",
                "iot:DescribeCertificate",
                "iot:DescribeDefaultAuthorizer",
                "iot:DescribeEndpoint",
                "iot:DescribeEventConfigurations",
                "iot:DescribeIndex",
                "iot:DescribeJob",
                "iot:DescribeJobExecution",
                "iot:DescribeRoleAlias",
                "iot:DescribeStream",
                "iot:DescribeThing",
                "iot:DescribeThingGroup",
                "iot:DescribeThingRegistrationTask",
                "iot:DescribeThingType",
                "iot:DetachPolicy",
                "iot:DetachPrincipalPolicy",
                "iot:DetachThingPrincipal",
                "iot:DisableTopicRule",
                "iot:EnableTopicRule",
                "iot:GetEffectivePolicies",
                "iot:GetIndexingConfiguration",
                "iot:GetJobDocument",
                "iot:GetLoggingOptions",
                "iot:GetOTAUpdate",
                "iot:GetPolicy",
                "iot:GetPolicyVersion",
                "iot:GetRegistrationCode",
                "iot:GetTopicRule",
                "iot:GetV2LoggingOptions",
                "iot:ListAttachedPolicies",
                "iot:ListAuthorizers",
                "iot:ListCACertificates",
                "iot:ListCertificates",
                "iot:ListCertificatesByCA",
                "iot:ListIndices",
                "iot:ListJobExecutionsForJob",
                "iot:ListJobExecutionsForThing",
                "iot:ListJobs",
                "iot:ListOTAUpdates",
                "iot:ListOutgoingCertificates",
                "iot:ListPolicies",
                "iot:ListPolicyPrincipals",
                "iot:ListPolicyVersions",
                "iot:ListPrincipalPolicies",
                "iot:ListPrincipalThings",
                "iot:ListRoleAliases",
                "iot:ListStreams",
                "iot:ListTargetsForPolicy",
                "iot:ListThingGroups",
                "iot:ListThingGroupsForThing",
                "iot:ListThingPrincipals",
                "iot:ListThingRegistrationTaskReports",
                "iot:ListThingRegistrationTasks",
                "iot:ListThings",
                "iot:ListThingsInThingGroup",
                "iot:ListThingTypes",
                "iot:ListTopicRules",
                "iot:ListV2LoggingLevels",
                "iot:RegisterCACertificate",
                "iot:RegisterCertificate",
                "iot:RegisterThing",
                "iot:RejectCertificateTransfer",
                "iot:RemoveThingFromThingGroup",
                "iot:ReplaceTopicRule",
                "iot:SearchIndex",
                "iot:SetDefaultAuthorizer",
                "iot:SetDefaultPolicyVersion",
                "iot:SetLoggingOptions",
                "iot:SetV2LoggingLevel",
                "iot:SetV2LoggingOptions",
                "iot:StartThingRegistrationTask",
                "iot:StopThingRegistrationTask",
                "iot:TestAuthorization",
                "iot:TestInvokeAuthorizer",
                "iot:TransferCertificate",
                "iot:UpdateAuthorizer",
                "iot:UpdateCACertificate",
                "iot:UpdateCertificate",
                "iot:UpdateEventConfigurations",
                "iot:UpdateIndexingConfiguration",
                "iot:UpdateRoleAlias",
                "iot:UpdateStream",
                "iot:UpdateThing",
                "iot:UpdateThingGroup",
                "iot:UpdateThingGroupsForThing",
                "iot:UpdateAccountAuditConfiguration",
                "iot:DescribeAccountAuditConfiguration",
                "iot:DeleteAccountAuditConfiguration",
                "iot:StartOnDemandAuditTask",
                "iot:CancelAuditTask",
                "iot:DescribeAuditTask",
                "iot:ListAuditTasks",
                "iot:CreateScheduledAudit",
                "iot:UpdateScheduledAudit",
                "iot:DeleteScheduledAudit",
                "iot:DescribeScheduledAudit",
                "iot:ListScheduledAudits",
                "iot:ListAuditFindings",
                "iot:CreateSecurityProfile",
                "iot:DescribeSecurityProfile",
                "iot:UpdateSecurityProfile",
                "iot:DeleteSecurityProfile",
                "iot:AttachSecurityProfile",
                "iot:DetachSecurityProfile",
                "iot:ListSecurityProfiles",
                "iot:ListSecurityProfilesForTarget",
                "iot:ListTargetsForSecurityProfile",
                "iot:ListActiveViolations",
                "iot:ListViolationEvents",
                "iot:ValidateSecurityProfileBehaviors"
            ],
            "Resource": "*"
        }
    ]
}
```

## AWS 受管政策：AWSIoTConfigReadOnlyAccess
<a name="security-iam-awsmanpol-AWSIoTConfigReadOnlyAccess"></a>





您可將 `AWSIoTConfigReadOnlyAccess` 政策連接到 IAM 身分。



此政策授予相關的身分許可，允許以唯讀方式存取所有 AWS IoT 組態操作。若要在 中檢視此政策 AWS 管理主控台，請參閱 [AWSIoTConfigReadOnlyAccess](https://console.aws.amazon.com//iam/home#/policies/arn:aws:iam::aws:policy/AWSIoTConfigReadOnlyAccess$jsonEditor?section=permissions)。



**許可詳細資訊**

此政策包含以下許可。




+ `iot` – 執行 IoT 組態操作的唯獨操作。



****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "iot:DescribeAuthorizer",
                "iot:DescribeCACertificate",
                "iot:DescribeCertificate",
                "iot:DescribeDefaultAuthorizer",
                "iot:DescribeEndpoint",
                "iot:DescribeEventConfigurations",
                "iot:DescribeIndex",
                "iot:DescribeJob",
                "iot:DescribeJobExecution",
                "iot:DescribeRoleAlias",
                "iot:DescribeStream",
                "iot:DescribeThing",
                "iot:DescribeThingGroup",
                "iot:DescribeThingRegistrationTask",
                "iot:DescribeThingType",
                "iot:GetEffectivePolicies",
                "iot:GetIndexingConfiguration",
                "iot:GetJobDocument",
                "iot:GetLoggingOptions",
                "iot:GetOTAUpdate",
                "iot:GetPolicy",
                "iot:GetPolicyVersion",
                "iot:GetRegistrationCode",
                "iot:GetTopicRule",
                "iot:GetV2LoggingOptions",
                "iot:ListAttachedPolicies",
                "iot:ListAuthorizers",
                "iot:ListCACertificates",
                "iot:ListCertificates",
                "iot:ListCertificatesByCA",
                "iot:ListIndices",
                "iot:ListJobExecutionsForJob",
                "iot:ListJobExecutionsForThing",
                "iot:ListJobs",
                "iot:ListOTAUpdates",
                "iot:ListOutgoingCertificates",
                "iot:ListPolicies",
                "iot:ListPolicyPrincipals",
                "iot:ListPolicyVersions",
                "iot:ListPrincipalPolicies",
                "iot:ListPrincipalThings",
                "iot:ListRoleAliases",
                "iot:ListStreams",
                "iot:ListTargetsForPolicy",
                "iot:ListThingGroups",
                "iot:ListThingGroupsForThing",
                "iot:ListThingPrincipals",
                "iot:ListThingRegistrationTaskReports",
                "iot:ListThingRegistrationTasks",
                "iot:ListThings",
                "iot:ListThingsInThingGroup",
                "iot:ListThingTypes",
                "iot:ListTopicRules",
                "iot:ListV2LoggingLevels",
                "iot:SearchIndex",
                "iot:TestAuthorization",
                "iot:TestInvokeAuthorizer",
                "iot:DescribeAccountAuditConfiguration",
                "iot:DescribeAuditTask",
                "iot:ListAuditTasks",
                "iot:DescribeScheduledAudit",
                "iot:ListScheduledAudits",
                "iot:ListAuditFindings",
                "iot:DescribeSecurityProfile",
                "iot:ListSecurityProfiles",
                "iot:ListSecurityProfilesForTarget",
                "iot:ListTargetsForSecurityProfile",
                "iot:ListActiveViolations",
                "iot:ListViolationEvents",
                "iot:ValidateSecurityProfileBehaviors"
            ],
            "Resource": "*"
        }
    ]
}
```

## AWS 受管政策：AWSIoTDataAccess
<a name="security-iam-awsmanpol-AWSIoTDataAccess"></a>





您可將 `AWSIoTDataAccess` 政策連接到 IAM 身分。



此政策會授予相關的身分許可，以允許存取 AWS IoT 所有資料操作。資料操作則可透過 MQTT 或 HTTP 通訊協定傳送資料。若要在 AWS 管理主控台中檢視此政策，請參閱 [https://console.aws.amazon.com//iam/home#/policies/arn:aws:iam::aws:policy/AWSIoTDataAccess?section=permissions](https://console.aws.amazon.com//iam/home#/policies/arn:aws:iam::aws:policy/AWSIoTDataAccess?section=permissions)。



**許可詳細資訊**

此政策包含以下許可。




+ `iot` – 擷取 AWS IoT 資料並允許完整存取 AWS IoT 簡訊動作。



****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "iot:Connect",
                "iot:Publish",
                "iot:Subscribe",
                "iot:Receive",
                "iot:GetThingShadow",
                "iot:UpdateThingShadow",
                "iot:DeleteThingShadow",
                "iot:ListNamedShadowsForThing"
            ],
            "Resource": "*"
        }
    ]
}
```

## AWS 受管政策：AWSIoTFullAccess
<a name="security-iam-awsmanpol-AWSIoTFullAccess"></a>





您可將 `AWSIoTFullAccess` 政策連接到 IAM 身分。



此政策授予相關的身分許可，允許完整存取所有 AWS IoT 組態和簡訊操作。若要在 中檢視此政策 AWS 管理主控台，請參閱 [https://console.aws.amazon.com//iam/home#/policies/arn:aws:iam::aws:policy/AWSIoTFullAccess?section=permissions](https://console.aws.amazon.com//iam/home#/policies/arn:aws:iam::aws:policy/AWSIoTFullAccess?section=permissions)。



**許可詳細資訊**

此政策包含以下許可。




+ `iot` – 擷取 AWS IoT 資料並允許完整存取 AWS IoT 組態和簡訊動作。
+ `iotjobsdata` – 擷取 AWS IoT 任務資料，並允許完整存取 AWS IoT 任務資料平面 API 操作。



****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "iot:*",
                "iotjobsdata:*"
            ],
            "Resource": "*"
        }
    ]
}
```

## AWS 受管政策：AWSIoTLogging
<a name="security-iam-awsmanpol-AWSIoTLogging"></a>





您可將 `AWSIoTLogging` 政策連接到 IAM 身分。



此政策授予相關的身分許可，允許建立 Amazon CloudWatch Logs 日誌群組，以及將日誌串流至群組。此政策會連接至您的 CloudWatch 記錄角色。若要在 中檢視此政策 AWS 管理主控台，請參閱 [https://console.aws.amazon.com//iam/home#/policies/arn:aws:iam::aws:policy/AWSIoTLogging?section=permissions](https://console.aws.amazon.com//iam/home#/policies/arn:aws:iam::aws:policy/AWSIoTLogging?section=permissions)。



**許可詳細資訊**

此政策包含以下許可。




+ `logs` – 擷取 CloudWatch 日誌。此外，也允許建立 CloudWatch 日誌群組，以及將日誌串流至群組。



****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "logs:CreateLogGroup",
                "logs:CreateLogStream",
                "logs:PutLogEvents",
                "logs:PutMetricFilter",
                "logs:PutRetentionPolicy",
                "logs:GetLogEvents",
                "logs:DeleteLogStream"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}
```

## AWS 受管政策：AWSIoTOTAUpdate
<a name="security-iam-awsmanpol-AWSIoTOTAUpdate"></a>





您可將 `AWSIoTOTAUpdate` 政策連接到 IAM 身分。



此政策會授予相關聯的身分許可，允許建立 AWS IoT 任務、 AWS IoT 程式碼簽署任務，以及描述 AWS 程式碼簽署者任務的存取權。若要在 中檢視此政策 AWS 管理主控台，請參閱 [`AWSIoTOTAUpdate`。](https://console.aws.amazon.com//iam/home#/policies/arn:aws:iam::aws:policy/AWSIoTOTAUpdate?section=permissions)



**許可詳細資訊**

此政策包含以下許可。




+ `iot` – 建立 AWS IoT 任務和程式碼簽署任務。
+ `signer` – 執行 AWS 程式碼簽署者任務的建立。



****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": {
        "Effect": "Allow",
        "Action": [
            "iot:CreateJob",
            "signer:DescribeSigningJob"
        ],
        "Resource": "*"
    }
}
```

## AWS 受管政策：AWSIoTRuleActions
<a name="security-iam-awsmanpol-AWSIoTRuleActions"></a>





您可將 `AWSIoTRuleActions` 政策連接到 IAM 身分。



此政策會授予相關聯的身分許可，允許存取 AWS IoT 規則動作中 AWS 服務支援的所有 。若要在 中檢視此政策 AWS 管理主控台，請參閱 [https://console.aws.amazon.com//iam/home#/policies/arn:aws:iam::aws:policy/AWSIoTRuleActions?section=permissions](https://console.aws.amazon.com//iam/home#/policies/arn:aws:iam::aws:policy/AWSIoTRuleActions?section=permissions)。



**許可詳細資訊**

此政策包含以下許可。




+ `iot` - 執行發佈規則動作訊息的動作。
+ `dynamodb` - 將訊息插入 DynamoDB 表格，或將訊息拆分至 DynamoDB 表格中多個欄。
+ `s3` - 將物件存放在 Amazon S3 儲存貯體中。
+ `kinesis` - 向 Amazon Kinesis 串流物件發送訊息。
+ `firehose` - 在 Firehose 串流物件中插入記錄。
+ `cloudwatch` - 變更 CloudWatch 警示狀態，或將訊息資料發送到 CloudWatch 指標。
+ `sns` - 執行使用 Amazon SNS 發佈通知的操作。此操作的範圍為 AWS IoT SNS 主題。
+ `sqs` - 插入要新增至 SQS 佇列的訊息。
+ `es` - 向 OpenSearch Service 服務發送訊息。



****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": {
        "Effect": "Allow",
        "Action": [
            "dynamodb:PutItem",
            "kinesis:PutRecord",
            "iot:Publish",
            "s3:PutObject",
            "sns:Publish",
            "sqs:SendMessage*",
            "cloudwatch:SetAlarmState",
            "cloudwatch:PutMetricData",
            "es:ESHttpPut",
            "firehose:PutRecord"
        ],
        "Resource": "*"
    }
}
```

## AWS 受管政策：AWSIoTThingsRegistration
<a name="security-iam-awsmanpol-AWSIoTThingsRegistration"></a>





您可將 `AWSIoTThingsRegistration` 政策連接到 IAM 身分。



此政策授予相關的身分許可，允許使用 `StartThingRegistrationTask` API 大量註冊物件。此政策會影響資料處理和儲存。若要在 中檢視此政策 AWS 管理主控台，請參閱 [https://console.aws.amazon.com//iam/home#/policies/arn:aws:iam::aws:policy/AWSIoTThingsRegistration?section=permissions](https://console.aws.amazon.com//iam/home#/policies/arn:aws:iam::aws:policy/AWSIoTThingsRegistration?section=permissions)。



**許可詳細資訊**

此政策包含以下許可。




+ `iot` - 進行大量註冊時，執行建立物件並附加政策和憑證的動作。



****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "iot:AddThingToThingGroup",
                "iot:AttachPolicy",
                "iot:AttachPrincipalPolicy",
                "iot:AttachThingPrincipal",
                "iot:CreateCertificateFromCsr",
                "iot:CreatePolicy",
                "iot:CreateThing",
                "iot:DescribeCertificate",
                "iot:DescribeThing",
                "iot:DescribeThingGroup",
                "iot:DescribeThingType",
                "iot:DetachPolicy",
                "iot:DetachThingPrincipal",
                "iot:GetPolicy",
                "iot:ListAttachedPolicies",
                "iot:ListPolicyPrincipals",
                "iot:ListPrincipalPolicies",
                "iot:ListPrincipalThings",
                "iot:ListTargetsForPolicy",
                "iot:ListThingGroupsForThing",
                "iot:ListThingPrincipals",
                "iot:RegisterCertificate",
                "iot:RegisterThing",
                "iot:RemoveThingFromThingGroup",
                "iot:UpdateCertificate",
                "iot:UpdateThing",
                "iot:UpdateThingGroupsForThing",
                "iot:AddThingToBillingGroup",
                "iot:DescribeBillingGroup",
                "iot:RemoveThingFromBillingGroup"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}
```





## AWS IoT AWS 受管政策的更新
<a name="security-iam-awsmanpol-updates"></a>



檢視自此服務開始追蹤這些變更 AWS IoT 以來， AWS 受管政策更新的詳細資訊。如需此頁面變更的自動提醒，請訂閱 AWS IoT 文件歷史記錄頁面上的 RSS 摘要。




| 變更 | 描述 | Date | 
| --- | --- | --- | 
|  [AWSIoTFullAccess](#security-iam-awsmanpol-AWSIoTFullAccess) – 更新現有政策  |  AWS IoT 新增了許可，允許使用者使用 HTTP 通訊協定存取 AWS IoT 任務資料平面 API 操作。 新的 IAM 政策字首 `iotjobsdata:`為您提供更精細的存取控制，以存取 AWS IoT 任務資料平面端點。對於控制平面 API 操作，請依舊使用 `iot:` 字首。如需詳細資訊，請參閱[AWS IoT Core HTTPS 通訊協定的 政策](iot-data-plane-jobs.md#iot-jobs-data-http)。  | 2022 年 5 月 11 日 | 
|  AWS IoT 開始追蹤變更  |  AWS IoT 已開始追蹤其 AWS 受管政策的變更。  | 2022 年 5 月 11 日 | 

# 對 AWS IoT 身分和存取進行故障診斷
<a name="security_iam_troubleshoot"></a>

使用以下資訊來協助您診斷和修正使用 AWS IoT 和 IAM 時可能遇到的常見問題。

**Topics**
+ [我無權在 中執行動作 AWS IoT](#security_iam_troubleshoot-no-permissions)
+ [我未獲得執行 iam:PassRole 的授權](#security_iam_troubleshoot-passrole)
+ [我想要允許 以外的人員 AWS 帳戶 存取我的 AWS IoT 資源](#security_iam_troubleshoot-cross-account-access)

## 我無權在 中執行動作 AWS IoT
<a name="security_iam_troubleshoot-no-permissions"></a>

如果您收到錯誤，告知您未獲授權執行動作，您的政策必須更新，允許您執行動作。

下列範例錯誤會在 IAM 使用者 `mateojackson` 嘗試使用主控台檢視物件資源的詳細資訊，但並無 `iot:DescribeThing` 許可權限時發生。

```
User: arn:aws:iam::123456789012:user/mateojackson is not authorized to perform: iot:DescribeThing on resource: MyIoTThing
```

於此情況下，必須更新 `mateojackson` 使用者的政策，允許使用 `iot:DescribeThing` 動作存取物件資源。

如果您需要協助，請聯絡您的 AWS 管理員。您的管理員提供您的簽署憑證。

使用 AWS IoT Device Advisor  
如果您使用 AWS IoT Device Advisor，當使用者`mateojackson`嘗試使用主控台檢視套件定義的詳細資訊，但沒有 `iotdeviceadvisor:GetSuiteDefinition`許可時，會發生下列範例錯誤。  

```
User: arn:aws:iam::123456789012:user/mateojackson is not authorized to perform: iotdeviceadvisor:GetSuiteDefinition on resource: MySuiteDefinition
```
於此情況下，必須更新 `mateojackson` 使用者的政策，允許使用 `iotdeviceadvisor:GetSuiteDefinition` 動作存取 *`MySuiteDefinition`* 資源。

## 我未獲得執行 iam:PassRole 的授權
<a name="security_iam_troubleshoot-passrole"></a>

如果您收到錯誤，告知您未獲授權執行 `iam:PassRole` 動作，您的政策必須更新，允許您將角色傳遞給 AWS IoT。

有些 AWS 服務 可讓您將現有角色傳遞給該服務，而不是建立新的服務角色或服務連結角色。如需執行此作業，您必須擁有將角色傳遞至該服務的許可。

名為 `marymajor` 的 IAM 使用者嘗試使用主控台在 AWS IoT中執行動作時，發生下列範例錯誤。但是，動作要求服務具備服務角色授予的許可。Mary 沒有將角色傳遞給服務的許可。

```
User: arn:aws:iam::123456789012:user/marymajor is not authorized to perform: iam:PassRole
```

在這種情況下，Mary 的政策必須更新，允許她執行 `iam:PassRole` 動作。

如果您需要協助，請聯絡您的 AWS 管理員。您的管理員提供您的簽署憑證。

## 我想要允許 以外的人員 AWS 帳戶 存取我的 AWS IoT 資源
<a name="security_iam_troubleshoot-cross-account-access"></a>

您可以建立一個角色，讓其他帳戶中的使用者或您組織外部的人員存取您的資源。您可以指定要允許哪些信任物件取得該角色。針對支援基於資源的政策或存取控制清單 (ACL) 的服務，您可以使用那些政策來授予人員存取您的資源的許可。

如需進一步了解，請參閱以下內容：
+ 若要了解 是否 AWS IoT 支援這些功能，請參閱 [AWS IoT 如何使用 IAM](security_iam_service-with-iam.md)。
+ 若要了解如何提供您擁有 AWS 帳戶 的資源存取權，請參閱《[IAM 使用者指南》中的在您擁有 AWS 帳戶 的另一個 中為 IAM 使用者提供存取權](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_aws-accounts.html)。 **
+ 若要了解如何將資源的存取權提供給第三方 AWS 帳戶，請參閱《*IAM 使用者指南*》中的[將存取權提供給第三方 AWS 帳戶 擁有](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_third-party.html)。
+ 如需了解如何透過聯合身分提供存取權，請參閱《*IAM 使用者指南*》中的[將存取權提供給在外部進行身分驗證的使用者 (聯合身分)](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_federated-users.html)。
+ 如需了解使用角色和資源型政策進行跨帳戶存取之間的差異，請參閱《*IAM 使用者指南*》中的 [IAM 中的跨帳戶資源存取](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-cross-account-resource-access.html)。