

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

# EMR Serverless 入門的先決條件
<a name="setting-up"></a>

本節說明執行 EMR Serverless 的管理先決條件。這些包括帳戶組態和許可管理。

**Topics**
+ [註冊 AWS 帳戶](#sign-up-for-aws)
+ [建立具有管理存取權的使用者](#create-an-admin)
+ [授予許可](#setting-up-iam)
+ [安裝和設定 AWS CLI](#setting-up-cli)
+ [開啟 主控台](#opening-console)

## 註冊 AWS 帳戶
<a name="sign-up-for-aws"></a>

如果您沒有 AWS 帳戶，請完成下列步驟來建立一個。

**註冊 AWS 帳戶**

1. 開啟 [https://portal.aws.amazon.com/billing/signup](https://portal.aws.amazon.com/billing/signup)。

1. 請遵循線上指示進行。

   部分註冊程序需接收來電或簡訊，並在電話鍵盤輸入驗證碼。

   當您註冊 時 AWS 帳戶，*AWS 帳戶根使用者*會建立 。根使用者有權存取該帳戶中的所有 AWS 服務 和資源。作為安全最佳實務，請將管理存取權指派給使用者，並且僅使用根使用者來執行[需要根使用者存取權的任務](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-user.html#root-user-tasks)。

AWS 會在註冊程序完成後傳送確認電子郵件給您。您可以隨時登錄 [https://aws.amazon.com/](https://aws.amazon.com/) 並選擇**我的帳戶**，以檢視您目前的帳戶活動並管理帳戶。

## 建立具有管理存取權的使用者
<a name="create-an-admin"></a>

註冊 後 AWS 帳戶，請保護 AWS 帳戶根使用者、啟用 AWS IAM Identity Center和建立 管理使用者，以免將根使用者用於日常任務。

**保護您的 AWS 帳戶根使用者**

1.  選擇**根使用者**並輸入 AWS 帳戶 您的電子郵件地址，以帳戶擁有者[AWS 管理主控台](https://console.aws.amazon.com/)身分登入 。在下一頁中，輸入您的密碼。

   如需使用根使用者登入的說明，請參閱 *AWS 登入 使用者指南*中的[以根使用者身分登入](https://docs.aws.amazon.com/signin/latest/userguide/console-sign-in-tutorials.html#introduction-to-root-user-sign-in-tutorial)。

1. 若要在您的根使用者帳戶上啟用多重要素驗證 (MFA)。

   如需說明，請參閱《*IAM 使用者指南*》中的[為您的 AWS 帳戶 根使用者 （主控台） 啟用虛擬 MFA 裝置](https://docs.aws.amazon.com/IAM/latest/UserGuide/enable-virt-mfa-for-root.html)。

**建立具有管理存取權的使用者**

1. 啟用 IAM Identity Center。

   如需指示，請參閱《AWS IAM Identity Center 使用者指南》**中的[啟用 AWS IAM Identity Center](https://docs.aws.amazon.com//singlesignon/latest/userguide/get-set-up-for-idc.html)。

1. 在 IAM Identity Center 中，將管理存取權授予使用者。

   如需使用 IAM Identity Center 目錄 做為身分來源的教學課程，請參閱*AWS IAM Identity Center 《 使用者指南*》中的[使用預設值設定使用者存取 IAM Identity Center 目錄](https://docs.aws.amazon.com//singlesignon/latest/userguide/quick-start-default-idc.html)。

**以具有管理存取權的使用者身分登入**
+ 若要使用您的 IAM Identity Center 使用者簽署，請使用建立 IAM Identity Center 使用者時傳送至您電子郵件地址的簽署 URL。

  如需使用 IAM Identity Center 使用者登入的說明，請參閱*AWS 登入 《 使用者指南*》中的[登入 AWS 存取入口網站](https://docs.aws.amazon.com/signin/latest/userguide/iam-id-center-sign-in-tutorial.html)。

**指派存取權給其他使用者**

1. 在 IAM Identity Center 中，建立一個許可集來遵循套用最低權限的最佳實務。

   如需指示，請參閱《AWS IAM Identity Center 使用者指南》**中的[建立許可集](https://docs.aws.amazon.com//singlesignon/latest/userguide/get-started-create-a-permission-set.html)。

1. 將使用者指派至群組，然後對該群組指派單一登入存取權。

   如需指示，請參閱《AWS IAM Identity Center 使用者指南》**中的[新增群組](https://docs.aws.amazon.com//singlesignon/latest/userguide/addgroups.html)。

## 授予許可
<a name="setting-up-iam"></a>

在生產環境中，我們建議您使用更精細的政策。如需這類政策的範例，請參閱 [EMR Serverless 的使用者存取政策範例](security-iam-user-access-policies.md)。若要進一步了解存取管理，請參閱《IAM 使用者指南》中的[AWS 資源的存取管理](https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html)。

對於需要在沙盒環境中開始使用 EMR Serverless 的使用者，請使用類似下列的政策：

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "EMRStudioCreate",
      "Effect": "Allow",
      "Action": [
        "elasticmapreduce:CreateStudioPresignedUrl",
        "elasticmapreduce:DescribeStudio",
        "elasticmapreduce:CreateStudio",
        "elasticmapreduce:ListStudios"
      ],
      "Resource": [
        "*"
      ]
    },
    {
      "Sid": "EMRServerlessFullAccess",
      "Effect": "Allow",
      "Action": [
        "emr-serverless:*"
      ],
      "Resource": [
        "*"
      ]
    },
    {
      "Sid": "AllowEC2ENICreationWithEMRTags",
      "Effect": "Allow",
      "Action": [
        "ec2:CreateNetworkInterface"
      ],
      "Resource": [
        "arn:aws:ec2:*:*:network-interface/*"
      ],
      "Condition": {
        "StringEquals": {
          "aws:CalledViaLast": "ops.emr-serverless.amazonaws.com"
        }
      }
    },
    {
      "Sid": "AllowEMRServerlessServiceLinkedRoleCreation",
      "Effect": "Allow",
      "Action": [
        "iam:CreateServiceLinkedRole"
      ],
      "Resource": [
        "arn:aws:iam::*:role/aws-service-role/*"
      ]
    }
  ]
}
```

------

若要提供存取權，請新增權限至您的使用者、群組或角色：
+ 中的使用者和群組 AWS IAM Identity Center：

  建立權限合集。請按照《*AWS IAM Identity Center 使用者指南*》中的[建立權限合集](https://docs.aws.amazon.com//singlesignon/latest/userguide/howtocreatepermissionset.html)說明進行操作。
+ 透過身分提供者在 IAM 中管理的使用者：

  建立聯合身分的角色。遵循《*IAM 使用者指南*》的[為第三方身分提供者 (聯合) 建立角色](https://docs.aws.amazon.com//IAM/latest/UserGuide/id_roles_create_for-idp.html)中的指示。
+ IAM 使用者：
  + 建立您的使用者可擔任的角色。請按照《*IAM 使用者指南*》的[為 IAM 使用者建立角色](https://docs.aws.amazon.com//IAM/latest/UserGuide/id_roles_create_for-user.html)中的指示。
  + (不建議) 將政策直接附加至使用者，或將使用者新增至使用者群組。請遵循《*IAM 使用者指南*》的[新增許可到使用者 (主控台)](https://docs.aws.amazon.com//IAM/latest/UserGuide/id_users_change-permissions.html#users_change_permissions-add-console) 中的指示。

### 授與程式設計存取權
<a name="setting-up-access"></a>

如果使用者想要與 AWS 外部互動，則需要程式設計存取 AWS 管理主控台。授予程式設計存取權的方式取決於正在存取的使用者類型 AWS。

若要授予使用者程式設計存取權，請選擇下列其中一個選項。


****  

| 哪個使用者需要程式設計存取權？ | 到 | 根據 | 
| --- | --- | --- | 
| IAM | （建議） 使用主控台登入資料做為臨時登入資料，以簽署對 AWS CLI、 AWS SDKs程式設計請求。 AWS APIs |  請依照您要使用的介面所提供的指示操作。 [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/emr/latest/EMR-Serverless-UserGuide/setting-up.html)  | 
|  人力資源身分 (IAM Identity Center 中管理的使用者)  | 使用臨時登入資料簽署對 AWS CLI、 AWS SDKs程式設計請求。 AWS APIs |  請依照您要使用的介面所提供的指示操作。 [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/emr/latest/EMR-Serverless-UserGuide/setting-up.html)  | 
| IAM | 使用臨時登入資料簽署對 AWS CLI、 AWS SDKs程式設計請求。 AWS APIs | 遵循《IAM 使用者指南》中[將臨時登入資料與 AWS 資源](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html)搭配使用的指示。 | 
| IAM | (不建議使用)使用長期憑證簽署對 AWS CLI、 AWS SDKs 或 AWS APIs程式設計請求。 |  請依照您要使用的介面所提供的指示操作。 [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/emr/latest/EMR-Serverless-UserGuide/setting-up.html)  | 

## 安裝和設定 AWS CLI
<a name="setting-up-cli"></a>

如果您想要使用 EMR Serverless APIs，請安裝最新版本的 AWS Command Line Interface (AWS CLI)。您不需要從 EMR Studio 主控台 AWS CLI 使用 EMR Serverless，並依照中的步驟在沒有 CLI 的情況下開始使用[從主控台開始使用 EMR Serverless](gs-console.md)。

**若要設定 AWS CLI**

1. 若要 AWS CLI 為 macOS、Linux 或 Windows 安裝最新版本的 ，請參閱[安裝或更新最新版本的 AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)。

1. 若要設定存取的 AWS CLI 和安全設定 AWS 服務，包括 EMR Serverless，請參閱[使用 的快速組態`aws configure`](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html#cli-configure-quickstart-config)。

1. 若要驗證設定，請在命令提示中輸入下列 DataBrew 命令。

   ```
   aws emr-serverless help
   ```

   AWS CLI 命令會使用 AWS 區域 組態中的預設值，除非您使用參數或設定檔來設定。若要 AWS 區域 使用 參數設定 ，請將 `--region` 參數新增至每個命令。

   若要 AWS 區域 使用設定檔設定您的 ，請先在 `~/.aws/config` 檔案或 `%UserProfile%/.aws/config` 檔案中新增具名設定檔 （適用於 Microsoft Windows)。請遵循 [的具名設定檔 AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html)中的步驟。接著，使用類似下列範例中的命令來設定您的 AWS 區域 和其他設定。

   ```
   [profile emr-serverless]
   aws_access_key_id = ACCESS-KEY-ID-OF-IAM-USER
   aws_secret_access_key = SECRET-ACCESS-KEY-ID-OF-IAM-USER
   region = us-east-1
   output = text
   ```

## 開啟 主控台
<a name="opening-console"></a>

本節中的大多數主控台導向主題都從 [Amazon EMR 主控台](https://console.aws.amazon.com/elasticmapreduce/home)開始。如果您尚未登入您的 AWS 帳戶，請登入，然後開啟 [Amazon EMR 主控台](https://console.aws.amazon.com/elasticmapreduce/home)並繼續前往下一節以繼續開始使用 Amazon EMR。