AWS EC2 시작 템플릿의 사용자 데이터를 사용하여 Pytorch용 jupyter notebook 자동 시작 설정
소개
EC2 시작 템플릿에 스크립트를 작성하면 인스턴스를 만들 때 스크립트가 자동으로 실행됩니다. Deep Learning AMI (Ubuntu 18.04) Version 34.0 - ami-0302aadfa73a0d917를 사용하여 딥 러닝을 수행할 수 있는 jupyter notebook을 자동으로 시작하도록 설정합니다.
절차
시작 템플릿 설정 화면을 엽니다.

起動テンプレートを作成를 선택합니다. 高度な詳細를 엽니다.

ユーザーデータ에 다음 스크립트를 붙여넣습니다.

#!/bin/bash
# write conf
cat << EOF > /home/ubuntu/.jupyter/jupyter_notebook_config.py
c = get_config()
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8080
c.NotebookApp.token = ''
EOF
chown ubuntu:ubuntu /home/ubuntu/.jupyter/jupyter_notebook_config.py
# set auto start
echo "/home/ubuntu/anaconda3/envs/pytorch_p36/bin/jupyter-notebook" > /home/ubuntu/start_jupyter.sh
chmod 755 /home/ubuntu/start_jupyter.sh
chown ubuntu:ubuntu /home/ubuntu/start_jupyter.sh
bash -c 'cat > /etc/rc.local' << EOF
#!/bin/sh
# DLAMI Configurations
/opt/dlami/start/dlami_start
# jupyter
su - ubuntu /home/ubuntu/start_jupyter.sh &
exit 0
EOF
# reboot
shutdown -r now
설정의 의미는 Jupyter 일 시작을 읽으면 알 수 있다고 생각합니다.
사용자 데이터 실행 로그는 /var/log/cloud-init-output.log로 출력됩니다.
Deep Learning AMI (Ubuntu 18.04) Version 34.0 - ami-0302aadfa73a0d917를 전제로 하고 있으므로, AMI를 바꾸어 OS나 anaconda 환경이 바뀌면 수정이 필요하게 됩니다.
Reference
이 문제에 관하여(AWS EC2 시작 템플릿의 사용자 데이터를 사용하여 Pytorch용 jupyter notebook 자동 시작 설정), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/ground0state/items/09c43976b14ecef83d2a
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
시작 템플릿 설정 화면을 엽니다.

起動テンプレートを作成를 선택합니다. 高度な詳細를 엽니다.
ユーザーデータ에 다음 스크립트를 붙여넣습니다.
#!/bin/bash
# write conf
cat << EOF > /home/ubuntu/.jupyter/jupyter_notebook_config.py
c = get_config()
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8080
c.NotebookApp.token = ''
EOF
chown ubuntu:ubuntu /home/ubuntu/.jupyter/jupyter_notebook_config.py
# set auto start
echo "/home/ubuntu/anaconda3/envs/pytorch_p36/bin/jupyter-notebook" > /home/ubuntu/start_jupyter.sh
chmod 755 /home/ubuntu/start_jupyter.sh
chown ubuntu:ubuntu /home/ubuntu/start_jupyter.sh
bash -c 'cat > /etc/rc.local' << EOF
#!/bin/sh
# DLAMI Configurations
/opt/dlami/start/dlami_start
# jupyter
su - ubuntu /home/ubuntu/start_jupyter.sh &
exit 0
EOF
# reboot
shutdown -r now
설정의 의미는 Jupyter 일 시작을 읽으면 알 수 있다고 생각합니다.
사용자 데이터 실행 로그는
/var/log/cloud-init-output.log로 출력됩니다.Deep Learning AMI (Ubuntu 18.04) Version 34.0 - ami-0302aadfa73a0d917를 전제로 하고 있으므로, AMI를 바꾸어 OS나 anaconda 환경이 바뀌면 수정이 필요하게 됩니다.
Reference
이 문제에 관하여(AWS EC2 시작 템플릿의 사용자 데이터를 사용하여 Pytorch용 jupyter notebook 자동 시작 설정), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/ground0state/items/09c43976b14ecef83d2a텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)