如何在PyCharm中连接SageMaker Studio Jupyter Notebook?
获取SageMaker Studio Jupyter Notebook的服务器URL及令牌
方法一:从Jupyter配置文件提取
- 打开SageMaker Studio,启动目标Notebook实例,通过顶部菜单栏File→New→Terminal打开终端。
- 执行命令查看Jupyter配置目录:
jupyter --config-dir - 进入该目录,打开
jupyter_notebook_config.json文件(若不存在,执行jupyter notebook --generate-config生成)。 - 从文件中提取两个关键字段:
NotebookApp.base_url:服务器基础路径,需结合SageMaker Studio域名组成完整URLNotebookApp.token:连接所需的令牌
方法二:从Jupyter启动日志提取
- 在SageMaker Studio终端中重启Jupyter服务器:
jupyter notebook --no-browser - 日志中会输出包含令牌的URL,类似:
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=abcdef1234567890abcdef1234567890abcdef1234567890 - 将日志中的
localhost:8888替换为你的SageMaker Studio域名(可从当前Studio浏览器地址栏获取,格式为https://<your-studio-domain>.studio.<region>.sagemaker.aws/),再拼接路径和令牌得到完整连接URL。
方法三:通过AWS SageMaker控制台辅助获取
- 登录AWS控制台进入SageMaker服务,左侧导航栏选择Studio→Domains,进入你的Studio域名页面。
- 在User profiles中选择目标用户,点击Launch app→JupyterServer启动服务。
- 从浏览器地址栏获取Studio域名,再结合方法一或二得到的base_url和令牌,组合成完整连接URL。
内容的提问来源于stack exchange,提问作者Alaa M.
相关产品推荐
相关产品推荐

