Get Hands-on with Amazon EKS - Workshop Event Series
Whether you're taking your first steps with Kubernetes or you're an experienced practitioner looking to sharpen your skills, our Amazon EKS workshop series delivers practical, real-world experience that moves you forward. Learn directly from AWS solutions architects and EKS specialists through hands-on sessions designed to build your confidence with Kubernetes. Register now and start building with Amazon EKS!
如何對 Sagemaker AI 排程筆記本作業出現的問題進行疑難排解?
我想對 Amazon SageMaker AI 排程筆記本作業出現的問題進行疑難排解。
解決方法
您的筆記本作業未在排程時間內執行
排程筆記本作業使用 Amazon EventBridge 和 SageMaker AI 訓練和管道服務。如果您的筆記本未在排程時間內執行,則您的 AWS Identity and Access Management (IAM) 角色可能沒有所需的權限。
您用於建立和排程筆記本作業的 IAM 角色是 SageMaker AI Studio 網域角色,或附加到網域中單一使用者設定檔的角色。
若要授予管理排程筆記本作業的 Amazon CloudWatch 事件的權限,請將下列政策新增至排程筆記本作業:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "events:TagResource", "events:DeleteRule", "events:PutTargets", "events:DescribeRule", "events:PutRule", "events:RemoveTargets", "events:DisableRule", "events:EnableRule" ], "Resource": "*", "Condition": { "StringEquals": { "aws:ResourceTag/sagemaker:is-scheduling-notebook-job": "true" } } }, { "Sid": "VisualEditor1", "Effect": "Allow", "Action": "iam:PassRole", "Resource": "arn:aws:iam::*:role/*", "Condition": { "StringLike": { "iam:PassedToService": "events.amazonaws.com" } } }, { "Sid": "VisualEditor2", "Effect": "Allow", "Action": "sagemaker:ListTags", "Resource": "arn:aws:sagemaker:*:*:user-profile/*/*" } ] }
**注意:**上述政策允許在使用者設定檔上列出標籤,以識別標記為排程作業的筆記本。
嘗試建立排程筆記本作業時,「建立」按鈕顯示為灰色
如果在建立筆記本作業時,建立按鈕顯示為灰色,且其他選項參數顯示 !,則擷取 HAR 檔案。查看問題發生時的網路擷取內容,以找出問題原因。檢查是否有 Amazon Virtual Private Cloud (Amazon VPC) 設定錯誤或執行時期角色權限問題。
如果您使用 Amazon VPC 執行筆記本作業,請確保您擁有以下 Amazon VPC 端點:
- SageMaker AI: 若要連線到 SageMaker AI,請參閱透過 Amazon VPC 介面端點連線到 SageMaker AI。
- Amazon Simple Storage Service (Amazon S3): 若要連線到 Amazon S3,請參閱 Amazon S3 的閘道端點。
- Amazon Elastic Compute Cloud (Amazon EC2): 若要連線至 Amazon EC2,請參閱使用介面 VPC 端點存取 Amazon EC2。
- EventBridge: 僅在設定排程筆記本時使用 EventBridge 端點。若要連線到 EventBridge,請參閱將 Amazon EventBridge 與介面 Amazon VPC 端點結合使用。
指定至少一個私有子網路和安全群組。如果您未使用私有子網路,請使用其他組態選項。如需詳細資訊,請參閱使用 VPC 專用模式的要求。
如果您設定了上述端點或未使用 Amazon VPC 來執行筆記本作業,請設定 IAM 權限和執行時期角色權限。
若要設定 IAM 權限,請完成下列步驟:
- 開啟 IAM console (IAM 主控台)。
- 在導覽窗格中,選擇 Users (使用者)。
- 選取與筆記本作業相關的 IAM 使用者。
- 在下拉式功能表中,選擇 Add Permissions (新增權限),然後選擇 Create inline policy (建立內嵌政策)。
- 選擇 JSON 索引標籤,然後新增以下政策:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "EventBridgeSchedule", "Effect": "Allow", "Action": [ "events:TagResource", "events:DeleteRule", "events:PutTargets", "events:DescribeRule", "events:EnableRule", "events:PutRule", "events:RemoveTargets", "events:DisableRule" ], "Resource": "*", "Condition": { "StringEquals": { "aws:ResourceTag/sagemaker:is-scheduling-notebook-job": "true" } } }, { "Sid": "IAMPassrole", "Effect": "Allow", "Action": "iam:PassRole", "Resource": "arn:aws:iam::*:role/*", "Condition": { "StringLike": { "iam:PassedToService": [ "sagemaker.amazonaws.com", "events.amazonaws.com" ] } } }, { "Sid": "IAMListRoles", "Effect": "Allow", "Action": "iam:ListRoles", "Resource": "*" }, { "Sid": "S3ArtifactsAccess", "Effect": "Allow", "Action": [ "s3:PutEncryptionConfiguration", "s3:CreateBucket", "s3:PutBucketVersioning", "s3:ListBucket", "s3:PutObject", "s3:GetObject", "s3:GetEncryptionConfiguration", "s3:DeleteObject", "s3:GetBucketLocation" ], "Resource": [ "arn:aws:s3:::sagemaker-automated-execution-*" ] }, { "Sid": "S3DriverAccess", "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:GetObject", "s3:GetBucketLocation" ], "Resource": [ "arn:aws:s3:::sagemakerheadlessexecution-*" ] }, { "Sid": "SagemakerJobs", "Effect": "Allow", "Action": [ "sagemaker:DescribeTrainingJob", "sagemaker:StopTrainingJob", "sagemaker:DescribePipeline", "sagemaker:CreateTrainingJob", "sagemaker:DeletePipeline", "sagemaker:CreatePipeline" ], "Resource": "*", "Condition": { "StringEquals": { "aws:ResourceTag/sagemaker:is-scheduling-notebook-job": "true" } } }, { "Sid": "AllowSearch", "Effect": "Allow", "Action": "sagemaker:Search", "Resource": "*" }, { "Sid": "SagemakerTags", "Effect": "Allow", "Action": [ "sagemaker:ListTags", "sagemaker:AddTags" ], "Resource": [ "arn:aws:sagemaker:*:*:pipeline/*", "arn:aws:sagemaker:*:*:space/*", "arn:aws:sagemaker:*:*:training-job/*", "arn:aws:sagemaker:*:*:user-profile/*" ] }, { "Sid": "ECRImage", "Effect": "Allow", "Action": [ "ecr:GetAuthorizationToken", "ecr:BatchGetImage" ], "Resource": "*" } ] }
若要設定執行時期角色權限,請完成下列步驟:
- 開啟 IAM console (IAM 主控台)。
- 在導覽窗格中,選擇 Roles (角色)。
- 選取與筆記本作業相關的作業執行時期角色。
- 選擇 Trust relationships (信任關係) 索引標籤。
- 選擇 Edit trust policy (編輯信任政策),然後新增以下政策:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "sagemaker.amazonaws.com", "events.amazonaws.com" ] }, "Action": "sts:AssumeRole" } ] }
若要新增存取資源的權限,請完成以下步驟:
-
開啟 IAM console (IAM 主控台)。
-
在左側導覽窗格中,選擇 Roles (角色)。
-
選取與筆記本作業相關的作業執行時期角色。
-
在下拉式功能表中,選擇 Add Permissions (新增權限),然後選擇 Create inline policy (建立內嵌政策)。
-
選擇 JSON 索引標籤,然後新增以下政策:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "PassroleForJobCreation", "Effect": "Allow", "Action": "iam:PassRole", "Resource": "arn:aws:iam::*:role/*", "Condition": { "StringLike": { "iam:PassedToService": "sagemaker.amazonaws.com" } } }, { "Sid": "S3ForStoringArtifacts", "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:ListBucket", "s3:GetBucketLocation" ], "Resource": "arn:aws:s3:::sagemaker-automated-execution-*" }, { "Sid": "S3DriverAccess", "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:GetObject", "s3:GetBucketLocation" ], "Resource": [ "arn:aws:s3:::sagemakerheadlessexecution-*" ] }, { "Sid": "SagemakerJobs", "Effect": "Allow", "Action": [ "sagemaker:StartPipelineExecution", "sagemaker:CreateTrainingJob" ], "Resource": "*" }, { "Sid": "ECRImage", "Effect": "Allow", "Action": [ "ecr:GetDownloadUrlForLayer", "ecr:BatchGetImage", "ecr:GetAuthorizationToken", "ecr:BatchCheckLayerAvailability" ], "Resource": "*" } ] }**注意:**在上述政策中,您可以新增筆記本作業必須有權存取的其他資源權限。
-
選擇 Review policy (檢閱政策)。然後,輸入您的政策名稱。
-
選擇 Create policy (建立政策)。
您收到 "Unable to find metadata for image" (無法找到映像檔中繼資料) 錯誤訊息
您收到 "Unable to find metadata for image arn in region: example-region" (無法在區域:example-region 中找到映像檔 arn 的中繼資料) 錯誤訊息。
當您在建立筆記本作業時未關聯或選取使用者的映像檔,就會發生上述錯誤。當您嘗試將使用者的映像檔附加到筆記本作業時,也會發生此錯誤。
若要解決此問題,請稍後重新排程筆記本作業。如果仍然發生錯誤,請聯絡 AWS Support。
相關資訊
- 語言
- 中文 (繁體)

相關內容
- 已提問 2 年前
- 已提問 1 年前