スキップしてコンテンツを表示

SageMaker AI ノートブックインスタンスまたは SageMaker Studio ドメインで署名付き URL を起動する際、エラーが発生する理由を知りたいです。

所要時間2分
0

Amazon SageMaker AI ノートブックインスタンスまたは Amazon SageMaker Studio ドメインで署名付き URL を起動したいのですが、エラーが発生します。

解決策

注: AWS コマンドラインインターフェイス (AWS CLI) コマンドの実行中にエラーが発生した場合は、「AWS CLI で発生したエラーのトラブルシューティング」を参照してください。また、AWS CLI の最新バージョンを使用していることを確認してください。

SageMaker AI ノートブックインスタンスまたは SageMaker Studio ドメインで署名付き URL を起動する際、次のエラーメッセージが表示される場合があります。

  • 「Invalid or Expired Auth Token.Request a new presigned URL to continue using SageMaker」 (SageMaker を引き続き使用するには、新しい署名付き URL をリクエストしてください)
  • 「User: arn:aws:sts::account id:assumed-role/IAM role/IAM user is not authorized to perform: sagemaker:CreatePresignedNotebookInstanceUrl on resource: arn:aws:sagemaker:Region:account id:notebook-instance/notebook instance because no identity-based policy allows the sagemaker:CreatePresignedNotebookInstanceUrl action」
  • 「User: arn:aws:sts::account id:assumed-role/IAM role/SageMaker is not authorized to perform: sagemaker:CreatePresignedDomainUrl on resource: arn:aws:sagemaker:Region:account id:user-profile/domain id/user profile name because no identity-based policy allows the sagemaker:CreatePresignedDomainUrl action」

これらの問題をトラブルシューティングするには、表示されたエラーメッセージに応じた対応策を実施します。

「Invalid or Expired Auth Token」エラー

CreatePresignedNotebookInstanceUrl または CreatePresignedDomainUrl において、SessionExpirationDurationInSeconds パラメータが最大期間である 12 時間を超えた場合に Invalid or Expired Auth Token エラーが発生します。この問題を解決するには、ウェブブラウザから Cookie とセッションデータを消去します。次に、SageMaker AI コンソール、AWS CLI、または Python SDK を使用して新しい署名付き URL を生成します。

SageMaker AI ノートブックインスタンス

コンソールを使用する場合は、次の手順を実行します。

  1. SageMaker AI コンソールを開きます。
  2. ナビゲーションペインの [アプリケーションとIDE][ノートブック] を選択します。
  3. 該当するノートブックインスタンスを選択します。
  4. [Jupiter を開く] または [JupyterLab を開く] を選択します。

AWS CLI を使用する場合は、create-presigned-notebook-instance-url コマンドを実行します。

aws sagemaker create-presigned-notebook-instance-url --notebook-instance-name example-notebook-instance-name --session-expiration-duration-in-seconds example-session-expiration-duration

注: example-notebook-instance-name および example-session-expiration-duration を実際の値に置き換えます。

Python SDK Boto3 を使用する場合は、create-presigned-notebook-instance-url コマンドを実行します。

import boto3

client = boto3.client('sagemaker')

response = client.create_presigned_notebook_instance_url(
    NotebookInstanceName=example-notebook-name,
    SessionExpirationDurationInSeconds=example-session-expiration-duration
)

注: example-notebook-name および example-session-expiration-duration を実際の値に置き換えます。

AWS CLI または Python SDK が生成する署名付き URL は、5 分間のみ有効です。5 分経過した後は、新しい署名付き URL を生成する必要があります。

SageMaker Studio ドメイン

コンソールを使用する場合は、次の手順を実行します。

  1. SageMaker AI コンソールを開きます。
  2. ナビゲーションペインの [管理者設定][ドメイン] を選択します。
  3. 該当するドメインを選択します。
  4. [ユーザープロファイル] を選択し、該当するユーザープロファイル名を選択します。
  5. [起動] を選択し、[Studio] を選択します。

AWS CLI を使用する場合は、create-presigned-domain-url コマンドを実行します。

aws sagemaker create-presigned-domain-url --domain-id example-domain-id --user-profile-name example-user-profile-name --session-expiration-duration-in-seconds example-session-expiration-duration

注: example-domain-idexample-user-profile-nameexample-session-expiration-duration を実際の値に置き換えます。

Python SDK Boto3 を使用する場合は、create-presigned-domain-url コマンドを実行します。

import boto3

client = boto3.client('sagemaker')

response = client.create_presigned_domain_url(
    DomainId=example-domain-id,
    UserProfileName=example-user-profile-name,
    SessionExpirationDurationInSeconds=example-session-expiration-duration,
)

注: example-domain-idexample-user-profile-nameexample-session-expiration-duration を実際の値に置き換えます。

AWS CLI または Python SDK が生成する署名付き URL は、5 分間のみ有効です。5 分経過した後は、新しい署名付き URL を生成する必要があります。

「Not authorized to perform」エラー

SageMaker AI ノートブックまたは SageMaker Studio ドメインを起動するには、AWS Identity and Access Management (IAM) ロールには署名付き URL を作成するためのアクセス許可が必要です。

SageMaker AI ノートブックインスタンスでは、IAM ロールの ID ベースのポリシーに sagemaker:CreatePresignedNotebookInstanceUrl アクションを追加します。SageMaker Studio ドメインでは、sagemaker:CreatePresignedDomainUrl アクションを IAM ポリシーに追加します。

関連情報

Amazon 仮想プライベートクラウド (Amazon VPC) のインターフェイスエンドポイント経由でノートブックインスタンスに接続する

AWS公式更新しました 1年前
コメントはありません

関連するコンテンツ