

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

# 建立使用者以使用 RStudio
<a name="rstudio-create-user"></a>

**重要**  
允許 Amazon SageMaker Studio 或 Amazon SageMaker Studio Classic 建立 Amazon SageMaker 資源的自訂 IAM 政策也必須授與許可，才能將標籤新增至這些資源。需要將標籤新增至資源的許可，因為 Studio 和 Studio Classic 會自動標記它們建立的任何資源。如果 IAM 政策允許 Studio 和 Studio Classic 建立資源，但不允許標記，則在嘗試建立資源時可能會發生 "AccessDenied" 錯誤。如需詳細資訊，請參閱[提供標記 SageMaker AI 資源的許可](security_iam_id-based-policy-examples.md#grant-tagging-permissions)。  
提供許可來建立 SageMaker 資源的 [AWS Amazon SageMaker AI 的 受管政策](security-iam-awsmanpol.md) 已包含建立這些資源時新增標籤的許可。

已啟用 RStudio 的 Amazon SageMaker AI 網域執行後，您可以將使用者設定檔 (UserProfiles) 新增至網域。下列主題說明如何建立授權可使用 RStudio 的使用者設定檔，以及更新現有的使用者設定檔。如需如何刪除 RStudio 應用程式、UserProfile 或網域的詳細資訊，請遵循[刪除 Amazon SageMaker AI 網域](https://docs.aws.amazon.com/sagemaker/latest/dg/gs-studio-delete-domain.html)中的步驟。

**注意**  
Amazon SageMaker AI 網域中 UserProfiles 的總數限制為 60。

 有兩種使用者類型：
+ 未經授權：此使用者無法存取 RStudio 應用程式。
+ 已授權：此使用者可以存取 RStudio 應用程式，並使用其中一個 RStudio 授權基座。根據預設，如果網域已為 RStudio 啟用，則新使用者為 `Authorized`。

變更使用者的授權狀態僅從 `Unauthorized` 到 `Authorized` 有效。如果使用者獲得授權，他們可以取得下列 RStudio 存取層級之一。
+  RStudio 使用者：這是標準的 RStudio 使用者，可以存取 RStudio。
+  RStudio 管理員：Amazon SageMaker AI 網域的管理員能夠建立使用者、新增現有使用者，以及更新現有使用者的許可。管理員也可以存取 RStudio 系統管理儀表板。但是，此管理員無法更新由 Amazon SageMaker AI 管理的參數。

## 建立使用者的方法
<a name="rstudio-create-user-methods"></a>

下列主題示範如何在已啟用 RStudio 的 Amazon SageMaker AI 網域中建立使用者。

 **建立使用者主控台** 

若要從主控台在已啟用 RStudio 的 Amazon SageMaker AI 網域中建立使用者，請完成[新增使用者設定檔](domain-user-profile-add.md)中的步驟。

 **建立使用者 CLI** 

 下列命令示範如何使用 IAM 驗證將使用者新增至 Amazon SageMaker AI 網域。使用者可以屬於 `R_STUDIO_USER` 或 `R_STUDIO_ADMIN` 使用者群組。

```
aws sagemaker create-user-profile --region <REGION> \
    --domain-id <DOMAIN-ID> \
    --user-profile-name <USER_PROFILE_NAME-ID> \
    --user-settings RStudioServerProAppSettings={UserGroup=<USER-GROUP>}
```

下列命令顯示如何使用 IAM Identity Center 搭配驗證將使用者新增至 Amazon SageMaker AI 網域。使用者可以屬於 `R_STUDIO_USER` 或 `R_STUDIO_ADMIN` 使用者群組。

```
aws sagemaker create-user-profile --region <REGION> \
    --domain-id <DOMAIN-ID> \
    --user-profile-name <USER_PROFILE_NAME-ID> \
    --user-settings RStudioServerProAppSettings={UserGroup=<USER-GROUP>} \
    --single-sign-on-user-identifier UserName \
    --single-sign-on-user-value <USER-NAME>
```