

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

# 允許使用 Athena 存取機器學習
<a name="machine-learning-iam-access"></a>

必須允許執行 Athena 機器學習 (ML) 查詢的 IAM 主體對其使用的 Sagemaker 端點執行 `sagemaker:invokeEndpoint` 動作。在連接至使用者身分的以身分為基礎的許可政策中，加入類似下列的政策陳述式。此外，請連接 [AWS 受管政策：AmazonAthenaFullAccess](security-iam-awsmanpol.md#amazonathenafullaccess-managed-policy)，以授權完整存取 Athena 動作，或連接已修改的內嵌政策，以允許動作子集。

在範例中，以要在查詢中使用的模型端點的一或多個 ARN，替換 `arn:aws:sagemaker:region:AWSAcctID:ModelEndpoint`。如需詳細資訊，請參閱*服務授權參考*中的 [SageMaker AI 的動作、資源和條件金鑰](https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonsagemaker.html)。

```
{
            "Effect": "Allow",
            "Action": [
                "sagemaker:invokeEndpoint"
            ],
            "Resource": "arn:aws:sagemaker:us-west-2:123456789012:workteam/public-crowd/default"
}
```

每當您使用 IAM 政策時，請務必遵循 IAM 最佳實務。如需詳細資訊，請參閱*《IAM 使用者指南》*中的 [IAM 中的安全性最佳實務](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)。