靜態加密 - Amazon Managed Service for Prometheus

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

靜態加密

根據預設,Amazon Managed Service for Prometheus 會自動為您提供靜態加密,並使用 AWS 擁有的加密金鑰來執行此操作。

  • AWS 擁有的金鑰 – Amazon Managed Service for Prometheus 使用這些金鑰自動加密上傳至工作區的資料。您無法檢視、管理或使用 AWS 擁有的金鑰,或稽核其使用。不過,您不需要採取任何動作或變更任何程式,即可保護加密您資料的金鑰。如需詳細資訊,請參閱《AWS Key Management Service 開發人員指南》中的 AWS 擁有的金鑰

加密靜態資料有助於減少保護敏感客戶資料 (例如個人可識別資訊) 的營運成本並降低複雜性。這可讓您建立符合嚴格加密合規性或管制需求的安全應用程式。

您也可以在建立工作區時,選擇使用客戶受管金鑰:

  • 客戶受管金鑰:Amazon Managed Service for Prometheus 支援使用您建立、擁有並管理的對稱客戶受管金鑰來加密工作區中的資料。由於您可以完全控管此加密,因此能執行以下任務:

    • 建立和維護金鑰政策

    • 建立和維護 IAM 政策和授予操作

    • 啟用和停用金鑰政策

    • 輪換金鑰密碼編譯資料

    • 新增標籤

    • 建立金鑰別名

    • 安排金鑰供刪除

    如需詳細資訊,請參閱《AWS Key Management Service 開發人員指南》中的客戶自管金鑰

選擇是否謹慎使用客戶受管金鑰或 AWS 擁有的金鑰。使用客戶受管金鑰建立的工作區無法轉換為稍後使用 AWS 擁有的金鑰 (反之亦然)。

注意

Amazon Managed Service for Prometheus 使用 AWS 擁有的金鑰自動啟用靜態加密,以免費保護您的資料。

不過,使用客戶受管金鑰需 AWS KMS 付費。如需定價的詳細資訊,請參閱 AWS Key Management Service 定價

如需詳細資訊 AWS KMS,請參閱什麼是 AWS Key Management Service?

注意

使用客戶受管金鑰建立的工作區無法使用 AWS 受管收集器進行擷取。

Amazon Managed Service for Prometheus 如何在 中使用授予 AWS KMS

Amazon Managed Service for Prometheus 需要三個授權才能使用您的客戶受管金鑰。

當您建立使用客戶受管金鑰加密的 Amazon Managed Service for Prometheus 工作區時,Amazon Managed Service for Prometheus 會透過傳送 CreateGrant 請求來代表您建立這三項授與 AWS KMS。中的授予 AWS KMS 會用來讓 Amazon Managed Service for Prometheus 存取您帳戶中的 KMS 金鑰,即使 不是直接代表您呼叫 (例如,存放從 Amazon EKS 叢集抓取的指標資料時。

Amazon Managed Service for Prometheus 需要授權才能使用您的客戶受管金鑰進行下列內部操作:

  • DescribeKey 請求傳送至 AWS KMS ,以驗證建立工作區時提供的對稱客戶受管 KMS 金鑰是否有效。

  • GenerateDataKey 請求傳送至 AWS KMS ,以產生由客戶受管金鑰加密的資料金鑰。

  • 解密請求傳送至 AWS KMS 以解密加密的資料金鑰,以便用來加密您的資料。

Amazon Managed Service for Prometheus 會為 AWS KMS 金鑰建立三個授與,以允許 Amazon Managed Service for Prometheus 代表您使用金鑰。您可以透過變更金鑰政策、停用金鑰或撤銷授權來移除金鑰的存取權。在執行這些動作之前,應先充分了解這些動作的後果。您的工作區中可能會發生資料遺失。

如果您以任何方式移除任何授權的存取權,Amazon Managed Service for Prometheus 將無法存取使用客戶受管金鑰加密的任何資料,也無法儲存傳送至工作區的資料,而這會影響與該資料相關的操作。傳送至工作區的新資料將無法供存取,而且可能永久遺失。

警告
  • 如果您停用金鑰,或在金鑰政策中移除 Amazon Managed Service for Prometheus 的存取權,則無法再存取工作區資料。傳送至工作區的新資料將無法供存取,而且可能永久遺失。

    透過還原 Amazon Managed Service for Prometheus 對金鑰的存取權,就可以再次存取工作區資料並開始接收新資料。

  • 如果您撤銷授權,則無法重新建立該授權,且工作區中的資料會永久遺失。

步驟 1:建立客戶受管金鑰

您可以使用 AWS Management Console或 AWS KMS APIs 來建立對稱客戶受管金鑰。只要您透過政策提供正確的存取權,金鑰與 Amazon Managed Service for Prometheus 工作區就不需要在相同帳戶中,如下所述。

建立對稱客戶受管金鑰

請依照《AWS Key Management Service 開發人員指南》建立對稱客戶受管金鑰的步驟進行。

金鑰政策

金鑰政策會控制客戶受管金鑰的存取權限。每個客戶受管金鑰都必須只有一個金鑰政策,其中包含決定誰可以使用金鑰及其使用方式的陳述式。在建立客戶受管金鑰時,可以指定金鑰政策。如需詳細資訊,請參閱《AWS Key Management Service 開發人員指南》中的管理客戶受管金鑰的存取

若要將客戶受管金鑰與 Amazon Managed Service for Prometheus 工作區搭配使用,則必須在金鑰政策中允許下列 API 操作:

  • kms:CreateGrant:新增客戶受管金鑰的授權。授權會控制對指定 KMS 金鑰的存取權,也就是允許存取 Amazon Managed Service for Prometheus 所需的授權操作。如需詳細資訊,請參閱《AWS Key Management Service 開發人員指南》中的使用授權

    這可讓 Amazon Managed Service for Prometheus 執行下列操作:

    • 呼叫 GenerateDataKey 以產生加密的資料金鑰並加以儲存,因為資料金鑰不會立即用來加密。

    • 呼叫 Decrypt 以使用儲存的加密資料金鑰來存取加密的資料。

  • kms:DescribeKey:提供客戶受管金鑰的詳細資訊,讓 Amazon Managed Service for Prometheus 能夠驗證金鑰。

以下是您可針對 Amazon Managed Service for Prometheus 新增的政策陳述式範例:

"Statement" : [ { "Sid" : "Allow access to Amazon Managed Service for Prometheus principal within your account", "Effect" : "Allow", "Principal" : { "AWS" : "*" }, "Action" : [ "kms:DescribeKey", "kms:CreateGrant", "kms:GenerateDataKey", "kms:Decrypt" ], "Resource" : "*", "Condition" : { "StringEquals" : { "kms:ViaService" : "aps.region.amazonaws.com", "kms:CallerAccount" : "111122223333" } }, { "Sid": "Allow access for key administrators - not required for Amazon Managed Service for Prometheus", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::111122223333:root" }, "Action" : [ "kms:*" ], "Resource": "arn:aws:kms:region:111122223333:key/key_ID" }, <other statements needed for other non-Amazon Managed Service for Prometheus scenarios> ]

步驟 2:指定 Amazon Managed Service for Prometheus 的客戶受管金鑰

當您建立工作區時,可以透過輸入 KMS 金鑰 ARN 來指定客戶受管金鑰,Amazon Managed Service for Prometheus 會使用此 ARN 來加密工作區所儲存的資料。

步驟 3:從其他服務存取資料,例如 Amazon Managed Grafana

此步驟是選用的 — 只有在您需要從另一個 服務存取 Amazon Managed Service for Prometheus 資料時才需要。

您的加密資料無法從其他服務存取,除非他們也具有使用 AWS KMS 金鑰的存取權。例如,如果您想要使用 Amazon Managed Grafana 來建立資料上的儀表板或提醒,您必須授予 Amazon Managed Grafana 存取金鑰的權限。

讓 Amazon Managed Grafana 存取您的客戶受管金鑰
  1. 在您的 Amazon Managed Grafana 工作區清單中,選取要存取 Amazon Managed Service for Prometheus 之工作區的名稱。這會顯示 Amazon Managed Grafana 工作區的摘要資訊。

  2. 請注意工作區使用的 IAM 角色名稱。名稱的格式為 AmazonGrafanaServiceRole-<unique-id>。主控台會顯示角色的完整 ARN。您將在稍後的步驟中於 AWS KMS 主控台中指定此名稱。

  3. AWS KMS 客戶受管金鑰清單中,選擇您在建立 Amazon Managed Service for Prometheus 工作區期間使用的客戶受管金鑰。這會開啟金鑰組態詳細資訊頁面。

  4. 金鑰使用者旁邊,選取新增按鈕。

  5. 從名稱清單中,選擇您上述的 Amazon Managed Grafana IAM 角色。為了更容易找到,您也可以依名稱搜尋。

  6. 選擇新增,將 IAM 角色新增至金鑰使用者清單。

您的 Amazon Managed Grafana 工作區現在可以存取 Amazon Managed Service for Prometheus 工作區中的資料。您可以將其他使用者或角色新增至金鑰使用者,讓其他服務能夠存取您的工作區。

Amazon Managed Service for Prometheus 加密內容

加密內容是一組選用的金鑰值對,包含資料的其他相關內容資訊。

AWS KMS 使用加密內容做為額外的已驗證資料,以支援已驗證的加密。當您在加密資料的請求中包含加密內容時, 會將加密內容 AWS KMS 繫結至加密的資料。若要解密資料,您必須在請求中包含相同的加密內容。

Amazon Managed Service for Prometheus 加密內容

Amazon Managed Service for Prometheus 在所有 AWS KMS 密碼編譯操作中使用相同的加密內容,其中金鑰為 ,aws:amp:arn而值為工作區的 Amazon Resource Name (ARN)。

"encryptionContext": { "aws:aps:arn": "arn:aws:aps:us-west-2:111122223333:workspace/ws-sample-1234-abcd-56ef-7890abcd12ef" }

使用加密內容進行監控

當您使用對稱的客戶受管金鑰加密工作區資料時,您也可以在稽核記錄和日誌中使用加密內容,以指出客戶受管金鑰的使用方式。加密內容也會出現在 AWS CloudTrail 或 Amazon CloudWatch Logs 產生的日誌中。

使用加密內容控制對客戶受管金鑰的存取

您也可以在金鑰政策和 IAM 政策中,使用加密內容作為 conditions 來控制對於對稱客戶受管金鑰的存取。您也可以在授予中使用加密內容條件。

AmazonAmazon Managed Service for Prometheus 會在授權中,使用加密內容限制來控制對帳戶或區域中的客戶受管金鑰的存取權。授予條件會要求授予允許的操作使用指定的加密內容。

以下是授予特定加密內容之客戶受管金鑰存取權的金鑰政策陳述式範例。此政策陳述式中的條件會要求具有指定加密內容的加密內容條件。

{ "Sid": "Enable DescribeKey", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::111122223333:role/ExampleReadOnlyRole" }, "Action": "kms:DescribeKey", "Resource": "*" }, { "Sid": "Enable CreateGrant", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::111122223333:role/ExampleReadOnlyRole" }, "Action": "kms:CreateGrant", "Resource": "*", "Condition": { "StringEquals": { "kms:EncryptionContext:aws:aps:arn": "arn:aws:aps:us-west-2:111122223333:workspace/ws-sample-1234-abcd-56ef-7890abcd12ef" } } }

監控 Amazon Managed Service for Prometheus 的加密金鑰

當您搭配 Amazon Managed Service for Prometheus 工作區使用 AWS KMS 客戶受管金鑰時,您可以使用 AWS CloudTrailAmazon CloudWatch Logs 來追蹤 Amazon Managed Service for Prometheus 傳送的請求 AWS KMS。

下列範例是 CreateGrantDecryptGenerateDataKey和 AWS CloudTrail 的事件DescribeKey,用於監控 Amazon Managed Service for Prometheus 呼叫的 KMS 操作,以存取客戶受管金鑰加密的資料:

CreateGrant

當您使用 AWS KMS 客戶受管金鑰加密工作區時,Amazon Managed Service for Prometheus 會代表您傳送三個CreateGrant請求,以存取您指定的 KMS 金鑰。Amazon Managed Service for Prometheus 建立的授權專屬於與 AWS KMS 客戶受管金鑰相關聯的資源。

以下範例事件會記錄 CreateGrant 操作:

{ "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "TESTANDEXAMPLE:Sampleuser01", "arn": "arn:aws:sts::111122223333:assumed-role/Admin/Sampleuser01", "accountId": "111122223333", "accessKeyId": "EXAMPLE-KEY-ID1", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "TESTANDEXAMPLE:Sampleuser01", "arn": "arn:aws:sts::111122223333:assumed-role/Admin/Sampleuser01", "accountId": "111122223333", "userName": "Admin" }, "webIdFederationData": {}, "attributes": { "mfaAuthenticated": "false", "creationDate": "2021-04-22T17:02:00Z" } }, "invokedBy": "aps.amazonaws.com" }, "eventTime": "2021-04-22T17:07:02Z", "eventSource": "kms.amazonaws.com", "eventName": "CreateGrant", "awsRegion": "us-west-2", "sourceIPAddress": "172.12.34.56", "userAgent": "ExampleDesktop/1.0 (V1; OS)", "requestParameters": { "retiringPrincipal": "aps.region.amazonaws.com", "operations": [ "GenerateDataKey", "Decrypt", "DescribeKey" ], "keyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-123456SAMPLE", "granteePrincipal": "aps.region.amazonaws.com" }, "responseElements": { "grantId": "0ab0ac0d0b000f00ea00cc0a0e00fc00bce000c000f0000000c0bc0a0000aaafSAMPLE" }, "requestID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE", "eventID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE", "readOnly": false, "resources": [ { "accountId": "111122223333", "type": "AWS::KMS::Key", "ARN": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-123456SAMPLE" } ], "eventType": "AwsApiCall", "managementEvent": true, "eventCategory": "Management", "recipientAccountId": "111122223333" }
GenerateDataKey

當您為工作區啟用 AWS KMS 客戶受管金鑰時,Amazon Managed Service for Prometheus 會建立唯一的金鑰。它會傳送GenerateDataKey請求至 AWS KMS ,以指定資源 AWS KMS的客戶受管金鑰。

下面的範例事件會記錄 GenerateDataKey 操作:

{ "eventVersion": "1.08", "userIdentity": { "type": "AWSService", "invokedBy": "aps.amazonaws.com" }, "eventTime": "2021-04-22T17:07:02Z", "eventSource": "kms.amazonaws.com", "eventName": "GenerateDataKey", "awsRegion": "us-west-2", "sourceIPAddress": "172.12.34.56", "userAgent": "ExampleDesktop/1.0 (V1; OS)", "requestParameters": { "encryptionContext": { "aws:aps:arn": "arn:aws:aps:us-west-2:111122223333:workspace/ws-sample-1234-abcd-56ef-7890abcd12ef" }, "keySpec": "AES_256", "keyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-123456SAMPLE" }, "responseElements": null, "requestID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE", "eventID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE", "readOnly": true, "resources": [ { "accountId": "111122223333", "type": "AWS::KMS::Key", "ARN": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-123456SAMPLE" } ], "eventType": "AwsApiCall", "managementEvent": true, "eventCategory": "Management", "recipientAccountId": "111122223333", "sharedEventID": "57f5dbee-16da-413e-979f-2c4c6663475e" }
Decrypt

當查詢在加密的工作區上產生時,Amazon Managed Service for Prometheus 會呼叫 Decrypt 操作以使用儲存的加密資料金鑰來存取加密的資料。

下面的範例事件會記錄 Decrypt 操作:

{ "eventVersion": "1.08", "userIdentity": { "type": "AWSService", "invokedBy": "aps.amazonaws.com" }, "eventTime": "2021-04-22T17:10:51Z", "eventSource": "kms.amazonaws.com", "eventName": "Decrypt", "awsRegion": "us-west-2", "sourceIPAddress": "172.12.34.56", "userAgent": "ExampleDesktop/1.0 (V1; OS)", "requestParameters": { "encryptionContext": { "aws:aps:arn": "arn:aws:aps:us-west-2:111122223333:workspace/ws-sample-1234-abcd-56ef-7890abcd12ef" }, "keyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-123456SAMPLE", "encryptionAlgorithm": "SYMMETRIC_DEFAULT" }, "responseElements": null, "requestID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE", "eventID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE", "readOnly": true, "resources": [ { "accountId": "111122223333", "type": "AWS::KMS::Key", "ARN": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-123456SAMPLE" } ], "eventType": "AwsApiCall", "managementEvent": true, "eventCategory": "Management", "recipientAccountId": "111122223333", "sharedEventID": "dc129381-1d94-49bd-b522-f56a3482d088" }
DescribeKey

Amazon Managed Service for Prometheus 會使用 DescribeKey 操作來驗證與工作區相關聯的 AWS KMS 客戶受管金鑰是否存在帳戶和區域中。

下面的範例事件會記錄 DescribeKey 操作:

{ "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "TESTANDEXAMPLE:Sampleuser01", "arn": "arn:aws:sts::111122223333:assumed-role/Admin/Sampleuser01", "accountId": "111122223333", "accessKeyId": "EXAMPLE-KEY-ID1", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "TESTANDEXAMPLE:Sampleuser01", "arn": "arn:aws:sts::111122223333:assumed-role/Admin/Sampleuser01", "accountId": "111122223333", "userName": "Admin" }, "webIdFederationData": {}, "attributes": { "mfaAuthenticated": "false", "creationDate": "2021-04-22T17:02:00Z" } }, "invokedBy": "aps.amazonaws.com" }, "eventTime": "2021-04-22T17:07:02Z", "eventSource": "kms.amazonaws.com", "eventName": "DescribeKey", "awsRegion": "us-west-2", "sourceIPAddress": "172.12.34.56", "userAgent": "ExampleDesktop/1.0 (V1; OS)", "requestParameters": { "keyId": "00dd0db0-0000-0000-ac00-b0c000SAMPLE" }, "responseElements": null, "requestID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE", "eventID": "ff000af-00eb-00ce-0e00-ea000fb0fba0SAMPLE", "readOnly": true, "resources": [ { "accountId": "111122223333", "type": "AWS::KMS::Key", "ARN": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-123456SAMPLE" } ], "eventType": "AwsApiCall", "managementEvent": true, "eventCategory": "Management", "recipientAccountId": "111122223333" }

進一步了解

下列資源會提供有關靜態資料加密的詳細資訊。