跳至內容

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

1 分的閱讀內容
0

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

簡短說明

您可以在 AWS KMS 的資源型政策中,將 aws:PrincipalOrgID 全域條件索引鍵與 Principal 元素搭配使用。您可以在 Condition 元素中指定 Organization ID,而不必列出 Organization 中所有 AWS 帳戶 ID。

解決方法

使用 AWS 全域條件內容索引鍵 aws:PrincipalOrgID 建立 AWS KMS key 政策,以允許 AWS Organization 中的所有帳戶執行 AWS KMS 動作

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

在陳述式政策的條件元素中指定您的 AWS Organization ID。此政策可確保只有來自您 Organization 中帳戶的主體可以存取 AWS KMS key。

若要取得 Organization ID,請遵循下列步驟:

  1. 開啟 AWS Organizations console (AWS Organizations 主控台)。
  2. 選擇 Settings (設定)。
  3. Organization details (Organization 詳細資訊) 中,複製 Organization ID。
{  "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 KMS key 政策陳述式可讓屬於 ID 為 o-xxxxxxxxxxx 之 AWS Organization 的 AWS 帳戶身分使用 KMS key:

**注意:**aws:PrincipalOrgID 全域條件內容索引鍵不能用來限制對 AWS 服務主體的存取。調用 API 呼叫的 AWS 服務來自不屬於 AWS Organization 的內部 AWS 帳戶。

相關資訊

如何開始使用 AWS Organizations?

如何從組織移除會員帳戶?