

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

# 為虛擬叢集建立互動端點
<a name="create-managed-endpoint"></a>

本主題說明如何使用 AWS 命令列界面 (AWS CLI) 建立互動式端點，並包含可用組態參數的詳細資訊。

## 使用 `create-managed-endpoint` 命令建立互動端點
<a name="create-using-json-file"></a>

在 `create-managed-endpoint` 命令中指定參數，如下所示。Amazon EMR on EKS 支援使用 Amazon EMR 6.7.0 及更高版本建立互動端點。

```
aws emr-containers create-managed-endpoint \
‐‐type JUPYTER_ENTERPRISE_GATEWAY \
‐‐virtual‐cluster‐id {{1234567890abcdef0xxxxxxxx}} \
‐‐name {{example-endpoint-name}} \
‐‐execution-role-arn arn:aws:iam::444455556666:role/{{JobExecutionRole}} \
‐‐release-label {{emr-6.9.0-latest}} \
‐‐configuration-overrides '{
    "applicationConfiguration": [{
        "classification": "spark-defaults",
        "properties": {
            "spark.driver.memory": "2G"
        }
    }],
    "monitoringConfiguration": {
        "cloudWatchMonitoringConfiguration": {
            "logGroupName": "{{log_group_name}}",
            "logStreamNamePrefix": "{{log_stream_prefix}}"
        },
        "persistentAppUI": "ENABLED",
        "s3MonitoringConfiguration": {
            "logUri": "s3://{{my_s3_log_location}}"
        }
    }
}'
```

如需詳細資訊，請參閱[用於建立互動端點的參數](#parameters-for-creating)。

## 在 JSON 檔案中使用指定參數建立互動端點
<a name="create-using-json-file-B"></a>

1. 建立 `create-managed-endpoint-request.json` 檔案並指定端點所需的參數，如下列 JSON 檔案所示：

   ```
   {
       "name": "{{MY_TEST_ENDPOINT}}",
       "virtualClusterId": "{{MY_CLUSTER_ID}}",
       "type": "JUPYTER_ENTERPRISE_GATEWAY",
       "releaseLabel": "{{emr-6.9.0-latest}}",
       "executionRoleArn": "arn:aws:iam::444455556666:role/{{JobExecutionRole}}",
       "configurationOverrides":
       {
           "applicationConfiguration": 
           [
               {
                   "classification": "spark-defaults",
                   "properties":
                   {
                       "spark.driver.memory": "8G"
                   }
               }
           ],
           "monitoringConfiguration":
           {
               "persistentAppUI": "ENABLED",
               "cloudWatchMonitoringConfiguration":
               {
                   "logGroupName": "{{my_log_group}}",
                   "logStreamNamePrefix": "{{log_stream_prefix}}"
               },
               "s3MonitoringConfiguration":
               {
                   "logUri": "s3://{{my_s3_log_location}}"
               }
           }
       }
   }
   ```

1. 搭配使用 `create-managed-endpoint` 命令與儲存在本機或 Amazon S3 中的 `create-managed-endpoint-request.json` 檔案路徑。

   ```
   aws emr-containers create-managed-endpoint \
   ‐‐cli-input-json  file://./create-managed-endpoint-request.json ‐‐region {{AWS-Region}}
   ```

## 建立互動端點的輸出
<a name="create-managed-endpoint-output"></a>

在終端中應能看到下列輸出。輸出包括新互動端點的名稱和識別符：

```
{
    "id": "{{1234567890abcdef0}}",
    "name": "{{example-endpoint-name}}", 
    "arn": "arn:aws:emr-containers:{{us-west-2:111122223333}}:/virtualclusters/{{444455556666}}/endpoints/{{444455556666}}",
    "virtualClusterId": "{{111122223333xxxxxxxx}}"
}
```

執行中的 `aws emr-containers create-managed-endpoint` 會建立自我簽署的憑證，它允許 EMR Studio 和互動端點伺服器之間的 HTTPS 通訊。

如果您執行 `create-managed-endpoint` 但尚未完成先決條件，Amazon EMR 會傳回錯誤訊息，其中包含為了繼續而必須採取的動作。

## 用於建立互動端點的參數
<a name="parameters-for-creating"></a>

**Topics**
+ [互動端點的必要參數](#parameters-for-creating-required)
+ [互動端點的選用參數](#parameters-for-creating-optional)

### 互動端點的必要參數
<a name="parameters-for-creating-required"></a>

建立互動端點時，必須指定下列參數：

**`‐‐type`**  
請使用 `JUPYTER_ENTERPRISE_GATEWAY`。這是唯一支援的類型。

**`‐‐virtual-cluster-id`**  
您 Amazon EMR on EKS 註冊的虛擬叢集的識別符。

**`‐‐name`**  
互動端點的描述性名稱，它可幫助 EMR Studio 使用者從下拉式清單中選擇。

**`‐‐execution-role-arn`**  
適用於 Amazon EMR on EKS 的 IAM 作業執行角色的 Amazon Resource Name (ARN)，該角色作為先決條件的一部分而建立。

**`‐‐release-label`**  
用於端點的 Amazon EMR 版本的版本標籤。例如 `emr-6.9.0-latest`。透過 Amazon EMR 6.7.0 及更高版本，Amazon EMR on EKS 支援互動端點。

### 互動端點的選用參數
<a name="parameters-for-creating-optional"></a>

建立互動端點時，也可選擇性地指定下列參數：

**`‐‐configuration-overrides`**  
若要覆寫應用程式的預設組態，請提供組態物件。可以使用速記語法，以提供組態或參考 JSON 檔案中物件的組態。

組態物件是由分類、屬性和選用的巢狀組態所組成。屬性由您想要在檔案中覆寫的設定組成。您可以在單一 JSON 物件中，為多個應用程式指定多個分類。可用的組態分類因 Amazon EMR on EKS 版本而異。如需每個 Amazon EMR on EKS 版本可用的組態分類清單，請參閱 [Amazon EMR on EKS 發行版本](emr-eks-releases.md)。除了針對每個版本列出的組態分類之外，互動端點還會引入其他分類 `jeg-config`。如需詳細資訊，請參閱[Jupyter Enterprise Gateway (JEG) 組態選項](jeg-config-options.md)。