小编Tim*_*ila的帖子

如何从 VS Code 连接 SageMaker notebook?

我正在使用 SageMaker 来测试 ML 方法。我想将我的 SageMaker 脚本重构为更适合生产的代码。因此,我想像以前一样使用 VS Code 重构代码并在 SageMaker 实例上运行代码。VS Code Python 让你定义:

Python:指定 Jupyter 服务器 URI

SageMaker 通过运行为您提供 AuthorizedUrl

aws sagemaker create-presigned-notebook-instance-url --notebook-instance-name your-instance-name

当我在隐身浏览器中打开它时 AuthorizedUrl 工作。为什么它不适用于 VS Code?VS Code 询问密码。我在没有帮助的情况下尝试了多种方法:

  1. 空密码,因为它在 SageMaker 的 jupyter_notebook_config.py 中为空
  2. 令牌作为密码 [1]
  3. 我设置了一个密码“jupyter notebook password”并重新启动了jupyter“sudo initctl restart jupyter-server --no-wait”。新密码似乎有效。我为 VS Code 提供了新创建的密码,但结果同样糟糕。

VS Code 给了我这个错误:

无法连接到远程 Jupyter 笔记本。检查 Jupyter 服务器 URI 设置是否指定了有效的运行服务器...错误:无法连接到受密码保护的服务器。检查密码是否正确。

那么如何在 SageMaker 上的 VS Code 中运行代码?也许有比我正在尝试的更好的方法?

谢谢

[1] https://jupyter-notebook.readthedocs.io/en/stable/security.html

amazon-web-services visual-studio-code

7
推荐指数
1
解决办法
2544
查看次数