AWS EC2 and Configure Jupyter Notebook


AWS EC2

  1. Launch an EC2 instance on the Amazon Linux machine.
  2. Connect to the instance via SSH

check details:

  • Open a terminal or command prompt on your local machine.
  • Locate your private key file (.pem) that you have created or downloaded when you launched your EC2 instance. Note: If you don’t have a key pair, you can create a new one in the EC2 console.
  • Change the permission of the key pair file using the command:
chmod 400 /path/to/your/key.pem
  • Connect to your EC2 instance using the command:
ssh -i /path/to/your/key.pem ec2-user@your_ec2_instance_public_ip
  1. Update the package list by running the command:

    sudo yum update -y
  2. Install pip and python3 by running the command:

    sudo yum install python3-pip -y
  3. Install Jupyter Notebook by running the command:

    pip3 install jupyter
  4. Generate the Jupyter configuration file by running the command:

    jupyter notebook --generate-config
  5. Set a password for Jupyter Notebook by running the command:

    jupyter notebook password
  6. Create a new SSL certificate by running the command:

    openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mykey.key -out mycert.pem
  7. Start the Jupyter Notebook server by running the command:

    jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser --certfile=mycert.pem --keyfile=mykey.key
  8. Open your web browser and access the Jupyter Notebook by entering the URL https://<your_ec2_instance_public_ip>:8888.

  9. How to add a new key pair to your existing AWS EC2 Instances https://linux.how2shout.com/add-a-new-key-pair-to-your-exisitng-aws-ec2-instances/


Author: Happy
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source Happy !
  TOC