設定績效詳情的存取政策 - Amazon DocumentDB

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

設定績效詳情的存取政策

若要存取績效詳情,您必須具有來自 AWS Identity and Access Management (IAM) 的適用許可。您可以使用下列選項授予存取權:

  • AmazonRDSPerformanceInsightsReadOnly 受管政策連接到許可集或角色。

  • 建立自訂 IAM 政策,並將其連接至許可集或角色。

此外,如果您在開啟績效詳情時指定客戶受管金鑰,請確保您帳戶中的使用者具備 KMS 金鑰的 kms:Decryptkms:GenerateDataKey 許可。

將亞馬遜 RDS PerformanceInsightsReadOnly 政策附加到 IAM 主體

AmazonRDSPerformanceInsightsReadOnly這是一項AWS受管政策,可授予對 Amazon DocumentDB Performance Insights API 所有唯讀操作的存取權。目前,此 API 中的所有操作都是唯讀操作。若您將 AmazonRDSPerformanceInsightsReadOnly 連接至許可集或角色,收件人可使用績效詳情搭配其他主控台功能。

建立績效詳情的自訂 IAM 政策

對於沒有 AmazonRDSPerformanceInsightsReadOnly 政策提供的使用者,您可以建立或修改由使用者管理的 IAM 政策來授予績效詳情的存取權。當您將原則附加至權限集或角色時,收件者可以使用 Performance Insights。

建立自訂政策
  1. 前往網址 https://console.aws.amazon.com/iam/ 開啟 IAM 主控台。

  2. 在導覽窗格中,選擇 政策

  3. 選擇 Create policy (建立政策)。

  4. Create Policy (建立政策) 頁面上,選擇 JSON 標籤。

  5. 複製並貼上以下文字,將 us-east-1 換成您的 AWS 區域名稱,將 111122223333 換成您的客戶帳戶號碼。

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "rds:DescribeDBInstances", "Resource": "*" }, { "Effect": "Allow", "Action": "rds:DescribeDBClusters", "Resource": "*" }, { "Effect": "Allow", "Action": "pi:DescribeDimensionKeys", "Resource": "arn:aws:pi:us-east-1:111122223333:metrics/rds/*" }, { "Effect": "Allow", "Action": "pi:GetDimensionKeyDetails", "Resource": "arn:aws:pi:us-east-1:111122223333:metrics/rds/*" }, { "Effect": "Allow", "Action": "pi:GetResourceMetadata", "Resource": "arn:aws:pi:us-east-1:111122223333:metrics/rds/*" }, { "Effect": "Allow", "Action": "pi:GetResourceMetrics", "Resource": "arn:aws:pi:us-east-1:111122223333:metrics/rds/*" }, { "Effect": "Allow", "Action": "pi:ListAvailableResourceDimensions", "Resource": "arn:aws:pi:us-east-1:111122223333:metrics/rds/*" }, { "Effect": "Allow", "Action": "pi:ListAvailableResourceMetrics", "Resource": "arn:aws:pi:us-east-1:111122223333:metrics/rds/*" } ] }
  6. 選擇 Review policy (檢閱政策)。

  7. 為政策提供名稱並選擇性輸入描述,然後選擇 Create policy (建立政策)

現在您可以將政策連接到許可集或角色。以下程序假設您已有基於此用途使用的使用者。

將政策連接至使用者
  1. 在以下網址開啟 IAM 主控台:https://console.aws.amazon.com/iam/

  2. 在導覽窗格中,選擇 Users (使用者)。

  3. 從清單中選擇現有的使用者。

    重要

    若要使用 Performance Insights,請確定除了自訂政策之外,您還可以存取 Amazon DocumentDB。例如,資AmazonDoc料庫ReadOnlyAccess預先定義的政策提供 Amazon 文件的唯讀存取權。如需詳細資訊,請參閱使用政策管理存取

  4. Summary (摘要) 頁面上,選擇 Add permissions (新增許可)。

  5. 選擇 Attach existing policies directly (直接連接現有政策)。對於 Search (搜尋),請輸入政策名稱的前幾個字母,如下所示。

    選擇一個政策
  6. 選擇您的政策,然後選擇 Next: Review (下一步:檢閱)

  7. 選擇 Add permissions (新增許可)。

設定績效詳情的 AWS KMS 政策

績效詳情使用 AWS KMS key加密敏感資料。當您透過 API 或主控台啟用績效詳情時,可使用下列選項:

  • 選擇預設 AWS 受管金鑰。

    Amazon DocumentDB 將用AWS 受管金鑰於您的新資料庫執行個體。Amazon DocumentDB 為您的帳戶創建AWS 受管金鑰一個AWS。您的AWS帳戶對於每AWS個區域AWS 受管金鑰的 Amazon DocumentDB 有不同。

  • 選擇客戶受管金鑰。

    如果您指定客戶受管金鑰,則您帳戶中呼叫績效詳情 API 的使用者需要 KMS 金鑰的 kms:Decryptkms:GenerateDataKey 許可。您可以透過 IAM 政策設定這些許可。不過,我們建議您透過 KMS 金鑰政策來管理這些許可。如需詳細資訊,請參閱在 AWS KMS 中使用金鑰政策

下列範例金鑰政策說明如何將陳述式新增至 KMS 金鑰政策。這些陳述式允許存取績效詳情。根據您的使用方式AWS KMS,您可能需要變更某些限制。在將陳述式新增至您的政策之前,請先移除所有註解。

{ "Version" : "2012-10-17", "Id" : "your-policy", "Statement" : [ { //This represents a statement that currently exists in your policy. } ...., //Starting here, add new statement to your policy for Performance Insights. //We recommend that you add one new statement for every RDS/DocumentDB instance { "Sid" : "Allow viewing RDS Performance Insights", "Effect": "Allow", "Principal": { "AWS": [ //One or more principals allowed to access Performance Insights "arn:aws:iam::444455556666:role/Role1" ] }, "Action": [ "kms:Decrypt", "kms:GenerateDataKey" ], "Resource": "*", "Condition" :{ "StringEquals" : { //Restrict access to only RDS APIs (including Performance Insights). //Replace *region* with your AWS Region. //For example, specify us-west-2. "kms:ViaService" : "rds.*region*.amazonaws.com" }, "ForAnyValue:StringEquals": { //Restrict access to only data encrypted by Performance Insights. "kms:EncryptionContext:aws:pi:service": "rds", "kms:EncryptionContext:service": "pi", //Restrict access to a specific DocDB instance. //The value is a DbiResourceId. "kms:EncryptionContext:aws:rds:db-id": "db-AAAAABBBBBCCCCDDDDDEEEEE" } } }