Skip to content

Instantly share code, notes, and snippets.

Created December 25, 2021 03:05
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save xinzhel/ee18e48596a44edbcdee4c53d6d8eaa1 to your computer and use it in GitHub Desktop.
# Script to create Azure DSVM Spot instance with NVidia P100 GPU
read -p "Azure VM Name (default: dsvm): " vminput
while [ $password != $password2 ] ; do
read -s -p "Choose your Password: " password
read -s -p "Re-enter Password: " password2
echo "The following locations are available: "
az account list-locations --query "[].{DisplayName:displayName, Name:name}" -o table
read -p "Azure VM Zone (default:Australia East): " vmzoneinput
az group create --name $vmname -l $vmzone
echo "Creating Azure Data Science VM $vmname..."
# You can change the size parameter if you want something other than NVidia K80 GPU instance.
# NC series VMs provide GPU (including Tesla K80, V100) for deep learning.
# Here is the link for all available GPU:
# You can find Azure size labels by running Azure CLI command in Cloud Shell "az vm list-sizes -l westus2 -o table"
az vm create --name $vmname -g $vmname --image microsoft-dsvm:ubuntu-1804:1804:latest --priority Spot --size Standard_NC6s_v3 --eviction-policy Deallocate --storage-sku StandardSSD_LRS --os-disk-size-gb 150 --public-ip-address --admin-user xinzhel --admin-password $password
az vm open-port --name $vmname -g $vmname --port 8000
#echo "Installing fastai v2 and notebooks..."
#az vm extension set --resource-group $vmname --vm-name $vmname --name customScript --publisher Microsoft.Azure.Extensions --protected-settings '{"fileUris": [""],"commandToExecute": "./"}'
IP=$(az vm show -d -g ${vmname} --name ${vmname} --query publicIps -o tsv)
echo "You can now login to VM with SSH or use Jupyterhub by visiting https://${IP}:8000/ (Ignore self signed cert warnings)"
echo "Login userid is 'xinzhel' with password you entered above"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment