Created
December 25, 2021 03:05
-
-
Save xinzhel/ee18e48596a44edbcdee4c53d6d8eaa1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script to create Azure DSVM Spot instance with NVidia P100 GPU | |
read -p "Azure VM Name (default: dsvm): " vminput | |
vmname=${vminput:=dsvm} | |
while [ $password != $password2 ] ; do | |
read -s -p "Choose your Password: " password | |
echo | |
read -s -p "Re-enter Password: " password2 | |
echo | |
done | |
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 | |
vmzone=${vmzoneinput:=australiaeast} | |
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: https://azure.microsoft.com/en-au/pricing/details/virtual-machines/linux/ | |
# 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 13.75.213.23 --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": ["https://raw.githubusercontent.com/Azure/DataScienceVM/master/Samples/fastai2/installfastai2.sh"],"commandToExecute": "./installfastai2.sh"}' | |
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