使用启动代码编辑器应用程序 Amazon CLI - 亚马逊 SageMaker AI
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

使用启动代码编辑器应用程序 Amazon CLI

要通过 Amazon Command Line Interface (Amazon CLI) 配置和访问您的代码编辑器集成开发环境,必须创建代码编辑器空间。在完成以下步骤之前,请务必满足 满足先决条件。按照以下步骤创建并运行 Code Editor 空间。

创建并运行 Code Editor 空间
  1. 使用 Amazon Identity and Access Management (IAM) 或 Amazon IAM Identity Center 身份验证访问空间。有关使用访问空间的更多信息 Amazon CLI,请参阅使用 Amazon Command Line Interface中的访问空间亚马逊 SageMaker Studio 空间

  2. 创建应用程序,并使用以下命令指定 CodeEditorapp-type

    如果您在创建 Code Editor 应用程序时使用 GPU 实例类型,则还必须使用基于 GPU 的映像。

    aws sagemaker create-app \ --domain-id domain-id \ --space-name space-name \ --app-type CodeEditor \ --app-name default \ --resource-spec "SageMakerImageArn=arn:aws:sagemaker:region:account-id:image/sagemaker-distribution-cpu"

    有关可用代码编辑器图像的更多信息 ARNs,请参见Code Editor 应用程序实例和映像

  3. Code Editor 应用程序启动后,使用预先指定的 URL 启动应用程序。您可以使用 describe-app API 来检查应用程序是否处于服务中。使用 create-presigned-domain-url API 创建预指定的 URL:

    aws sagemaker create-presigned-domain-url \ --domain-id domain-id \ --space-name space-name \ --user-profile-name user-profile-name \ --session-expiration-duration-in-seconds 43200 \ --landing-uri app:CodeEditor:
  4. 打开生成的 URL,开始在 Code Editor 应用程序中工作。