如何允許 AWS 組織中的所有帳戶使用我的帳戶中的 AWS KMS key?

1 分的閱讀內容
0

我想要將 AWS Key Management Service (AWS KMS) 金鑰存取權限制為僅限屬於我的 AWS 組織的主體。

簡短說明

透過 AWS KMS,aws:PrincipalOrgID 全域條件金鑰可與資源型政策中的 Principal 元素搭配使用。您可以在 Condition 元素中指定組織 ID,而不是列出組織中的所有 AWS 帳戶 ID。

解決方案

建立 AWS KMS key 政策,以允許 AWS 組織中的所有帳戶使用 AWS 全域條件內容金鑰 aws:PrincipalOrgID 來執行 AWS KMS 動作。

**重要事項:**最佳實務是使用 AWS Identity and Access Management (IAM) 政策授予最低權限許可。

在陳述式的 condition 元素中指定 AWS 組織 ID,以確保僅限組織中帳戶的主體可以存取 AWS KMS key。若要取得組織 ID,請遵循下列步驟:

  1. 開啟 AWS Organizations 主控台
  2. 選擇「設定」。
  3. 在「組織詳細資料」中,複製組織 ID。

下列 AWS KMS key 政策陳述式允許屬於 ID 為 o-xxxxxxxxxxx 的 AWS 組織的任何 AWS 帳戶身分使用 KMS 金鑰:

{
  "Sid": "Allow use of the KMS key for organization",
  "Effect": "Allow",
  "Principal": {
    "AWS": "*"
  },
  "Action": [
    "kms:Decrypt",
    "kms:DescribeKey",
    "kms:Encrypt",
    "kms:ReEncrypt*",
    "kms:GetKeyPolicy"
  ],
  "Resource": "*",
  "Condition": {
    "StringEquals": {
      "aws:PrincipalOrgID": "o-xxxxxxxxxxx"
    }
  }
}

**注意事項:**aws:PrincipalOrgID 全域條件內容金鑰無法用來限制存取 AWS 服務主體。不屬於 AWS 組織的內部 AWS 帳戶會提供調用 API 呼叫的 AWS 服務。


相關資訊

如何開始使用 AWS Organizations?

如何從 AWS Organizations 中的組織合併帳單移除成員帳戶?

AWS 官方
AWS 官方已更新 3 年前