

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

# 步驟 6：建立適用於 SageMaker AI 筆記本的 IAM 政策
<a name="create-sagemaker-notebook-policy"></a>

如果您計劃將 SageMaker AI 筆記本與開發端點搭配使用，您必須在建立筆記本時指定許可。您可用 AWS Identity and Access Management (IAM) 來提供這些許可。

**建立適用於 SageMaker AI 筆記本的 IAM 政策**

1. 登入 AWS 管理主控台 ，並在 https：//[https://console.aws.amazon.com/iam/](https://console.aws.amazon.com/iam/) 開啟 IAM 主控台。

1. 在左側導覽窗格中選擇 **Policies** (政策)。

1. 選擇**建立政策**。

1. 在 **Create Policy (建立政策)** 頁面上，導覽至索引標籤，以編輯 JSON。使用以下 JSON 陳述式建立政策文件。編輯您環境的 *bucket-name*、*region-code* 和 *account-id*。

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

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Statement": [
           {
               "Action": [
                   "s3:ListBucket"
               ],
               "Effect": "Allow",
               "Resource": [
                   "arn:aws:s3:::amzn-s3-demo-bucket"
               ]
           },
           {
               "Action": [
                   "s3:GetObject"
               ],
               "Effect": "Allow",
               "Resource": [
                   "arn:aws:s3:::amzn-s3-demo-bucket*"
               ]
           },
           {
               "Action": [
                   "logs:CreateLogStream",
                   "logs:DescribeLogStreams",
                   "logs:PutLogEvents",
                   "logs:CreateLogGroup"
               ],
               "Effect": "Allow",
               "Resource": [
                   "arn:aws:logs:us-east-1:111122223333:log-group:/aws/sagemaker/*",
                   "arn:aws:logs:us-east-1:111122223333:log-group:/aws/sagemaker/*:log-stream:aws-glue-*"
               ]
           },
           {
               "Action": [
                   "glue:UpdateDevEndpoint",
                   "glue:GetDevEndpoint",
                   "glue:GetDevEndpoints"
               ],
               "Effect": "Allow",
               "Resource": [
                   "arn:aws:glue:us-east-1:111122223333:devEndpoint/*"
               ]
           },
           {
               "Action": [
                   "sagemaker:ListTags"
               ],
               "Effect": "Allow",
               "Resource": [
                   "arn:aws:sagemaker:us-east-1:111122223333:notebook-instance/*"
               ]
           }
       ]
   }
   ```

------

   接著選擇 **Review policy** (檢閱政策)。

   下表說明此政策授予的許可。    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/glue/latest/dg/create-sagemaker-notebook-policy.html)

1. 在 **Review Policy** (檢閱政策) 畫面上，輸入 **Policy Name** (政策名稱)，例如 `AWSGlueSageMakerNotebook`。輸入選用的說明，當您對政策滿意時，即可選擇 **Create policy (建立政策)**。