簡體   English   中英

在 SageMaker 筆記本實例中打開 jupyter 是否需要 sagemaker:CreatePresignedDomainUrl?

[英]Is sagemaker:CreatePresignedDomainUrl required to open jupyter in SageMaker notebook instance?

我試圖避免使用托管策略AmazonSageMakerReadOnlyAmazonSageMakerFullAccess ,因為我只希望用戶能夠啟動/停止他們自己的筆記本實例並在他們的實例中打開 jupyter。

到目前為止,用戶角色具有以下權限

...
        {
            "Sid": "",
            "Effect": "Allow",
            "Action": [
                "sagemaker:StopNotebookInstance",
                "sagemaker:StartNotebookInstance",
                "sagemaker:CreatePresignedNotebookInstanceUrl"
            ],
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "aws:ResourceTag/OwnerRole": "${aws:userid}"
                }
            }
        },
  

該策略沒有sagemaker:CreatePresignedDomainUrl但它有sagemaker:CreatePresignedNotebookInstanceUrl ,當具有此策略的用戶在 AWS Sagemaker 控制台中單擊Open Jupyter時,它會打開一個 url https://xxxxxx.notebook.eu-north-1.sagemaker.aws/auth?authToken=xxxxx但 url 將返回:

403 Forbidden. Access to xxxxxx.notebook.eu-north-1.sagemaker.aws was denied. You don't have authorisation to view this page. HTTP ERROR 403

一旦我為 resource *添加了sagemaker:CreatePresignedDomainUrl ,403 錯誤就消失了,用戶可以打開 jupyter notebook。

我的問題是為什么需要我應該放什么資源而不是* ,文檔提到arn:aws:sagemaker:regionXXX:account-idXXX:app/domain-id/userProfileNameXXXX/*但我沒有任何域或用戶資料。

CreatePresignedDomainUrl語句允許角色啟動 SageMaker Studio 應用程序(以及domain-id/user-profile ARN)。 打開 SageMaker Notebook 實例不需要預簽名域 url 權限。

您需要確保使用 OwnerRole 鍵標記筆記本,值 = userid(不是用戶名)。 此外,您需要使用sagemaker:ResourceTag (而不是aws:ResourceTag )。

有關操作和條件鍵的完整列表,請參閱服務授權頁面

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM