本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
在 AWS Service Catalog 中設定 Amazon EMR 範本 (適用於管理員)
本節提供有關管理員如何設定AWS Service Catalog產品的詳細資訊,以便使用者可以從 Amazon SageMaker Studio 傳統筆記型電腦獨立自行佈建 Amazon EMR 叢集。此外,管理員還可以透過某種方式設定 Amazon EMR 叢集範本,以便終端使用者可以自訂叢集的各個層面以符合其特定需求。例如,管理員可以定義允許的執行個體類型清單,使用者可以在建立叢集時從中選擇這些執行個體類型。
本主題假設您熟悉如何在 AWS Service Catalog、Amazon EMR 和 AWS CloudFormation 建立產品組合以及產品。
注意
您可以參考 aws-範例/sagemaker-工作室-emr
您可以在巢狀儲存庫中存取各種 CloudFormation Amazon EMR 範本範本範本的範例,並進一步從單一帳戶部署到跨帳
如需連線至 Amazon EMR 叢集時可用的身分驗證方法的詳細資訊,請參閱使用工作室傳統筆記本的 Amazon EMR 叢集。
為了簡化 Amazon EMR 叢集的建立,管理員可以將 Amazon EMR 叢集的CloudFormation 範本註冊為產品組合中的產品。 AWS Service Catalog然後,他們將 Service Catalog 組合與 Studio 傳統執行角色產生關聯,以確保 Studio 傳統中範本的可用性。此外,為了確保資料科學家能夠探索這些範本、佈建 Amazon EMR 叢集,以及從其 Studio Classic 筆記本連接到 Amazon EMR 叢集,管理員需要設定適當的存取許可。
下列清單提供管理員需要套用至基準 CloudFormation 堆疊的其他設定,以便讓 Studio Classic 存取 Service Catalog 產品和佈建 Amazon EMR 叢集。這些設定必須套用於多個層級:
-
在 Service Catalog 產品組合中
-
在 Service Catalog 產品中
-
在宣告為 Service Catalog 產品的 CloudFormation Amazon EMR 範本中
最後,管理員必須根據工作室典型版和 Amazon EMR 位於相同或不 AWS 同的帳戶,將必要的許可指派給存取叢集的 Studio 傳統執行角色和部署 Amazon EMR 的帳戶。
-
先決條件:網路和身分驗證需求
先決條件是,請確定您已檢閱中的網路和安全性需求,設定網路 (針對管理員)並且已建立支援您選擇之驗證方法的基準 CloudFormation 堆疊。您可以在 aws-
樣本/圖模機-工作室 CloudFormation emr 中找到模板的示例。 -
在您的 Service Catalog 產品組合:
將下列區段新增至學檔 CloudFormation 範本 (請參閱 YAML 格式的範例),以將您的產品組合與存取叢集的 Studio 典型執行角色產生關聯。
SageMakerStudioEMRProductPortfolioPrincipalAssociation: Type: AWS::ServiceCatalog::PortfolioPrincipalAssociation Properties: PrincipalARN:
SageMakerExecutionRole.Arn
PortfolioId:SageMakerStudioEMRProductPortfolio ID
PrincipalType: IAM -
在您的 Service Catalog 產品:
將下列標籤鍵
"sagemaker:studio-visibility:emr"
新增至參考 Amazon EMR 範本資源的 Service Catalog 產品中,並設定為值為"true"
(此處為 YAML)。這確保了模板在工作室經典的可見性。SMStudioEMRNoAuthProduct: Type: AWS::ServiceCatalog::CloudFormationProduct Properties: Owner: AWS Name: SageMaker Studio Domain No Auth EMR ProvisioningArtifactParameters: - Name: SageMaker Studio Domain No Auth EMR Description: Provisions a SageMaker domain and No Auth EMR Cluster Info: LoadTemplateFromURL:
Link to your CloudFormation template. For example, https://aws-ml-blog.s3.amazonaws.com/artifacts/astra-m4-sagemaker/end-to-end/CFN-EMR-NoStudioNoAuthTemplate-v3.yaml
Tags: - Key: "sagemaker:studio-visibility:emr" Value: "true" -
在 Service Catalog 產品中的 Amazon EMR 叢集 CloudFormation 範本中:
新增以下強制性堆疊參數作為預留位置。本節會填入使用者在從 Studio 傳統佈建叢集時所使用的 Studio 典型專案名稱和識別碼。
SageMakerProjectName: Type: String Description: Name of the project SageMakerProjectId: Type: String Description: Service generated Id of the project.
管理員可以指定
Default
與AllowedValues
以在範本的參數區段中包含選項,以便使用者在建立叢集時輸入或選取自訂值。下列範例說明管理員在建立 Amazon EMR 範本時可設定的其他輸入參數。"Parameters": { "EmrClusterName": { "Type": "String", "Description": "EMR cluster Name." }, "MasterInstanceType": { "Type": "String", "Description": "Instance type of the EMR master node.", "Default": "m5.xlarge", "AllowedValues": [ "m5.xlarge", "m5.2xlarge", "m5.4xlarge" ] }, "CoreInstanceType": { "Type": "String", "Description": "Instance type of the EMR core nodes.", "Default": "m5.xlarge", "AllowedValues": [ "m5.xlarge", "m5.2xlarge", "m5.4xlarge", "m3.medium", "m3.large", "m3.xlarge", "m3.2xlarge" ] }, "CoreInstanceCount": { "Type": "String", "Description": "Number of core instances in the EMR cluster.", "Default": "2", "AllowedValues": [ "2", "5", "10" ] }, "EmrReleaseVersion": { "Type": "String", "Description": "The release version of EMR to launch.", "Default": "emr-5.33.1", "AllowedValues": [ "emr-5.33.1", "emr-6.4.0" ] } }
-
最後,附加必要的身分與存取權管理政策,以便透過工作室傳統筆記本提供 CloudFormation Amazon EMR 範本的能見度,以及 Amazon EMR 叢集的自我佈建功能。您必須新增這些政策的角色取決於 Studio 經典版和 Amazon EMR 是否部署在相同的帳戶 (單一帳戶) 或不同的帳戶 (跨帳戶) 中。
-
如果您的 Amazon EMR 叢集部署在與工作室經典 AWS 帳戶相同的帳戶中,請參閱單一帳戶索引標籤。
-
如果您的 Amazon EMR 叢集部署在與工作室傳統 AWS 帳戶不同的帳戶中,請參閱跨帳戶索引標籤。
如需使用角色進行跨帳戶存取權的更多資訊,請參閱 IAM 中的跨帳戶資源存取或跨帳戶政策評估邏輯。
-
一旦 Amazon SageMaker 工作室傳統版中提供這些 CloudFormation 範本,資料科學家就可以使用這些範本來自行佈建 Amazon EMR 叢集。每個在模板中"Parameters"
指定的成為 Studio 經典的集群創建形式的輸入框,與相應的"AllowedValues"
出現在一個下拉菜單。
下圖顯示了從 CloudFormation Amazon EMR 範本組裝的動態表單,以在 SageMaker 工作室經典中創建一個 Amazon EMR 叢集。
![從 CloudFormation Amazon EMR 模板組裝的動態表單的插圖,以在 SageMaker 工作室經典中創建一個 Amazon EMR 集群。](images/studio/emr/studio-notebooks-emr-cluster-creation.png)
請瀏覽從經典工作室啟動 Amazon EMR 集群以了解如何使用這些 Amazon EMR 範本從工作室傳統版啟動叢集。