

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

# Ground Truth 安全與許可
<a name="sms-security-general"></a>

使用本頁面上的主題了解 Ground Truth 的安全功能，以及如何設定 AWS Identity and Access Management (IAM) 許可，允許使用者或角色建立標籤工作。另外，還能了解如何建立一個*執行角色*。執行角色是您在建立標籤工作時所指定的角色。此角色用於啟動標籤工作。

如果您是新使用者且想要快速入門，或是不需要進行細部授權，請參閱[在 Ground Truth 使用 IAM 受管政策](sms-security-permissions-get-started.md)。

如需 IAM 使用者和角色的更多相關資訊，請參閱 IAM 使用者指南中的[身分 (使用者、群組和角色)](https://docs.aws.amazon.com/IAM/latest/UserGuide/id.html) 相關文章。

若要進一步了解如何將 IAM 與 SageMaker AI 搭配使用，請參閱 [AWS Identity and Access Management 適用於 Amazon SageMaker AI](security-iam.md)。

**Topics**
+ [輸入影像資料的 CORS 要求](sms-cors-update.md)
+ [指派 IAM 許可以使用 Ground Truth](sms-security-permission.md)
+ [在 Amazon Virtual Private Cloud 使用 Amazon SageMaker Ground Truth](sms-vpc.md)
+ [輸出資料與儲存磁碟區加密](sms-security.md)
+ [人力資源身分驗證與限制](sms-security-workforce-authentication.md)

# 輸入影像資料的 CORS 要求
<a name="sms-cors-update"></a>

在 2020 年早期，Chrome 和 Firefox 等熱門瀏覽器根據映像中繼資料 (稱為 [EXIF 資料](https://en.wikipedia.org/wiki/Exif))，改變了旋轉圖像的預設行為。在過去，瀏覽器一律按照映像在硬碟上儲存的模樣來顯示映像，通常是未旋轉的狀態。變更後，映像現在會根據稱為*方向值*的映像中繼資料進行旋轉。這對整個機器學習 (ML) 社群具有重要意義。例如，如果註釋映像的應用程式沒有考慮到 EXIF 方向設定，可能會以非預期的方向顯示映像，導致標籤不正確。

從 Chrome 89 開始， AWS 無法再自動防止映像輪換，因為 Web 標準群組 W3C 已決定控制映像輪換的功能違反 Web 的同源政策。因此，若要確保人力工作者在提交請求以建立標籤工作時，能以可預測的方向註釋您的輸入映像，您必須將 CORS 標題政策新增至包含輸入映像的 Amazon S3 儲存貯體。

**重要**  
如果您未將 CORS 組態新增至包含輸入資料的 Amazon S3 儲存貯體，則這些輸入資料物件的標籤任務將會失敗。

如果您透過 Ground Truth 主控台建立任務，CORS 預設為啟用。如果所有輸入資料與輸入資訊清單檔案*不*在同一個 Amazon S3 儲存貯體中，您必須使用下列指示，將 CORS 組態新增至包含輸入資料的所有 Amazon S3 儲存貯體。

如果您使用 `CreateLabelingJob` API 建立 Ground Truth 標籤工作，則可以將 CORS 政策新增至包含 S3 主控台中輸入資料的 Amazon S3 儲存貯體。若要在 Amazon S3 主控台中包含輸入映像的 Amazon S3 儲存貯體上設定所需的 CORS 標題，請按照[如何使用 CORS 新增跨網域資源共用](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/add-cors-configuration.html)中詳細說明進行操作。對儲存映像的儲存貯體使用以下 CORS 組態代碼。如果您使用 Amazon S3 主控台將政策新增至儲存貯體，您必須使用 JSON 格式。

**重要**  
如果建立 3D 點雲或影片影格標籤工作，則必須在 CORS 組態中新增其他規則。如需進一步了解，請分別參閱[3D 點雲標籤工作許可要求](sms-security-permission-3d-point-cloud.md)和[影片影格任務權限要求](sms-video-overview.md#sms-security-permission-video-frame)。

**JSON**

```
[{
   "AllowedHeaders": [],
   "AllowedMethods": ["GET"],
   "AllowedOrigins": ["*"],
   "ExposeHeaders": ["Access-Control-Allow-Origin"]
}]
```

**XML**

```
<CORSConfiguration>
 <CORSRule>
   <AllowedOrigin>*</AllowedOrigin>
   <AllowedMethod>GET</AllowedMethod>
   <ExposeHeader>Access-Control-Allow-Origin</ExposeHeader>
 </CORSRule>
</CORSConfiguration>
```

下列 GIF 示範在 Amazon S3 文件中的指示，如何使用 Amazon S3 主控台新增 CORS 標題政策。如需文字指示，請參閱 Amazon Simple Storage Service 使用者指南的[如何使用 CORS 新增跨網域資源分享？](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/add-cors-configuration.html)中，文件頁面上**使用 Amazon S3 主控台**一節。

![\[說明如何使用 Amazon S3 主控台新增 CORS 標頭政策的 GIF。\]](http://docs.aws.amazon.com/zh_tw/sagemaker/latest/dg/images/sms/gifs/cors-config.gif)


# 指派 IAM 許可以使用 Ground Truth
<a name="sms-security-permission"></a>

使用本節中的主題，了解如何使用 AWS Identity and Access Management (IAM) 受管和自訂政策來管理對 Ground Truth 和相關資源的存取。

您可以透過此頁面章節來了解下列資訊：
+ 如何建立 IAM 政策，授予使用者或角色建立標籤工作的許可。管理員可以使用 IAM 政策來限制對 Amazon SageMaker AI 和其他 Ground Truth 特定 AWS 服務的存取。
+ 如何建立 SageMaker AI *執行角色*。執行角色是您在建立標籤工作時所指定的角色。角色用於啟動和管理您的標籤工作。

以下是您可以在此頁面上找到的主題概觀：
+ 如果您要開始使用 Ground Truth，或者不需要使用案例的精細授權，建議您使用 IAM 受管政策，如[在 Ground Truth 使用 IAM 受管政策](sms-security-permissions-get-started.md)所述。
+ 在[授予 IAM 許可以使用 Amazon SageMaker Ground Truth 主控台](sms-security-permission-console-access.md)中了解使用 Ground Truth 主控台所需的權限。本節包含授予 IAM 實體許可，以建立和修改私有工作團隊、訂閱廠商工作團隊，及建立自訂標籤工作流程的政策範例。
+ 建立標籤工作時，您必須提供執行角色。使用 [為 Ground Truth 標籤工作建立 SageMaker AI 執行角色](sms-security-permission-execution-role.md) 來了解此角色所需的許可。

# 在 Ground Truth 使用 IAM 受管政策
<a name="sms-security-permissions-get-started"></a>

SageMaker AI 和 Ground Truth 提供可建立標籤工作的 AWS 受管政策。如要開始使用 Ground Truth，而且不需要使用案例的精細授權，建議您使用下列政策：
+ `[AmazonSageMakerFullAccess](https://console.aws.amazon.com/iam/home?#/policies/arn:aws:iam::aws:policy/AmazonSageMakerFullAccess)` — 使用此政策授予使用者或角色建立標籤工作的許可。這是廣泛的政策，授予實體使用 SageMaker AI 功能的許可，以及透過主控台和 API 提供必要 AWS 服務的功能。此政策授權予實體建立標籤工作，並使用 Amazon Cognito 建立和管理人力資源。如需進一步了解，請參閱 [AmazonSageMakerFullAccess 政策](https://docs.aws.amazon.com/sagemaker/latest/dg/security-iam-awsmanpol.html#security-iam-awsmanpol-AmazonSageMakerFullAccess)。
+ `[AmazonSageMakerGroundTruthExecution](https://console.aws.amazon.com/iam/home?#/policies/arn:aws:iam::aws:policy/AmazonSageMakerGroundTruthExecution)` — 若要建立一個*執行角色*，您可以將政策 `[AmazonSageMakerGroundTruthExecution](https://console.aws.amazon.com/iam/home?#/policies/arn:aws:iam::aws:policy/AmazonSageMakerGroundTruthExecution)` 附加至一名角色。執行角色是您在建立標籤工作時指定的角色，用於啟動標籤工作。此政策可讓您同時建立串流和非串流標籤工作，以及使用任何任務類型建立標籤工作。此受管政策有下列限制需要注意。
  + **Amazon S3 許可**：此政策授予執行角色 Amazon S3 儲存貯體的存取許可，其名稱中包含下列字串：`GroundTruth`、`Groundtruth`、`groundtruth`、`SageMaker`、`Sagemaker` 和 `sagemaker` 或名稱中包含 `SageMaker` (不區分大小寫) 的[物件標籤](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html)。請確定您的輸入和輸出儲存貯體名稱包含這些字串，或為執行角色新增其他許可，以[授予 Amazon S3 儲存貯體的存取許可](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_examples_s3_rw-bucket.html)。您必須授予此角色許可，才能在 Amazon S3 儲存貯體上執行下列動作：`AbortMultipartUpload`、`GetObject` 和 `PutObject`。
  + **自訂工作流程**：當您建立[自訂標記工作流程](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-custom-templates.html)時，此執行角色僅限於呼叫 AWS Lambda 具有下列其中一個字串的函數，做為函數名稱的一部分：`GtRecipe`、`sagemaker`、、 `SageMaker` `Sagemaker`或 `LabelingFunction`。這同時適用於註釋前和註釋後 Lambda 函式。如果您選擇使用不含這些字串的名稱，則必須為用來建立標籤工作的執行角色明確提供 `lambda:InvokeFunction` 許可。

若要了解如何將 AWS 受管政策連接至使用者或角色，請參閱《[IAM 使用者指南》中的新增和移除 IAM 身分許可](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-attach-detach.html#add-policies-console)。

# 授予 IAM 許可以使用 Amazon SageMaker Ground Truth 主控台
<a name="sms-security-permission-console-access"></a>

若要使用 SageMaker AI 主控台的 Ground Truth 區域，您需要授予實體存取 SageMaker AI 和其他 Ground Truth 互動 AWS 服務的許可。存取其他 AWS 服務所需的許可取決於您的使用案例：
+ 所有使用案例都需要 Amazon S3 許可。這些許可必須包含輸入和輸出資料之 Amazon S3 儲存貯體的授予存取權。
+ AWS Marketplace 使用廠商人力資源需要 許可。
+ 私有工作團隊設定需要 Amazon Cognito 許可。
+ AWS KMS 需要 許可才能檢視可用於輸出資料加密的可用 AWS KMS 金鑰。
+ 如需列出預先存在的執行角色或建立新角色時，需要 IAM 許可。此外，您必須使用新增 `PassRole` 許可，來允許 SageMaker AI 使用選擇的執行角色來啟動標籤工作。

以下各節列出您可能想授予角色以使用 Ground Truth 的一個或多個功能之政策。

**Topics**
+ [Ground Truth 主控台許可](#sms-security-permissions-console-all)
+ [自訂標籤工作流程許可](#sms-security-permissions-custom-workflow)
+ [私有人力資源許可](#sms-security-permission-workforce-creation)
+ [廠商人力資源許可](#sms-security-permissions-workforce-creation-vendor)

## Ground Truth 主控台許可
<a name="sms-security-permissions-console-all"></a>

若要授予使用者或角色使用 SageMaker AI 主控台 Ground Truth 區域的許可，以建立標籤工作，請將下列政策附加至該使用者或角色。下列政策會授予 IAM 角色許可，使用[內建任務類型](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-task-types.html)任務類型建立標籤工作。如果您要建立自訂標籤工作流程，請將 [自訂標籤工作流程許可](#sms-security-permissions-custom-workflow) 中的政策新增至下列政策。下列政策中包含的每個 `Statement`，都在此程式碼區塊下方提供說明。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "SageMakerApis",
            "Effect": "Allow",
            "Action": [
                "sagemaker:*"
            ],
            "Resource": "*"
        },
        {
            "Sid": "KmsKeysForCreateForms",
            "Effect": "Allow",
            "Action": [
                "kms:DescribeKey",
                "kms:ListAliases"
            ],
            "Resource": "*"
        },
        {
            "Sid": "AccessAwsMarketplaceSubscriptions",
            "Effect": "Allow",
            "Action": [
                "aws-marketplace:ViewSubscriptions"
            ],
            "Resource": "*"
        },
        {
            "Sid": "SecretsManager",
            "Effect": "Allow",
            "Action": [
                "secretsmanager:CreateSecret",
                "secretsmanager:DescribeSecret",
                "secretsmanager:ListSecrets"
            ],
            "Resource": "*"
        },
        {
            "Sid": "ListAndCreateExecutionRoles",
            "Effect": "Allow",
            "Action": [
                "iam:ListRoles",
                "iam:CreateRole",
                "iam:CreatePolicy",
                "iam:AttachRolePolicy"
            ],
            "Resource": "*"
        },
        {
            "Sid": "PassRoleForExecutionRoles",
            "Effect": "Allow",
            "Action": [
                "iam:PassRole"
            ],
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "iam:PassedToService": "sagemaker.amazonaws.com"
                }
            }
        },
        {
            "Sid": "GroundTruthConsole",
            "Effect": "Allow",
            "Action": [
                "groundtruthlabeling:*",
                "lambda:InvokeFunction",
                "lambda:ListFunctions",
                "s3:GetObject",
                "s3:PutObject",
                "s3:ListBucket",
                "s3:GetBucketCors",
                "s3:PutBucketCors",
                "s3:ListAllMyBuckets",
                "cognito-idp:AdminAddUserToGroup",
                "cognito-idp:AdminCreateUser",
                "cognito-idp:AdminDeleteUser",
                "cognito-idp:AdminDisableUser",
                "cognito-idp:AdminEnableUser",
                "cognito-idp:AdminRemoveUserFromGroup",
                "cognito-idp:CreateGroup",
                "cognito-idp:CreateUserPool",
                "cognito-idp:CreateUserPoolClient",
                "cognito-idp:CreateUserPoolDomain",
                "cognito-idp:DescribeUserPool",
                "cognito-idp:DescribeUserPoolClient",
                "cognito-idp:ListGroups",
                "cognito-idp:ListIdentityProviders",
                "cognito-idp:ListUsers",
                "cognito-idp:ListUsersInGroup",
                "cognito-idp:ListUserPoolClients",
                "cognito-idp:ListUserPools",
                "cognito-idp:UpdateUserPool",
                "cognito-idp:UpdateUserPoolClient"
            ],
            "Resource": "*"
        }
    ]
}
```

------

此政策包含下列陳述式。您可以將特定資源新增至該陳述式的 `Resource` 清單，以限制任何這些陳述式的範圍。

`SageMakerApis`

此陳述式包含 `sagemaker:*`，可讓使用者執行所有 [SageMaker AI API 動作](sagemaker/latest/APIReference/API_Operations.html)。您可以禁止使用者執行非用於建立和監控標籤工作的動作，以限制此政策的範圍。

**`KmsKeysForCreateForms`**

只有在您想要授予使用者在 Ground Truth 主控台中列出和選取 AWS KMS 金鑰以用於輸出資料加密的許可時，才需要包含此陳述式。上述政策授予使用者列出和選擇 AWS KMS帳戶中任何密鑰的許可。若要限制使用者可以列出和選取的金鑰，請在 `Resource` 中指定這些金鑰 ARN。

**`SecretsManager`**

此陳述式提供使用者在建立標籤工作 AWS Secrets Manager 所需的 中描述、列出和建立資源的許可。

`ListAndCreateExecutionRoles`

此陳述式授予使用者許可，在您的帳戶中列出 (`ListRoles`) 和建立 (`CreateRole`) IAM 角色。它也會授予使用者許可，以建立 (`CreatePolicy`) 政策和附加 (`AttachRolePolicy`) 政策至實體。要在主控台中列出、選擇並建立一個執行角色，這些為必要項目。

如果您已經建立一個執行角色，並想要縮小此陳述式的範圍，以便使用者只能在主控台中選取該角色，請在 `Resource` 中指定您希望使用者有權查看的角色 ARN，並移除動作 `CreateRole`、`CreatePolicy` 和 `AttachRolePolicy`。

`AccessAwsMarketplaceSubscriptions`

建立標籤工作時，需要這些許可才能檢視和選擇您已訂閱的廠商工作團隊。要授予使用者*訂閱*廠商工作團隊的許可，請將 [廠商人力資源許可](#sms-security-permissions-workforce-creation-vendor) 中的陳述式新增到上面的政策中

`PassRoleForExecutionRoles`

為了授予標籤工作建立者預覽工作者使用者介面的許可，並驗證輸入資料、標籤和指示是否正確顯示，此為必要項目。此陳述式提供實體許可，可將用於建立標籤工作的 IAM 執行角色傳遞給 SageMaker AI，以轉譯和預覽工作者使用者介面。若要縮小此政策的範圍，請在 `Resource` 下方新增用來建立標籤工作之執行角色的角色 ARN。

**`GroundTruthConsole`**
+ `groundtruthlabeling` — 這允許使用者執行使用 Ground Truth 主控台某些功能所需的特定動作。其中包含描述標籤工作狀態的許可 (`DescribeConsoleJob`)，列出輸入資訊清單檔案中的所有資料集物件 (`ListDatasetObjects`)，篩選選取資料集取樣時的資料集 (`RunFilterOrSampleDatasetJob`)，以及在使用自動化資料標籤時，產生輸入資訊清單檔案 (`RunGenerateManifestByCrawlingJob`)。這些動作僅在使用 Ground Truth 主控台時可用，無法使用 API 直接呼叫。
+ `lambda:InvokeFunction` 和 `lambda:ListFunctions` — 這些動作會授予使用者許可，以列出和調用用於執行自訂標籤工作流程的 Lambda 函式。
+ `s3:*` — 此陳述式中包含的所有 Amazon S3 許可都用於檢視 Amazon S3 儲存貯體以進行[自動化資料設定](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-console-create-manifest-file.html) (`ListAllMyBuckets`)、存取 Amazon S3 中的輸入資料 (`ListBucket`,`GetObject`)、在 Amazon S3 中檢查並在需要時建立 CORS 政策 (`GetBucketCors` 和 `PutBucketCors`)，以及將標籤工作輸出檔案寫入 S3 (`PutObject`)。
+ `cognito-idp` — 這些許可用於使用 Amazon Cognito 建立、檢視和管理員工以及私有人力資源。若要進一步了解這些動作，請參閱 [Amazon Cognito API 參考資料](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-reference.html)。

## 自訂標籤工作流程許可
<a name="sms-security-permissions-custom-workflow"></a>

將下列陳述式新增至類似於 [Ground Truth 主控台許可](#sms-security-permissions-console-all) 中的政策，以授予使用者在[建立自訂標籤工作流程](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-custom-templates.html)時，選取預先存在的註釋前和註釋後 Lambda 函式的權限。

```
{
    "Sid": "GroundTruthConsoleCustomWorkflow",
    "Effect": "Allow",
    "Action": [
        "lambda:InvokeFunction",
        "lambda:ListFunctions"
    ],
    "Resource": "*"
}
```

若要了解如何授予實體建立和測試註釋前和註釋後 Lambda 函式的許可，請參閱[使用 Lambda 與 Ground Truth 的必要許可](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-custom-templates-step3-lambda-permissions.html)。

## 私有人力資源許可
<a name="sms-security-permission-workforce-creation"></a>

新增至許可政策時，下列許可會授予使用 Amazon Cognito建立和管理私有人力資源和工作團隊的存取許可。使用 [OIDC IdP 人力資源](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-workforce-create-private-oidc.html#sms-workforce-create-private-oidc-next-steps)不需要這些許可。

```
{
    "Effect": "Allow",
    "Action": [
        "cognito-idp:AdminAddUserToGroup",
        "cognito-idp:AdminCreateUser",
        "cognito-idp:AdminDeleteUser",
        "cognito-idp:AdminDisableUser",
        "cognito-idp:AdminEnableUser",
        "cognito-idp:AdminRemoveUserFromGroup",
        "cognito-idp:CreateGroup",
        "cognito-idp:CreateUserPool",
        "cognito-idp:CreateUserPoolClient",
        "cognito-idp:CreateUserPoolDomain",
        "cognito-idp:DescribeUserPool",
        "cognito-idp:DescribeUserPoolClient",
        "cognito-idp:ListGroups",
        "cognito-idp:ListIdentityProviders",
        "cognito-idp:ListUsers",
        "cognito-idp:ListUsersInGroup",
        "cognito-idp:ListUserPoolClients",
        "cognito-idp:ListUserPools",
        "cognito-idp:UpdateUserPool",
        "cognito-idp:UpdateUserPoolClient"
        ],
    "Resource": "*"
}
```

若要進一步了解如何使用 Amazon Cognito 建立私有人力資源，請參閱[Amazon Cognito 人力資源](sms-workforce-private-use-cognito.md)。

## 廠商人力資源許可
<a name="sms-security-permissions-workforce-creation-vendor"></a>

您可以將下列陳述式新增至[授予 IAM 許可以使用 Amazon SageMaker Ground Truth 主控台](#sms-security-permission-console-access)中的政策，以授予實體訂閱[廠商人力資源](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-workforce-management-vendor.html)的許可。

```
{
    "Sid": "AccessAwsMarketplaceSubscriptions",
    "Effect": "Allow",
    "Action": [
        "aws-marketplace:Subscribe",
        "aws-marketplace:Unsubscribe",
        "aws-marketplace:ViewSubscriptions"
    ],
    "Resource": "*"
}
```

# 為 Ground Truth 標籤工作建立 SageMaker AI 執行角色
<a name="sms-security-permission-execution-role"></a>

設定標籤工作時，您需要提供*執行角色*，這是 SageMaker AI 授權假設啟動和執行標籤工作的角色。

此角色必須授予下列項目的 Ground Truth 存取許可：
+ Amazon S3 以擷取輸入資料，並將輸出資料寫入至 Amazon S3 儲存貯體。您可以透過提供儲存貯體 ARN，授予 IAM 角色存取整個儲存貯體的許可；或者，您也可以授予角色存取儲存貯體中特定資源的存取權。例如，儲存貯體的 ARN 看起來可能類似於 `arn:aws:s3:::amzn-s3-demo-bucket1`，且 Amazon S3 儲存貯體中資源的 ARN 看起來可能類似於 `arn:aws:s3:::amzn-s3-demo-bucket1/prefix/file-name.png`。若要將動作套用至 Amazon S3 儲存貯體中的所有資源，您可以使用萬用字元：`*`。例如 `arn:aws:s3:::amzn-s3-demo-bucket1/prefix/*`。如需更多資訊，請參閱 Amazon Simple Storage Service 使用者指南中的 [Amazon S3 資源](https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html)。
+ CloudWatch 用來記錄工作者指標和標籤工作狀態。
+ AWS KMS 用於資料加密。(選用)
+ AWS Lambda 用於在建立自訂工作流程時處理輸入和輸出資料。

此外，如果您建立[串流標籤工作](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-streaming-labeling-job.html)，則此角色必須具有存取許可：
+ Amazon SQS 可建立與用於[管理標籤請求](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-streaming-labeling-job.html#sms-streaming-how-it-works-sqs)的 SQS 佇列互動。
+ Amazon SNS 以從您的 Amazon SNS 輸入主題訂閱和擷取訊息，並將傳送訊息到您的 Amazon SNS 輸出主題。

所有這些許可都可以透過 `[AmazonSageMakerGroundTruthExecution](https://console.aws.amazon.com/iam/home?#/policies/arn:aws:iam::aws:policy/AmazonSageMakerGroundTruthExecution)` 受管政策進行授權，而*例外*情形如下：
+ Amazon S3 儲存貯體的資料和儲存磁碟區加密。若要了解如何設定這些許可，請參閱[使用 加密輸出資料和儲存磁碟區 AWS KMS](sms-security-kms-permissions.md)。
+ 選取及調用函式名稱中不包含 `GtRecipe`、`SageMaker`、`Sagemaker`、`sagemaker`、或 `LabelingFunction` 的 Lambda 函式之權限。
+ Amazon S3 儲存貯體的字首或儲存貯體名稱不包含 `GroundTruth`、`Groundtruth`、`groundtruth`、`SageMaker`、`Sagemaker` 和 `sagemaker`，或是[物件標籤](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html)名稱中包含 `SageMaker` (不區分大小寫)。

如果您需要比 `AmazonSageMakerGroundTruthExecution` 更為精細的許可，請使用下列政策範例，建立符合您特定使用案例的執行角色。

**Topics**
+ [內建任務類型 (非串流) 執行角色需求](#sms-security-permission-execution-role-built-in-tt)
+ [內建任務類型 (串流) 執行角色需求](#sms-security-permission-execution-role-built-in-tt-streaming)
+ [自訂任務類型的執行角色需求](#sms-security-permission-execution-role-custom-tt)
+ [自動化資料標籤權限需求](#sms-security-permission-execution-role-custom-auto-labeling)

## 內建任務類型 (非串流) 執行角色需求
<a name="sms-security-permission-execution-role-built-in-tt"></a>

下列政策將為[內建任務類型](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-task-types.html)授權建立標籤工作。此執行政策不包含 AWS KMS 資料加密或解密的許可。使用您自己的 Amazon S3 ARN 取代每個紅色斜體的 ARN。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "S3ViewBuckets",
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket",
                "s3:GetBucketLocation"
            ],
            "Resource": [
                "arn:aws:s3:::<input-bucket-name>",
                "arn:aws:s3:::<output-bucket-name>"
            ]
        },
        {
            "Sid": "S3GetPutObjects",
            "Effect": "Allow",
            "Action": [
                "s3:AbortMultipartUpload",
                "s3:GetObject",
                "s3:PutObject"
            ],
            "Resource": [
                "arn:aws:s3:::<input-bucket-name>/*",
                "arn:aws:s3:::<output-bucket-name>/*"
            ]
        },
        {
            "Sid": "CloudWatch",
            "Effect": "Allow",
            "Action": [
                "cloudwatch:PutMetricData",
                "logs:CreateLogStream",
                "logs:CreateLogGroup",
                "logs:DescribeLogStreams",
                "logs:PutLogEvents"
            ],
            "Resource": "*"
        }
    ]
}
```

------

## 內建任務類型 (串流) 執行角色需求
<a name="sms-security-permission-execution-role-built-in-tt-streaming"></a>

如果您建立串流標籤工作，則必須將類似下列內容的政策，新增至用於建立標籤工作的執行角色。若要縮小政策的範圍，請將 `*`中的 取代`Resource`為您想要授予 IAM 角色存取和使用許可的特定 AWS 資源。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:AbortMultipartUpload",
                "s3:GetObject",
                "s3:PutObject"
            ],
            "Resource": [
                "arn:aws:s3:::amzn-s3-demo-bucket/*",
                "arn:aws:s3:::amzn-s3-demo-bucket2/*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetObject"
            ],
            "Resource": "*",
            "Condition": {
                "StringEqualsIgnoreCase": {
                    "s3:ExistingObjectTag/SageMaker": "true"
                }
            }
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetBucketLocation",
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::amzn-s3-demo-bucket",
                "arn:aws:s3:::amzn-s3-demo-bucket2"
            ]
        },
        {
            "Sid": "CloudWatch",
            "Effect": "Allow",
            "Action": [
                "cloudwatch:PutMetricData",
                "logs:CreateLogStream",
                "logs:CreateLogGroup",
                "logs:DescribeLogStreams",
                "logs:PutLogEvents"
            ],
            "Resource": "*"
        },
        {
            "Sid": "StreamingQueue",
            "Effect": "Allow",
            "Action": [
                "sqs:CreateQueue",
                "sqs:DeleteMessage",
                "sqs:GetQueueAttributes",
                "sqs:GetQueueUrl",
                "sqs:ReceiveMessage",
                "sqs:SendMessage",
                "sqs:SetQueueAttributes"
            ],
            "Resource": "arn:aws:sqs:*:*:*GroundTruth*"
        },
        {
            "Sid": "StreamingTopicSubscribe",
            "Effect": "Allow",
            "Action": "sns:Subscribe",
            "Resource": [
                "arn:aws:sns:us-east-1:111122223333:input-topic-name",
                "arn:aws:sns:us-east-1:111122223333:output-topic-name"
            ],
            "Condition": {
                "StringEquals": {
                    "sns:Protocol": "sqs"
                },
                "StringLike": {
                    "sns:Endpoint": "arn:aws:sns:us-east-1:111122223333:*GroundTruth*"
                }
            }
        },
        {
            "Sid": "StreamingTopic",
            "Effect": "Allow",
            "Action": [
                "sns:Publish"
            ],
            "Resource": [
                "arn:aws:sns:us-east-1:111122223333:input-topic-name",
                "arn:aws:sns:us-east-1:111122223333:output-topic-name"
            ]
        },
        {
            "Sid": "StreamingTopicUnsubscribe",
            "Effect": "Allow",
            "Action": [
                "sns:Unsubscribe"
            ],
            "Resource": [
                "arn:aws:sns:us-east-1:111122223333:input-topic-name",
                "arn:aws:sns:us-east-1:111122223333:output-topic-name"
            ]
        }
    ]
}
```

------

## 自訂任務類型的執行角色需求
<a name="sms-security-permission-execution-role-custom-tt"></a>

如果您要建立[自訂標籤工作流程](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-custom-templates.html)，請將下列陳述式新增至執行角色政策，如同在 [內建任務類型 (非串流) 執行角色需求](#sms-security-permission-execution-role-built-in-tt) 或 [內建任務類型 (串流) 執行角色需求](#sms-security-permission-execution-role-built-in-tt-streaming) 中找到的執行角色政策。

此政策將執行角色授予 `Invoke` 您註釋前和註釋後 Lambda 函式的權限。

```
{
    "Sid": "LambdaFunctions",
    "Effect": "Allow",
    "Action": [
        "lambda:InvokeFunction"
    ],
    "Resource": [
        "arn:aws:lambda:<region>:<account-id>:function:<pre-annotation-lambda-name>",
        "arn:aws:lambda:<region>:<account-id>:function:<post-annotation-lambda-name>"
    ]
}
```

## 自動化資料標籤權限需求
<a name="sms-security-permission-execution-role-custom-auto-labeling"></a>

如果要在啟用[自動化資料標籤](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-automated-labeling.html)的情況下建立標籤工作，則必須 1) 新增一個政策，附加到執行角色的 IAM 政策，然後 2) 更新執行角色的信任政策。

下列陳述式允許將 IAM 執行角色傳遞給 SageMaker AI，以便分別用於執行用於主動學習和自動化資料標籤的訓練和推論任務。將此陳述式新增至執行角色政策，就像在 [內建任務類型 (非串流) 執行角色需求](#sms-security-permission-execution-role-built-in-tt) 或 [內建任務類型 (串流) 執行角色需求](#sms-security-permission-execution-role-built-in-tt-streaming) 中找到的執行角色政策。將 `arn:aws:iam::<account-number>:role/<role-name>` 取代為執行角色 ARN。您可以在 IAM 主控台的**角色**底下，找到您的 IAM 角色 ARN。

```
{
    "Effect": "Allow",
    "Action": [
        "iam:PassRole"
    ],
    "Resource": "arn:aws:iam::<account-number>:role/<execution-role-name>",
    "Condition": {
        "StringEquals": {
            "iam:PassedToService": [
                "sagemaker.amazonaws.com"
            ]
        }
    }
}
```

下列陳述式可讓 SageMaker AI 擔任執行角色，以建立和管理 SageMaker 訓練和推論任務。此政策必須新增至執行角色的信任關係。若要了解如何新增或修改 IAM 角色信任政策，請參閱 IAM 使用者指南中的[修改角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_manage_modify.html)。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": {
        "Effect": "Allow",
        "Principal": {"Service": "sagemaker.amazonaws.com" },
        "Action": "sts:AssumeRole"
    }
}
```

------



# 使用 加密輸出資料和儲存磁碟區 AWS KMS
<a name="sms-security-kms-permissions"></a>

您可以在建立標籤工作時指定[客戶受管金鑰](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#master_keys)，以使用 AWS Key Management Service (AWS KMS) 加密來自標籤工作的輸出資料。如果您使用 API 作業 `CreateLabelingJob` 建立使用自動化資料標籤的標籤工作，您也可以使用客戶受管金鑰來加密連接至機器學習 (ML) 運算執行個體的儲存磁碟區，以執行訓練和推論工作。

本節說明您必須附加至客戶受管金鑰以啟用輸出資料加密的 IAM 政策，以及必須附加至客戶受管金鑰和執行角色的政策，以使用儲存磁碟區加密。若要進一步了解這些選項，請參閱[輸出資料與儲存磁碟區加密](sms-security.md)。

## 使用 KMS 加密輸出資料
<a name="sms-security-kms-permissions-output-data"></a>

如果您指定 AWS KMS 客戶受管金鑰來加密輸出資料，則必須將類似以下內容的 IAM 政策新增至該金鑰。此政策提供您用來建立標籤工作權限的 IAM 執行角色，以便使用此金鑰執行 `"Action"` 中列出的所有動作。若要進一步了解這些動作，請參閱《 AWS Key Management Service 開發人員指南》中的[AWS KMS 許可](https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html)。

要使用此政策，請將 `"Principal"` 的 IAM 服務角色 ARN，取代為您用來建立標籤工作的執行角色 ARN。在主控台中建立標籤工作時，這是您在**工作概觀**區段下為 **IAM 角色**指定的角色。使用 `CreateLabelingJob` 建立標籤工作時，這是您為 [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateLabelingJob.html#sagemaker-CreateLabelingJob-request-RoleArn](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateLabelingJob.html#sagemaker-CreateLabelingJob-request-RoleArn) 指定的 ARN。

```
{
    "Sid": "AllowUseOfKmsKey",
    "Effect": "Allow",
    "Principal": {
        "AWS": "arn:aws:iam::111122223333:role/service-role/example-role"
    },
    "Action": [
        "kms:Encrypt",
        "kms:Decrypt",
        "kms:ReEncrypt*",
        "kms:GenerateDataKey*",
        "kms:DescribeKey"
    ],
    "Resource": "*"
}
```

## 加密自動化資料標籤機器學習 (ML) 運算執行個體儲存磁碟區
<a name="sms-security-kms-permissions-storage-volume"></a>

如果您指定一個 [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_LabelingJobResourceConfig.html#sagemaker-Type-LabelingJobResourceConfig-VolumeKmsKeyId](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_LabelingJobResourceConfig.html#sagemaker-Type-LabelingJobResourceConfig-VolumeKmsKeyId)，用來加密機器學習 (ML) 運算執行個體的儲存磁碟區，其用於自動化資料標籤訓練和推論，則必須執行下列動作：
+ 將 [使用 KMS 加密輸出資料](#sms-security-kms-permissions-output-data) 中描述的許可附加至客戶受管金鑰。
+ 將類似下列內容的政策，附加至您用來建立標籤工作的 IAM 執行角色。這是您在 `CreateLabelingJob` 中為 [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateLabelingJob.html#sagemaker-CreateLabelingJob-request-RoleArn](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateLabelingJob.html#sagemaker-CreateLabelingJob-request-RoleArn) 指定的 IAM 角色。若要進一步了解此政策允許`"kms:CreateGrant"`的動作，請參閱 AWS Key Management Service API 參考[https://docs.aws.amazon.com/kms/latest/APIReference/API_CreateGrant.html](https://docs.aws.amazon.com/kms/latest/APIReference/API_CreateGrant.html)中的 。

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

****  

```
{
"Version":"2012-10-17",		 	 	  
"Statement": 
 [  
   {
    "Effect": "Allow",
    "Action": [
       "kms:CreateGrant"
    ],
    "Resource": "*"
  }
]
}
```

------

若要進一步了解 Ground Truth 儲存磁碟區加密，請參閱[使用 KMS 金鑰加密自動化資料標籤儲存磁碟區 (僅限 API)](sms-security.md#sms-security-kms-storage-volume)。

# 在 Amazon Virtual Private Cloud 使用 Amazon SageMaker Ground Truth
<a name="sms-vpc"></a>

 使用 [Amazon Virtual Private Cloud](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Introduction.html) (Amazon VPC)，您可以在您定義的邏輯隔離虛擬網路中啟動 AWS 資源。Ground Truth 支援在 Amazon VPC 中執行標籤工作，而非透過網際網路連線。當您在 Amazon VPC 中啟動標記任務時，VPC 和 Ground Truth 之間的通訊會完全安全地在 AWS 網路中執行。

本指南說明，您可以如何透過下列方式在 Amazon VPC 使用 Ground Truth：

1. [在 Amazon Virtual Private Cloud 執行 Amazon SageMaker Ground Truth 標籤工作](samurai-vpc-labeling-job.md)

1. [從私有工作者入口網站使用 Amazon VPC 模式](samurai-vpc-worker-portal.md)

# 在 Amazon Virtual Private Cloud 執行 Amazon SageMaker Ground Truth 標籤工作
<a name="samurai-vpc-labeling-job"></a>

Ground Truth 支援 Amazon VPC 中的以下功能。
+ 您可以使用 Amazon S3 儲存貯體政策，從特定的 Amazon VPC 端點或特定的 VPC，控制對儲存貯體的存取。如果您啟動標籤工作，且輸入資料位於僅限 VPC 中使用者的 Amazon S3 儲存貯體，您可以新增儲存貯體政策，同時授權 Ground Truth 端點存取儲存貯體的許可。如需詳細資訊，請參閱 [允許 Ground Truth 存取 VPC 限制的 Amazon S3 儲存貯體](#sms-vpc-permissions-s3)。
+ 您可以在 VPC 啟動[自動化資料標籤工作](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-automated-labeling.html)。您可以使用 VPC 組態指定 VPC 子網路和安全群組。SageMaker AI 使用此組態啟動用於 VPC 中自動化資料標籤的訓練和推論工作。如需詳細資訊，請參閱 [在 VPC 建立自動資料標籤工作](#sms-vpc-permissions-automated-labeling)。

您可以透過以下任何方式使用這些選項。
+ 您可以使用這兩種方法，使用受 VPC 保護的 Amazon S3 儲存貯體啟動標籤工作，並啟用自動化資料標籤。
+ 您可以使用任何[內建任務類型](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-task-types.html)，使用受 VPC 保護的儲存貯體啟動標籤工作。
+ 您可以使用受 VPC 保護的儲存貯體啟動[自訂標籤工作流程](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-custom-templates.html)。Ground Truth 會使用 [AWS PrivateLink](https://docs.aws.amazon.com/vpc/latest/privatelink/endpoint-services-overview.html) 端點，與您的註釋前和註釋後的 Lambda 函式互動。

我們建議您在 Amazon VPC 建立標籤工作之前先檢閱[在 VPC 執行 Ground Truth 標籤工作的先決條件](#sms-vpc-gt-prereq)。

## 在 VPC 執行 Ground Truth 標籤工作的先決條件
<a name="sms-vpc-gt-prereq"></a>

在 Amazon VPC 建立 Ground Truth 標籤工作之前，請先檢閱下列先決條件。
+ 如果您是 Ground Truth 的新使用者，請檢閱[入門](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-getting-started.html)，瞭解如何建立標籤工作。
+ 如果您的輸入資料位於受 VPC 保護的 Amazon S3 儲存貯體，則工作者必須從 VPC 存取工作者入口網站。VPC 型標籤工作需要使用私有工作團隊。若要進一步了解如何建立私有工作團隊，請參閱[使用私有人力資源](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-workforce-private.html)。
+ 下列先決條件僅適用於啟動 VPC 中的標籤工作。
  + 請參閱[建立 Amazon S3 VPC 端點](https://docs.aws.amazon.com/sagemaker/latest/dg/train-vpc.html#train-vpc-s3)中的指示。自動化資料標籤工作流程中使用的訓練和推論容器，使用此端點與 Amazon S3 中的儲存貯體通訊。
  + 檢閱[自動化資料標籤](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-automated-labeling.html)進一步了解此功能。請注意，下列[內建任務類型](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-task-types.html)支援自動化資料標籤：[影像分類 (單一標籤)](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-image-classification.html)、[映像語意分割](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-semantic-segmentation.html)、[邊界框](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-bounding-box.html)和[文字分類 (單一標籤)](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-text-classification.html)。串流標籤工作不支援自動化資料標籤。
+ 檢閱 [Ground Truth 安全與許可](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-security-general.html)區段，並確定您已符合下列條件。
  + 建立標籤工作的使用者擁有所有必要的許可
  + 您已建立具有必要許可的 IAM 執行角色。如果使用案例不需要微調的許可，建議您使用[以 Ground Truth 授予一般許可開始使用](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-security-permission.html#sms-security-permissions-get-started)中所述的 IAM 受管政策。
  + 允許您的 VPC 存取 `sagemaker-labeling-data-region` 和 `sm-bxcb-region-saved-task-states` S3 儲存貯體。這些是系統擁有的區域化 S3 儲存貯體，在工作者處理任務時，從工作者入口網站存取即可。我們使用這些儲存貯體與系統管理的資料互動。

## 允許 Ground Truth 存取 VPC 限制的 Amazon S3 儲存貯體
<a name="sms-vpc-permissions-s3"></a>

以下各節就 Ground Truth 使用僅限 VPC 和 VPC 端點存取權的 Amazon S3 儲存貯體啟動標籤工作所需許可，提供詳細資訊。若要了解如何限制 Amazon S3 儲存貯體對 VPC 的存取權，請參閱 Amazon Simple Storage Service 使用者指南中的[使用儲存貯體政策控制 VPC 端點進行存取](https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-bucket-policies-vpc-endpoint.html)。若要了解如何新增政策至 S3 儲存貯體，請參閱[使用 Amazon S3 主控台新增儲存貯體政策](https://docs.aws.amazon.com/AmazonS3/latest/userguide/add-bucket-policy.html)。

**注意**  
修改現有儲存貯體上的政策，可能導致 `IN_PROGRESS` Ground Truth 工作失敗。我們建議您使用新建儲存貯體開始新工作。如果您想繼續使用相同的儲存貯體，您可以執行以下項目之一。  
等待 `IN_PROGRESS` 工作完成。
使用主控台或 AWS CLI終止工作。

您可以使用 [AWS PrivateLink](https://aws.amazon.com/privatelink/) 端點將 Amazon S3 儲存貯體存取限制為 VPC 中的使用者。舉例而言，下列 S3 儲存貯體政策只允許從 `<vpc>` 和端點 `<vpc-endpoint>` 存取特定儲存貯體 `<bucket-name>`。修改此政策時，您必須以您的資源和規格取代所有*紅色斜體文字*。

**注意**  
下列政策*拒絕* VPC 中使用者*以外*的所有實體，執行 `Action` 列出的動作。如果您未在此清單中包含動作，任何有權存取此儲存貯體和執行這些動作之許可的實體，仍可存取這些動作。例如，如果使用者有許可，得在 Amazon S3 儲存貯體上執行 `GetBucketLocation`，則以下政策不會限制使用者在 VPC 以外執行此動作。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Id": "Policy1415115909152",
    "Statement": [
        {
            "Sid": "AccessToSpecificVPCEOnly",
            "Action": [
                "s3:GetObject",
                "s3:PutObject"
            ],
            "Effect": "Deny",
            "Resource": [
                "arn:aws:s3:::amzn-s3-demo-bucket",
                "arn:aws:s3:::amzn-s3-demo-bucket/*"
            ],
            "Condition": {
                "StringNotEquals": {
                    "aws:sourceVpce": [
                        "vpce-12345678",
                        "vpce-12345678901234567"
                    ]
                }
            }
        }
    ]
}
```

------

Ground Truth 必須能夠在您用來配置標籤工作之 S3 儲存貯體執行下列 Amazon S3 動作。

```
"s3:AbortMultipartUpload",
"s3:GetObject",
"s3:PutObject",
"s3:ListBucket",
"s3:GetBucketLocation"
```

將 Ground Truth 端點新增到儲存貯體政策 (如前述政策) 即可達成這項目的。下表包含每個 AWS 區域的 Ground Truth 服務端點。在您用來執行標籤工作的相同 [AWS 區域](https://docs.aws.amazon.com/general/latest/gr/rande.html)新增端點至儲存貯體政策。


****  

| AWS 區域 | Ground Truth 端點 | 
| --- | --- | 
| us-east-2 | vpce-02569ba1c40aad0bc | 
| us-east-1 | vpce-08408e335ebf95b40 | 
| us-west-2 | vpce-0ea07aa498eb78469 | 
| ca-central-1 | vpce-0d46ea4c9ff55e1b7 | 
| eu-central-1 | vpce-0865e7194a099183d | 
| eu-west-2 | vpce-0bccd56798f4c5df0 | 
| eu-west-1 | vpce-0788e7ed8628e595d | 
| ap-south-1 | vpce-0d7fcda14e1783f11 | 
| ap-southeast-2 | vpce-0b7609e6f305a77d4 | 
| ap-southeast-1 | vpce-0e7e67b32e9efed27 | 
| ap-northeast-2 | vpce-007893f89e05f2bbf | 
| ap-northeast-1 | vpce-0247996a1a1807dbd | 

例如，下列政策會限制下列位置的 `GetObject` 和 `PutObject` 行動：
+ VPC 中使用者的 Amazon S3 儲存貯體 (`<vpc>`)
+ VPC 端點 (`<vpc-endpoint>`)
+ Ground Truth 服務端點 (`<ground-truth-endpoint>`)

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Id": "1",
    "Statement": [
        {
            "Sid": "DenyAccessFromNonGTandCustomerVPC",
            "Effect": "Deny",
            "Principal": "*",
            "Action": [
                "s3:GetObject",
                "s3:PutObject"
            ],
            "Resource": [
                "arn:aws:s3:::bucket-name",
                "arn:aws:s3:::bucket-name/*"
            ],
            "Condition": {
              "StringNotEquals": {
                "aws:SourceVpc": "vpc-12345678",
                "aws:sourceVpce": [
                  "vpce-12345678",
                  "vpce-12345678"
                ] 
             }
           }
        }
    ]
}
```

------

如果您希望使用者擁有使用 Ground Truth 主控台啟動標籤工作的許可，您還必須使用 `aws:PrincipalArn` 條件，將使用者 ARN 新增至儲存貯體政策。此使用者還必須擁有許可，才能在您用來啟動標籤工作的儲存貯體執行以下 Amazon S3 動作。

```
"s3:GetObject",
"s3:PutObject",
"s3:ListBucket",
"s3:GetBucketCors",
"s3:PutBucketCors",
"s3:ListAllMyBuckets",
```

下列程式碼是儲存貯體政策的範例，該政策將 S3 儲存貯體 `<bucket-name>` 列於 `Action` 的動作執行許可限制為下列項目。
+ *<role-name>*
+ `aws:sourceVpce` 列出的 VPC 端點
+ 名稱為 *<vpc>* 之 VPC 內的使用者

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Id": "1",
    "Statement": [
        {
            "Sid": "DenyAccessFromNonGTandCustomerVPC",
            "Effect": "Deny",
            "Principal": "*",
            "Action": [
                "s3:GetObject",
                "s3:PutObject"
            ],
            "Resource": [
                "arn:aws:s3:::bucket-name/*",
                "arn:aws:s3:::bucket-name"
            ],
            "Condition": {
                "StringNotEquals": {
                    "aws:SourceVpc": "vpc-12345678",
                    "aws:PrincipalArn": "arn:aws:iam::111122223333:role/role-name"
                },
                "StringNotEquals": {
                    "aws:sourceVpce": [
                        "vpce-12345678",
                        "vpce-12345678"
                    ]
                }
            }
        }
    ]
}
```

------

**注意**  
您用於輸入和輸出資料的 Amazon VPC 介面端點和受保護的 Amazon S3 儲存貯體必須位於您用來建立標記任務的相同 AWS 區域中。

授權 Ground Truth 存取 Amazon S3 儲存貯體的許可後，您可以使用[建立標籤工作](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-create-labeling-job.html)中的其中一個主題啟動標籤工作。為您的輸入和輸出資料儲存貯體，指定受 VPC 限制的 Amazon S3 儲存貯體。

## 在 VPC 建立自動資料標籤工作
<a name="sms-vpc-permissions-automated-labeling"></a>

若要使用 Amazon VPC 建立自動化資料標籤工作，您可以使用 Ground Truth 主控台或 `CreateLabelingJob` API 作業提供 VPC 組態。SageMaker AI 使用您提供的子網路和安全群組，啟動用於自動化標籤的訓練和推論工作。

**重要**  
使用 VPC 組態啟動自動化資料標籤工作之前，請確定已使用要用於標籤工作的 VPC 建立 Amazon S3 VPC 端點。若要了解如何操作，請參閱[建立 Amazon S3 VPC 端點](https://docs.aws.amazon.com/sagemaker/latest/dg/train-vpc.html#train-vpc-s3)。  
此外，如果您使用受 VPC 限制的 Amazon S3 儲存貯體建立自動化資料標籤工作，則必須遵循 [允許 Ground Truth 存取 VPC 限制的 Amazon S3 儲存貯體](#sms-vpc-permissions-s3) 的指示，授予 Ground Truth 存取儲存貯體的權限。

使用下列程序瞭解如何將 VPC 組態新增至標籤工作請求。

**將 VPC 組態新增至自動化資料標籤工作 (主控台)：**

1. 遵循[建立標籤工作 (主控台)](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-create-labeling-job-console.html) 中的指示，完成程序中的每個步驟 (至步驟 15)。

1. 在**工作者**區段中，選取**啟用自動化資料標籤 (Enable automated data labeling)** 旁邊的核取方塊。

1. 選取箭頭，將主控台的 **VPC 組態**區段最大化。

1. 指定您想用於自動資料標籤工作的**虛擬私有雲端 (VPC)**。

1. 選擇**子網路**下的下拉式清單，然後選取一或多個子網路。

1. 選擇**安全群組** 下方的下拉式清單，然後選取一或多個群組。

1. 完成[建立標籤工作 (主控台)](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-create-labeling-job-console.html) 中程序的所有剩餘步驟。

**將 VPC 組態新增至自動化資料標籤工作 (API)：**  
若要使用 Ground Truth API 作業配置標籤工作 `CreateLabelingJob`，請遵循[建立自動化資料標籤工作 (API)](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-automated-labeling.html#sms-create-automated-labeling-api) 中的指示配置請求。除了本文件所述的參數之外，您還必須在 `LabelingJobResourceConfig` 包含 `VpcConfig` 參數，才能使用下列結構描述指定一或多個子網路和安全群組。

```
"LabelingJobAlgorithmsConfig": { 
      "InitialActiveLearningModelArn": "string",
      "LabelingJobAlgorithmSpecificationArn": "string",
      "LabelingJobResourceConfig": { 
         "VolumeKmsKeyId": "string",
         "VpcConfig": { 
            "SecurityGroupIds": [ "string" ],
            "Subnets": [ "string" ]
         }
      }
}
```

以下是 [AWS Python SDK (Boto3) 請求](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sagemaker.html#SageMaker.Client.create_labeling_job)的範例，該請求可使用私有人力資源，在美國東部 (維吉尼亞北部) 區域建立自動化資料標籤工作。以您的標籤工作資源和規格取代所有*紅色斜體文字*。若要進一步了解 `CreateLabelingJob` 作業操作，請參閱[建立標籤工作 (API)](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-create-labeling-job-api.html) 教學課程和 [CreateLabelingJob](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateLabelingJob.html) API 文件。

```
import boto3
client = boto3.client(service_name='sagemaker')

response = client.create_labeling_job(
    LabelingJobName="example-labeling-job",
    LabelAttributeName="label",
    InputConfig={
        'DataSource': {
            'S3DataSource': {
                'ManifestS3Uri': "s3://bucket/path/manifest-with-input-data.json"
            }
        }
    },
    "LabelingJobAlgorithmsConfig": {
      "LabelingJobAlgorithmSpecificationArn": "arn:aws:sagemaker:us-east-1:027400017018:labeling-job-algorithm-specification/tasktype",
      "LabelingJobResourceConfig": { 
         "VpcConfig": { 
            "SecurityGroupIds": [ "sg-01233456789", "sg-987654321" ],
            "Subnets": [ "subnet-e0123456", "subnet-e7891011" ]
         }
      }
    },
    OutputConfig={
        'S3OutputPath': "s3://bucket/path/file-to-store-output-data",
        'KmsKeyId': "string"
    },
    RoleArn="arn:aws:iam::*:role/*,
    LabelCategoryConfigS3Uri="s3://bucket/path/label-categories.json",
    StoppingConditions={
        'MaxHumanLabeledObjectCount': 123,
        'MaxPercentageOfInputDatasetLabeled': 123
    },
    HumanTaskConfig={
        'WorkteamArn': "arn:aws:sagemaker:region:*:workteam/private-crowd/*",
        'UiConfig': {
            'UiTemplateS3Uri': "s3://bucket/path/custom-worker-task-template.html"
        },
        'PreHumanTaskLambdaArn': "arn:aws:lambda:us-east-1:432418664414:function:PRE-tasktype",
        'TaskKeywords': [
            "Images",
            "Classification",
            "Multi-label"
        ],
        'TaskTitle': "Add task title here",
        'TaskDescription': "Add description of task here for workers",
        'NumberOfHumanWorkersPerDataObject': 1,
        'TaskTimeLimitInSeconds': 3600,
        'TaskAvailabilityLifetimeInSeconds': 21600,
        'MaxConcurrentTaskCount': 1000,
        'AnnotationConsolidationConfig': {
            'AnnotationConsolidationLambdaArn': "arn:aws:lambda:us-east-1:432418664414:function:ACS-tasktype"
        },
    Tags=[
        {
            'Key': "string",
            'Value': "string"
        },
    ]
)
```

# 從私有工作者入口網站使用 Amazon VPC 模式
<a name="samurai-vpc-worker-portal"></a>

若要將工作者入口網站存取權限限制為在 Amazon VPC 內工作的標籤者，您可以在建立 Ground Truth 私有人力資源時新增 VPC 組態。您也可以將 VPC 組態新增至現有的私有人力資源。Ground Truth 會自動在您的 VPC 中建立 VPC 介面端點，並在您的 VPC 端點和 Ground Truth 服務之間設定 AWS PrivateLink 。可從您的 VPC 存取與該人力資源建立關聯的工作者入口網站 URL。亦可從公有網際網路存取工作者入口網站 URL，直到您對公有網際網路設定限制。從您的人力資源刪除人力或移除 VPC 組態時，Ground Truth 會自動刪除與該人力資源建立關聯的 VPC 端點。

**注意**  
一個人力資源僅可由一個 VPC 支援。

[點雲](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-point-cloud.html)和[影片](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-video.html)任務不支援透過 VPC 載入。

本指南示範如何完成在您的人力資源中新增和刪除 Amazon VPC 組態的必要步驟，以及滿足先決條件。

## 先決條件
<a name="samurai-vpc-getting-started-prerequisites"></a>

若要在 Amazon VPC 執行 Ground Truth 標籤工作，請檢閱下列先決條件。
+ 您已設定您可使用的 Amazon VPC。如果您尚未設定 VPC，請按照以下指示[建立 VPC](https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html#interface-endpoint-shared-subnets)。
+ 視[工作者任務範本](https://docs.aws.amazon.com/sagemaker/latest/dg/a2i-instructions-overview.html)的寫入方式而定，在標籤任務期間，可以直接從 Amazon S3 存取存放在 Amazon S3 儲存貯體中的資料。在此情況下，必須將 VPC 網路設定為允許從人工標籤者使用的裝置到包含標籤資料的 S3 儲存貯體流量。
+ 依照[檢視和更新 VPC 的 DNS 屬性](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html#vpc-dns-updating)以啟用 VPC 的 DNS 主機名稱和 DNS 解析。

**注意**  
為您的人力資源設定 VPC 的方法有兩種。您可以透過 [主控台](https://console.aws.amazon.com/sagemaker)或 AWS SageMaker AI [CLI](https://aws.amazon.com/cli/) 執行此操作。

# 使用 SageMaker AI 主控台管理 VPC 組態
<a name="samurai-vpc-workforce-console"></a>

您可以使用 [SageMaker AI 主控台](https://console.aws.amazon.com/sagemaker)來新增或移除 VPC 組態。您也可以刪除現有的人力資源。

## 將 VPC 組態新增至您的人力資源
<a name="samurai-add-vpc-workforce"></a>

### 建立私有人力資源
<a name="samurai-vpc-create-workforce"></a>
+ [使用 Amazon Cognito 建立私有人力資源](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-workforce-private-use-cognito.html)
+ [使用 OpenID Connect (OIDC) 身分提供者 (IdP) 建立私有人力資源](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-workforce-private-use-oidc.html)。

建立私有人力資源之後，請對私有人力資源新增 VPC 組態。

1. 在主控台導覽至 [Amazon SageMaker Runtime](https://console.aws.amazon.com/sagemaker)。

1. 選取左側面板的**標籤人力資源**。

1. 選取**私有**以存取您的私有人力資源。**人力資源狀態**為**作用中**後，選取 **VPC** 旁邊的**新增**。

1. 系統提示您設定 VPC 時，請提供下列資訊：

   1. 您的 **VPC**

   1. **子網路**

      1. 確保您的 VPC 具有現有的子網路

   1. **安全群組**

      1. 
**注意**  
您無法選取超過 5 個安全群組。

   1. 填寫此資訊後，選擇**確認**。

1. 選擇**確認**後，系統會將您重新導向回**標籤人力資源**下的**私有**頁面。您在頂端應該會看到綠色橫幅，其中顯示**您已成功初始化 VPC 組態的私有人力資源更新**。人力資源狀態為**正在更新**。**刪除人力資源**按鈕的旁邊是**重新整理**按鈕，可用來擷取最新的**人力資源狀態**。人力資源狀態變更為**作用中**後，VPC 端點 ID 也會更新。

## 從您的人力資源移除 VPC 組態
<a name="samurai-remove-vpc-workforce"></a>

請使用下列資訊，使用主控台從您的人力資源移除 VPC 組態。

1. 在主控台導覽至 [Amazon SageMaker Runtime](https://console.aws.amazon.com/sagemaker)。

1. 選取左側面板的**標籤人力資源**。

1. 尋找並選取您的人力資源。

1. 在**私有人力資源摘要**下，找到 **VPC** 並選擇旁邊的**移除**。

1. 選取 **Remove** (移除)。

## 透過主控台刪除人力資源
<a name="samurai-delete-vpc-workforce"></a>

如果刪除人力資源，則不應該有任何與其關聯的團隊。只有當人力資源狀態為**作用中**或**失敗**時，才能刪除人力資源。

使用下列資訊可使用主控台刪除人力資源。

1. 在主控台導覽至 [Amazon SageMaker Runtime](https://console.aws.amazon.com/sagemaker)。

1. 選取左側面板的**標籤人力資源**。

1. 尋找並選取您的人力資源。

1. 選擇**刪除人力資源**。

1. 選擇 **刪除** 。

# 使用 SageMaker AI AWS API 管理 VPC 組態
<a name="samurai-vpc-workforce-cli"></a>

使用下列各節，進一步了解如何管理 VPCs組態，同時維護工作團隊的適當存取層級。

## 使用 VPC 組態建立人力資源
<a name="samurai-create-vpc-cli"></a>

如果帳戶已有人力資源，則必須先將其刪除。您也可以使用 VPC 組態更新人力資源。

```
aws sagemaker create-workforce --cognito-config '{"ClientId": "app-client-id","UserPool": "Pool_ID",}' --workforce-vpc-config \       
" {\"VpcId\": \"vpc-id\", \"SecurityGroupIds\": [\"sg-0123456789abcdef0\"], \"Subnets\": [\"subnet-0123456789abcdef0\"]}" --workforce-name workforce-name
{
    "WorkforceArn": "arn:aws:sagemaker:us-west-2:xxxxxxxxx:workforce/workforce-name"
}
```

描述人力資源並確保狀態為 `Initializing`。

```
aws sagemaker describe-workforce --workforce-name workforce-name
{
    "Workforce": {
        "WorkforceName": "workforce-name",
        "WorkforceArn": "arn:aws:sagemaker:us-west-2:xxxxxxxxx:workforce/workforce-name",
        "LastUpdatedDate": 1622151252.451,
        "SourceIpConfig": {
            "Cidrs": []
        },
        "SubDomain": "subdomain.us-west-2.sagamaker.aws.com",
        "CognitoConfig": {
            "UserPool": "Pool_ID",
            "ClientId": "app-client-id"
        },
        "CreateDate": 1622151252.451,
        "WorkforceVpcConfig": {
            "VpcId": "vpc-id",
            "SecurityGroupIds": [
                "sg-0123456789abcdef0"
            ],
            "Subnets": [
                "subnet-0123456789abcdef0"
            ]
        },
        "Status": "Initializing"
    }
}
```

導覽至 Amazon VPC 主控台。從左側面板選取**端點**。您的帳戶應該已建立兩個 VPC 端點。

## 為您的人力資源新增 VPC 組態
<a name="samurai-add-vpc-cli"></a>

使用下列命令，透過 VPC 組態更新非 VPC 私有人力資源。

```
aws sagemaker update-workforce --workforce-name workforce-name\
--workforce-vpc-config "{\"VpcId\": \"vpc-id\", \"SecurityGroupIds\": [\"sg-0123456789abcdef0\"], \"Subnets\": [\"subnet-0123456789abcdef0\"]}"
```

描述人力資源並確保狀態為 `Updating`。

```
aws sagemaker describe-workforce --workforce-name workforce-name
{
    "Workforce": {
        "WorkforceName": "workforce-name",
        "WorkforceArn": "arn:aws:sagemaker:us-west-2:xxxxxxxxx:workforce/workforce-name",
        "LastUpdatedDate": 1622151252.451,
        "SourceIpConfig": {
            "Cidrs": []
        },
        "SubDomain": "subdomain.us-west-2.sagamaker.aws.com",
        "CognitoConfig": {
            "UserPool": "Pool_ID",
            "ClientId": "app-client-id"
        },
        "CreateDate": 1622151252.451,
        "WorkforceVpcConfig": {
            "VpcId": "vpc-id",
            "SecurityGroupIds": [
                "sg-0123456789abcdef0"
            ],
            "Subnets": [
                "subnet-0123456789abcdef0"
            ]
        },
        "Status": "Updating"
    }
}
```

導覽至 Amazon VPC 主控台。從左側面板選取**端點**。您的帳戶應該已建立兩個 VPC 端點。

## 從您的人力資源移除 VPC 組態
<a name="samurai-remove-vpc-cli"></a>

使用空的 VPC 組態更新 VPC 私有人力資源，以移除 VPC 資源。

```
aws sagemaker update-workforce --workforce-name workforce-name\ 
--workforce-vpc-config "{}"
```

描述人力資源並確保狀態為 `Updating`。

```
aws sagemaker describe-workforce --workforce-name workforce-name
{
    "Workforce": {
        "WorkforceName": "workforce-name",
        "WorkforceArn": "arn:aws:sagemaker:us-west-2:xxxxxxxxx:workforce/workforce-name",
        "LastUpdatedDate": 1622151252.451,
        "SourceIpConfig": {
            "Cidrs": []
        },
        "SubDomain": "subdomain.us-west-2.sagamaker.aws.com",
        "CognitoConfig": {
            "UserPool": "Pool_ID",
            "ClientId": "app-client-id"
        },
        "CreateDate": 1622151252.451,
        "Status": "Updating"
    }
}
```

導覽至 Amazon VPC 主控台。從左側面板選取**端點**。應刪除兩個 VPC 端點。

## 限制公開存取工作者入口網站，同時透過 VPC 維持存取權限
<a name="public-access-vpc"></a>

 VPC 或非 VPC 工作者入口網站中的工作者可以看到指派給他們的標籤工作。指派來自透過 OIDC 群組的工作團隊中的指派工作者。客戶有責任在其人力資源中設定 `sourceIpConfig`，限制對其公有工作者入口網站的存取。

**注意**  
您只能透過 SageMaker API 限制對工作者入口網站的存取。無法透過主控台來完成此選項。

使用下列命令來限制工作者入口網站的公有存取權限。

```
aws sagemaker update-workforce --region us-west-2 \
--workforce-name workforce-demo --source-ip-config '{"Cidrs":["10.0.0.0/16"]}'
```

在人力資源設定 `sourceIpConfig` 後，工作者可以存取 VPC 中的工作者入口網站，但不能透過公有網際網路存取。

**注意**  
您無法在 VPC 中對工作者入口網站設定 `sourceIP` 限制。

# 輸出資料與儲存磁碟區加密
<a name="sms-security"></a>

使用 Amazon SageMaker Ground Truth，您可以標籤高度敏感資料、維持資料的控制權，以及採用最佳安全實務。在執行標籤工作時，Ground Truth 會加密傳輸中和靜態的資料。此外，您可以搭配 Ground Truth 使用 AWS Key Management Service (AWS KMS) 來執行下列動作：
+ 使用[客戶受管金鑰](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#master_keys)來加密您的輸出資料。
+ 將 AWS KMS 客戶受管金鑰與自動化資料標記任務搭配使用，以加密連接至用於模型訓練和推論之運算執行個體的儲存磁碟區。

請使用此頁面的主題來進一步了解 Ground Truth 安全性功能。

## 使用 KMS 金鑰加密輸出資料
<a name="sms-security-kms-output-data"></a>

或者，您可以在建立標記任務時提供 AWS KMS 客戶受管金鑰，Ground Truth 會使用該任務來加密輸出資料。

如果您未提供客戶受管金鑰，Amazon SageMaker AI 會使用您角色帳戶的 Amazon S3 預設值 AWS 受管金鑰 來加密您的輸出資料。

如果您提供客戶受管金鑰，您必須將必要許可新增至[使用 加密輸出資料和儲存磁碟區 AWS KMS](sms-security-kms-permissions.md)中所述的金鑰。當您使用 API 作業 `CreateLabelingJob`，您可以使用參數 `[KmsKeyId](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_LabelingJobOutputConfig.html#sagemaker-Type-LabelingJobOutputConfig-KmsKeyId)` 來指定客戶受管金鑰 ID。請參閱下列程序，了解如何在使用主控台建立標籤工作時新增客戶受管金鑰。

**若要新增 AWS KMS 金鑰來加密輸出資料 （主控台）：**

1. 完成[建立標籤工作 (主控台)](sms-create-labeling-job-console.md)中的前 7 項步驟。

1. 在步驟 8，選取**其他組態**旁邊的箭頭以展開此區段。

1. 針對**加密金鑰**，選取您要用來加密輸出資料的 AWS KMS 金鑰。

1. 完成[建立標籤工作 (主控台)](sms-create-labeling-job-console.md)中的其餘步驟以建立標籤工作。

## 使用 KMS 金鑰加密自動化資料標籤儲存磁碟區 (僅限 API)
<a name="sms-security-kms-storage-volume"></a>

當您使用 `CreateLabelingJob` API 作業以建立自動化資料標籤的標籤工作時，您可以選擇將執行訓練和推論工作之機器學習 (ML) 運算執行個體，其連結之儲存磁碟區進行加密。若要將加密新增至您的儲存磁碟區，請使用 參數`VolumeKmsKeyId`輸入 AWS KMS 客戶受管金鑰。如需此參數的詳細資訊，請參閱`[LabelingJobResourceConfig](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_LabelingJobResourceConfig.html#sagemaker-Type-LabelingJobResourceConfig-VolumeKmsKeyId)`。

如果您為 `VolumeKmsKeyId` 指定一組金鑰 ID 或 ARN，您的 SageMaker AI 執行角色必須包含呼叫 `kms:CreateGrant` 的權限。若要了解如何將此權限新增至執行角色，請參閱[為 Ground Truth 標籤工作建立 SageMaker AI 執行角色](sms-security-permission-execution-role.md)。

**注意**  
如果您在主控台中建立標記任務時指定 AWS KMS 客戶受管金鑰，則該金鑰*僅用於*加密輸出資料。它不會用來加密連接至用於自動化資料標籤之機器學習 (ML) 運算執行個體的儲存磁碟區。

# 人力資源身分驗證與限制
<a name="sms-security-workforce-authentication"></a>

Ground Truth 可讓您使用自己的私有人力資源來進行標籤工作。*私有人力資源*是一種抽象概念，它指的是一組為您工作的人員。每個標籤工作都是使用工作團隊建立的，該團隊由您的人力資源中的工作者組成。Ground Truce 支援使用 Amazon Cognito 的私有人力資源建立。

Ground Truth 人力資源會對應至 Amazon Cognito 使用者集區。Ground Truth 工作團隊會對應至 Amazon Cognito 使用者團隊。Amazon Cognito 管理工作者身份驗證。Amazon Cognito 支援開放 ID 連線 (OIDC)，客戶可以自己的身分提供者 (IdP) 設定 Amazon Cognito 聯合。

Ground Truth 每個 AWS 區域每個帳戶僅允許一個人力。每個人力資源都有專用的 Ground Truth 工作入口網站登入 URL。

您也可以將工作者限制為無類別網域間路由 (CIDR) 區塊/IP 地址範圍。這表示註釋工具必須位於特定網路上，才能存取註釋位置。您可以為一個人力資源新增最多十個 CIDR 區塊。如需詳細資訊，請參閱 [使用 Amazon SageMaker API 管理私有人力資源](sms-workforce-management-private-api.md)。

若要了解如何建立私有人力資源，請參閱[建立私有人力資源 (Amazon Cognito)](sms-workforce-create-private.md)。

## 限制對人力資源類型的存取
<a name="sms-security-permission-condition-keys"></a>

Amazon SageMaker Ground Truth 工作團隊屬於三種[人力資源類型](https://docs.aws.amazon.com/sagemaker/latest/dg/sms-workforce-management.html)之一：公共 (使用 Amazon Mechanical Turk)、私有和廠商。若要使用其中一種類型或工作團隊 ARN 來將使用者存取權限制為某個特定的工作團隊，請使用 `sagemaker:WorkteamType` 和/或 `sagemaker:WorkteamArn` 條件索引鍵。若是 `sagemaker:WorkteamType` 條件金鑰，請使用[字串條件運算子](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html#Conditions_String)。若是 `sagemaker:WorkteamArn` 條件金鑰，請使用 [Amazon Resource Name (ARN) 條件運算子](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html#Conditions_ARN)。如果使用者嘗試利用有限的工作團隊來建立標籤工作，SageMaker AI 會傳回存取遭拒錯誤。

下列政策示範如何透過不同方式將 `sagemaker:WorkteamType` 及 `sagemaker:WorkteamArn` 條件金鑰與適當的條件運算子及有效條件值搭配使用。

下列範例將 `sagemaker:WorkteamType` 條件金鑰與 `StringEquals` 條件運算子搭配使用，以限制對公有工作團隊的存取權。它可接受以下格式的條件值：`workforcetype-crowd`，其中 *workforcetype* 可以等於 `public`、`private` 或 `vendor`。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "RestrictWorkteamType",
            "Effect": "Deny",
            "Action": "sagemaker:CreateLabelingJob",
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "sagemaker:WorkteamType": "public-crowd"
                }
            }
        }
    ]
}
```

------

下列政策示範如何使用 `sagemaker:WorkteamArn` 條件金鑰來限制對公有工作團隊的存取權。第一個政策示範如何將其與工作團隊 ARN 的有效 IAM Regex 變體及`ArnLike`條件運算子搭配使用。第二個政策示範如何將其與 `ArnEquals` 條件運算子及工作團隊 ARN 搭配使用。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "RestrictWorkteamType",
            "Effect": "Deny",
            "Action": "sagemaker:CreateLabelingJob",
            "Resource": "*",
            "Condition": {
                "ArnLike": {
                    "sagemaker:WorkteamArn": "arn:aws:sagemaker:*:*:workteam/public-crowd/*"
                }
            }
        }
    ]
}
```

------

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "RestrictWorkteamType",
            "Effect": "Deny",
            "Action": "sagemaker:CreateLabelingJob",
            "Resource": "*",
            "Condition": {
                "ArnEquals": {
                    "sagemaker:WorkteamArn": "arn:aws:sagemaker:us-west-2:394669845002:workteam/public-crowd/default"
                }
            }
        }
    ]
}
```

------