在 EC2 实例上运行 jupyter 笔记本

发布于 2025-01-17 08:09:52 字数 315 浏览 0 评论 0原文

我在我的 AWS 账户上设置了一个 cloud 9 实例。我使用诗歌作为我的包管理器并安装了 jupyter 笔记本。

当我运行命令poetry run jupyter notebook时,它会像平常一样运行,但是当我按下链接时,他们说无法访问该网站。

我注意到的一些事情是,在一些 AWS 文档中提到使用端口 8080,我已经尝试过,但它不起作用。

我还看到一些关于 http 与 https 的信息,那么是否会因为链接不是 https 而不会显示?

无论如何,有关如何打开在云 9 实例上运行的笔记本的任何帮助都会非常有帮助,谢谢

I have a cloud 9 instance set up on my AWS account. I am using poetry as my package manager and have installed jupyter notebook.

When I run the command poetry run jupyter notebook it runs as it usually does, but when I press the links they say that the site can't be reached.

Some things I have noticed is that in some AWS documentation there is mention of using port 8080, I have tried that but it doesn't work.

I also see something about http vs https, so could it be that it won't display because the link is not https?

Regardless any help on how to open up a notebook running on the cloud 9 instance would be very helpful, thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瀞厅☆埖开 2025-01-24 08:09:52

如果您想通过 HTTP 访问笔记本:

export PWD="MyPassword" # choose whatever password you want

jupyter notebook --generate-config
echo "conf = get_config()" >> ~/.jupyter/jupyter_notebook_config.py
echo "conf.NotebookApp.ip = '0.0.0.0'" >> ~/.jupyter/jupyter_notebook_config.py
echo "from IPython.lib import passwd" >> ~/.jupyter/jupyter_notebook_config.py
echo "password = passwd('${PWD}')" >> ~/.jupyter/jupyter_notebook_config.py
echo "c.NotebookApp.password = password"  >> ~/.jupyter/jupyter_notebook_config.py
echo "conf.NotebookApp.port = 8888" >> ~/.jupyter/jupyter_notebook_config.py
jupyter notebook

请点击 http://public-ip-address:8888 并使用您指定的密码登录。


如果您想通过 HTTPS(使用自签名证书)访问笔记本:

export PWD="MyPassword" # choose whatever password you want

export DNS=$(curl -s http://169.254.169.254/latest/meta-data/public-hostname)
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /home/ec2-user/mykey.key -out /home/ec2-user/mycert.pem -subj "/C=US/ST=Oregon/L=Portland/O=Company Name/OU=Org/CN=$DNS"
jupyter notebook --generate-config
echo "conf = get_config()" >> ~/.jupyter/jupyter_notebook_config.py
echo "conf.NotebookApp.ip = '0.0.0.0'" >> ~/.jupyter/jupyter_notebook_config.py
echo "from IPython.lib import passwd" >> ~/.jupyter/jupyter_notebook_config.py
echo "password = passwd('${PWD}')" >> ~/.jupyter/jupyter_notebook_config.py
echo "c.NotebookApp.password = password"  >> ~/.jupyter/jupyter_notebook_config.py
echo "conf.NotebookApp.port = 8888" >> ~/.jupyter/jupyter_notebook_config.py
jupyter notebook --certfile=/home/ec2-user/mycert.pem --keyfile /home/ec2-user/mykey.key

然后点击 https://public-ip-address:8888 并使用您指定的密码登录。


无论哪种情况,请确保 EC2 安全组和网络 ACL 中允许端口 8888

If you want to access the notebook over HTTP:

export PWD="MyPassword" # choose whatever password you want

jupyter notebook --generate-config
echo "conf = get_config()" >> ~/.jupyter/jupyter_notebook_config.py
echo "conf.NotebookApp.ip = '0.0.0.0'" >> ~/.jupyter/jupyter_notebook_config.py
echo "from IPython.lib import passwd" >> ~/.jupyter/jupyter_notebook_config.py
echo "password = passwd('${PWD}')" >> ~/.jupyter/jupyter_notebook_config.py
echo "c.NotebookApp.password = password"  >> ~/.jupyter/jupyter_notebook_config.py
echo "conf.NotebookApp.port = 8888" >> ~/.jupyter/jupyter_notebook_config.py
jupyter notebook

then hit http://public-ip-address:8888 and login with the password you specified.


If you want to access the notebook over HTTPS (with a self-signed certificate):

export PWD="MyPassword" # choose whatever password you want

export DNS=$(curl -s http://169.254.169.254/latest/meta-data/public-hostname)
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /home/ec2-user/mykey.key -out /home/ec2-user/mycert.pem -subj "/C=US/ST=Oregon/L=Portland/O=Company Name/OU=Org/CN=$DNS"
jupyter notebook --generate-config
echo "conf = get_config()" >> ~/.jupyter/jupyter_notebook_config.py
echo "conf.NotebookApp.ip = '0.0.0.0'" >> ~/.jupyter/jupyter_notebook_config.py
echo "from IPython.lib import passwd" >> ~/.jupyter/jupyter_notebook_config.py
echo "password = passwd('${PWD}')" >> ~/.jupyter/jupyter_notebook_config.py
echo "c.NotebookApp.password = password"  >> ~/.jupyter/jupyter_notebook_config.py
echo "conf.NotebookApp.port = 8888" >> ~/.jupyter/jupyter_notebook_config.py
jupyter notebook --certfile=/home/ec2-user/mycert.pem --keyfile /home/ec2-user/mykey.key

then hit https://public-ip-address:8888 and login with the password you specified.


In either case, make sure that port 8888 is allowed in the EC2 security group and network ACL.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文