

Amazon Monitron 不再向新客戶開放。現有客戶可以繼續正常使用該服務。如需類似 Amazon Monitron 的功能，請參閱我們的[部落格文章](https://aws.amazon.com/blogs/machine-learning/maintain-access-and-consider-alternatives-for-amazon-monitron)。

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

# Amazon Monitron 如何與 IAM 搭配使用
<a name="security_iam_service-with-iam"></a>

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

**Topics**
+ [Amazon Monitron 身分型政策](#security_iam_service-with-iam-id-based-policies)
+ [Amazon Monitron 資源型政策](#security_iam_service-with-iam-resource-based-policies)
+ [以 Amazon Monitron 標籤為基礎的授權](#security_iam_service-with-iam-tags)
+ [Amazon Monitron IAM 角色](#security_iam_service-with-iam-roles)
+ [Amazon Monitron 身分型政策範例](#security_iam_id-based-policy-examples)
+ [Amazon Monitron Identity and Access 疑難排解](#security_iam_troubleshoot)

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

若要指定允許或拒絕的動作和資源，以及允許或拒絕動作的條件，請使用 IAM 身分型政策。Amazon Monitron 支援特定動作、資源和條件金鑰。若要了解您在 JSON 政策中使用的所有元素，請參閱 *IAM 使用者指南*中的 [JSON 政策元素參考](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html)。

**Topics**
+ [動作](#security_iam_service-with-iam-id-based-policies-actions)
+ [Resources](#security_iam_service-with-iam-id-based-policies-resources)
+ [條件金鑰](#security_iam_service-with-iam-id-based-policies-conditionkeys)
+ [範例](#security_iam_service-with-iam-id-based-policies-examples)

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

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

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

在 Amazon Monitron 中，政策動作在動作之前使用下列字首：`monitron:`。例如，若要授予某人使用 Amazon Monitron `CreateProject`操作建立專案的許可，請在其政策中包含 `monitron:CreateProject`動作。政策陳述式必須包含 `Action` 或 `NotAction` 元素。Amazon Monitron 會定義自己的一組動作，描述您可以使用此服務執行的任務。

**注意**  
使用 `deleteProject`操作時，您必須擁有 AWS IAM Identity Center (SSO) 刪除許可。如果沒有這些許可，刪除功能仍會移除專案。不過，它不會從 SSO 移除資源，而且您可能會最終在 SSO 上產生懸置參考。

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

```
"Action": [
      "monitron:action1",
      "monitron:action2"
]
```

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

```
"Action": "monitron:List*"
```

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

Amazon Monitron 不支援在政策中指定資源 ARNs。

### 條件金鑰
<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)。

Amazon Monitron 定義自己的一組條件金鑰，也支援使用一些全域條件金鑰。如需所有 AWS 全域條件金鑰的清單，請參閱《*IAM 使用者指南*》中的[AWS 全域條件內容金鑰](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html)。

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

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

若要檢視 Amazon Monitron 身分型政策的範例，請參閱 [Amazon Monitron 身分型政策範例](#security_iam_id-based-policy-examples)。

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

Amazon Monitron 不支援以資源為基礎的政策。

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

您可以將標籤與特定類型的 Amazon Monitron 資源建立關聯以進行授權。若要根據標籤控制存取，請使用 `aws:RequestTag/${TagKey}`、 `Amazon Monitron:TagResource/${TagKey}`或 [條件索引鍵，在政策的條件元素](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html)中提供`aws:TagKeys`標籤資訊。

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

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

### 搭配 Amazon Monitron 使用暫時登入資料
<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 操作來取得臨時安全登入資料。

Amazon Monitron 支援使用臨時登入資料。

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

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

Amazon Monitron 支援服務連結角色。

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

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

Amazon Monitron 支援服務角色。

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

根據預設，IAM 使用者和角色沒有建立或修改 Amazon Monitron 資源的許可。他們也無法使用 執行任務 AWS 管理主控台。IAM 管理員必須將許可授予需要它們的 IAM 使用者、群組或角色。然後，這些使用者、群組或角色可以對他們所需的指定資源執行特定操作。管理員接著必須將這些政策連接至需要這些許可的 IAM 使用者或群組。

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

**Topics**
+ [政策最佳實務](#security_iam_service-with-iam-policy-best-practices)
+ [使用 Amazon Monitron 主控台](#security_iam_id-based-policy-examples-console)
+ [範例：列出所有 Amazon Monitron 專案](#security_iam_id-based-policy-examples-access-one-bucket)
+ [範例：根據標籤列出 Amazon Monitron 專案](#security_iam_id-based-policy-examples-view-widget-tags)

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

身分型政策會判斷您帳戶中的某個人員是否可以建立、存取或刪除 Amazon Monitron 資源。這些動作可能會讓您的 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)。

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

若要使用主控台設定 Amazon Monitron，請使用高權限使用者 （例如連接`AdministratorAccess`受管政策的使用者） 完成初始設定程序。

若要在初始設定後存取 Amazon Monitron day-to-day操作，您必須擁有一組最低許可。這些許可必須允許您列出和檢視 AWS 帳戶中 Amazon Monitron 資源的詳細資訊，並包含一組與 IAM Identity Center 相關的許可。如果您建立比這些最低必要許可更嚴格的身分型政策，則主控台將無法對具有該政策的實體 (IAM 使用者或角色） 如預期般運作。如需基本的 Amazon Monitron 主控台功能，您需要連接 `AmazonMonitronFullAccess`受管政策。視情況而定，您可能還需要對 Organizations and SSO 服務的額外許可。如果您需要詳細資訊，請聯絡 AWS 支援。

### 範例：列出所有 Amazon Monitron 專案
<a name="security_iam_id-based-policy-examples-access-one-bucket"></a>

此範例政策授予您 AWS 帳戶中的 IAM 使用者列出您帳戶中所有專案的許可。

### 範例：根據標籤列出 Amazon Monitron 專案
<a name="security_iam_id-based-policy-examples-view-widget-tags"></a>

您可以在身分型政策中使用條件，根據標籤控制對 Amazon Monitron 資源的存取。此範例示範如何建立允許列出專案的政策。不過，只有在專案標籤的值`location`為 時，才會授予許可`Seattle`。此政策也會授予在主控台完成此動作的必要許可。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "ListProjectsInConsole",
            "Effect": "Allow",
            "Action": "monitron:ListProjects",
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "aws:ResourceTag/location": "Seattle"
                }
            }
        }
    ]
}
```

------

如需詳細資訊，請參閱*《IAM 使用者指南》*中的 [IAM JSON 政策元素：條件](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html)。

## Amazon Monitron Identity and Access 疑難排解
<a name="security_iam_troubleshoot"></a>

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

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

### 我未獲授權在 Amazon Monitron 中執行動作
<a name="security_iam_troubleshoot-no-permissions"></a>

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

下列範例錯誤會在`mateojackson` IAM 使用者嘗試使用主控台檢視一個虛構 `{{my-example-widget}}` 資源的詳細資訊，但卻無虛構 `monitron:{{GetWidget}}` 許可時發生。

```
User: arn:aws:iam::123456789012:user/mateojackson is not authorized to perform: monitron:{{GetWidget}} on resource: {{my-example-widget}}
```

在此情況下，必須更新 `mateojackson` 使用者的政策，允許使用 `monitron:{{GetWidget}}` 動作存取 `{{my-example-widget}}` 資源。

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

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

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

如需進一步了解，請參閱以下內容：
+ 若要了解 Amazon Monitron 是否支援這些功能，請參閱 [Amazon Monitron 如何與 IAM 搭配使用](#security_iam_service-with-iam)。
+ 若要了解如何 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)。