为什么EC2不能用于我的jupyter笔记本?

时间:2017-04-17 03:54:03

标签: amazon-ec2 anaconda jupyter-notebook

我设置了我的EC2,我配置了我的jupyter笔记本配置文件,如:https://chrisalbon.com/jupyter/run_project_jupyter_on_amazon_ec2.html

我现在跑了:jupyter笔记本,这就是我得到的:

[I 03:42:26.400 NotebookApp] Serving notebooks from local directory: /home/ec2-
user/courses/deeplearning1/nbs
[I 03:42:26.400 NotebookApp] 0 active kernels
[I 03:42:26.400 NotebookApp] The Jupyter Notebook is running at: https://[all ip addresses on your 
system]:8888/
[I 03:42:26.400 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to 
skip confirmation).

但是,现在我正在尝试访问我的网站(http://ec2-54-202-213-129.us-west-2.compute.amazonaws.com:8888/),这是我在终端上看到的内容。

 Exception in callback (<socket.socket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('0.0.0.0', 8801)>, <function wrap.<locals>.null_wrapper at 0x7fc3e0210620>)
Traceback (most recent call last):
  File "/home/ec2-user/anaconda3/lib/python3.6/site-packages/tornado/ioloop.py", line 887, in start
    handler_func(fd_obj, events)
  File "/home/ec2-user/anaconda3/lib/python3.6/site-packages/tornado/stack_context.py", line 275, in null_wrapper
    return fn(*args, **kwargs)
  File "/home/ec2-user/anaconda3/lib/python3.6/site-packages/tornado/netutil.py", line 272, in accept_handler
    callback(connection, address)
  File "/home/ec2-user/anaconda3/lib/python3.6/site-packages/tornado/tcpserver.py", line 244, in _handle_connection
    do_handshake_on_connect=False)
  File "/home/ec2-user/anaconda3/lib/python3.6/site-packages/tornado/netutil.py", line 513, in ssl_wrap_socket
    context = ssl_options_to_context(ssl_options)
  File "/home/ec2-user/anaconda3/lib/python3.6/site-packages/tornado/netutil.py", line 490, in ssl_options_to_context
    context.load_cert_chain(ssl_options['certfile'], ssl_options.get('keyfile', None))
IsADirectoryError: [Errno 21] Is a directory

知道我做错了吗?

1 个答案:

答案 0 :(得分:2)

您首先尝试使用https://代替http://?即https://ec2-54-202-213-129.us-west-2.compute.amazonaws.com:8888/

无论如何,我认为您应该遵循官方文档中的建议:http://jupyter-notebook.readthedocs.io/en/latest/public_server.html#using-ssl-for-encrypted-communication

  • 创建证书和密钥:openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mykey.key -out mycert.pem
  • 然后以这种方式启动笔记本:jupyter notebook --certfile=mycert.pem --keyfile mykey.key