Skip to content

Instantly share code, notes, and snippets.

@takada-at
Last active March 15, 2021 02:09
Show Gist options
  • Save takada-at/397dc62d9f09eedcd2e8b85355c096d6 to your computer and use it in GitHub Desktop.
Save takada-at/397dc62d9f09eedcd2e8b85355c096d6 to your computer and use it in GitHub Desktop.
#!/bin/bash
CMDNAME=`basename $0`
if [ $# -ne 1 ]; then
echo "Usage: $CMDNAME account" 1>&2
exit 1
fi
ACCOUNT=$1
ZONE=us-west1-b
cat <<EOF
ACCOUNT=${ACCOUNT}
ZONE=${ZONE}
EOF
echo "create service account"
# create service account
gcloud --project pj-kec4 iam service-accounts create ${ACCOUNT}-service-account
SERVICE_ACCOUNT=${ACCOUNT}-service-account@pj-kec4.iam.gserviceaccount.com
echo "create notebook"
# create notebook
gcloud --project pj-kec4 beta notebooks instances create ${ACCOUNT}-instance --location ${ZONE} \
--container-repository gcr.io/deeplearning-platform-release/tf-gpu.1-14 \
--container-tag latest \
--service-account ${SERVICE_ACCOUNT} \
--machine-type n1-standard-8 \
--accelerator-core-count 1 --accelerator-type NVIDIA_TESLA_K80 --install-gpu-driver
gcloud --project pj-kec4 compute instances stop ${ACCOUNT}-instance --zone ${ZONE}
gcloud --project pj-kec4 compute instances update ${ACCOUNT}-instance --zone ${ZONE} --enable-display-device
gcloud --project pj-kec4 compute instances start ${ACCOUNT}-instance --zone ${ZONE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment