建立 HyperPod Autoscaling with Karpenter 的 IAM 角色 - Amazon SageMaker AI

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

建立 HyperPod Autoscaling with Karpenter 的 IAM 角色

在下列步驟中,您將建立 IAM 角色,允許 SageMaker HyperPod 透過 Karpenter 型自動擴展來管理叢集中的 Kubernetes 節點。此角色提供 HyperPod 根據工作負載需求自動新增和移除叢集節點的必要許可。

開啟 IAM 主控台
  1. 登入 AWS 管理主控台並開啟位於 https://console.aws.amazon.com 的 IAM 主控台。

  2. 在導覽窗格中,選擇 Roles (角色)。

  3. 選擇 Create Role (建立角色)。

設定信任政策
  1. 對於 Trusted entity type (信任的實體類型),選擇 Custom trust policy (自訂信任政策)。

  2. 自訂信任政策編輯器中,將預設政策取代為下列政策:

    JSON
    { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "hyperpod.sagemaker.amazonaws.com" ] }, "Action": "sts:AssumeRole" } ] }
  3. 選擇下一步

建立和連接許可政策

由於 SageMaker HyperPod 需要 AWS 受管政策中無法提供的特定許可,因此您必須建立自訂政策。

  1. 選擇建立政策。這會開啟新的瀏覽器索引標籤。

  2. 選擇 JSON 標籤。

  3. 將預設政策取代為下列政策:

    JSON
    { "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sagemaker:BatchAddClusterNodes", "sagemaker:BatchDeleteClusterNodes" ], "Resource": "arn:aws:sagemaker:*:*:cluster/*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } }, { "Effect": "Allow", "Action": [ "kms:CreateGrant", "kms:DescribeKey" ], "Resource": "arn:aws:kms:*:*:key/*", "Condition": { "StringLike": { "kms:ViaService": "sagemaker.*.amazonaws.com" }, "Bool": { "kms:GrantIsForAWSResource": "true" }, "ForAllValues:StringEquals": { "kms:GrantOperations": [ "CreateGrant", "Decrypt", "DescribeKey", "GenerateDataKeyWithoutPlaintext", "ReEncryptTo", "ReEncryptFrom", "RetireGrant" ] } } } ] }
  4. 選擇下一步

  5. 針對 Policy name (政策名稱),輸入 SageMakerHyperPodKarpenterPolicy

  6. (選用) 在說明中輸入政策的說明。

  7. 選擇建立政策

  8. 返回角色建立索引標籤並重新整理政策清單。

  9. 搜尋並選取您剛建立的 SageMakerHyperPodKarpenterPolicy

  10. 選擇下一步

命名並建立角色
  1. 角色名稱中,輸入 SageMakerHyperPodKarpenterRole

  2. (選用) 在說明中,輸入角色的說明。

  3. 步驟 1:選取信任的實體區段中,驗證信任政策是否顯示正確的服務主體。

  4. 步驟 2:新增許可區段中,驗證是否已連接 SageMakerHyperPodKarpenterPolicy

  5. 選擇建立角色

記錄角色 ARN

成功建立角色後:

  1. 角色清單中,選擇角色名稱 SageMakerHyperPodKarpenterRole

  2. 摘要區段中複製角色 ARN。建立 HyperPod 叢集時,您將需要此 ARN。

角色 ARN 遵循此格式:arn:aws:iam::ACCOUNT-ID:role/SageMakerHyperPodKarpenterRole