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

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

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

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

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

  2. 创建应用程序并app-type使用以下命令指定CodeEditor为。

    如果您在创建代码编辑器应用程序时使用 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"

    有关可用代码编辑器镜像 ARN 的更多信息,请参阅代码编辑器应用程序实例和图像

  3. 代码编辑器应用程序投入使用后,使用预签名 URL 启动该应用程序。您可以使用 describe-app API 来检查您的应用程序是否处于运行状态。使用 create-presigned-domain-url API 创建预签名网址:

    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 以开始在您的代码编辑器应用程序中工作。