-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.sh
More file actions
68 lines (49 loc) · 1.74 KB
/
Copy pathmain.sh
File metadata and controls
68 lines (49 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
dir="~/build-gcp"
cd $dir
sudo chmod -R 777 $dir
clear
bash ~/build-gcp/configure-instance/executer.sh
clear
bash ~/build-gcp/configure-instance/gcloud.sh
clear
read -p "Which name do you want to give your Google VM Instance? " INSTANCE_NAME
clear
source ~/build-gcp/configure-instance/check-availability.sh
export INSTANCE_TYPE=$INSTANCE_TYPE
export ZONE=$ZONE
clear
source ~/build-gcp/configure-instance/disk-size.sh
export BOOT_DISK_SIZE=$BOOT_DISK_SIZE
clear
printf "\n"
export IMAGE_PROJECT="debian-cloud"
export IMAGE="debian-10-buster-v20210217"
echo "Your Instance Configuration is as below:"
echo " --[1] Instance Name: " $INSTANCE_NAME
echo " --[2] Instance Type: " $INSTANCE_TYPE
echo " --[3] Zone: " $ZONE
echo " --[4] Disk Size: " $BOOT_DISK_SIZE
printf "\n"
source ~/build-gcp/configure-instance/verify-configuration.sh
export INSTANCE_NAME=$INSTANCE_NAME
export INSTANCE_TYPE=$INSTANCE_TYPE
export ZONE=$ZONE
export BOOT_DISK_SIZE=$BOOT_DISK_SIZE
bash ~/build-gcp/configure-instance/build-instance.sh
gcloud auth login
PROJECT=$(gcloud config get-value core/project 2> /dev/null)
printf "\nWaiting for the machine to be raised."
sleep 10
printf "\nPreparing for second step\n"
sudo gcloud compute scp --recurse ~/build-gcp $INSTANCE_NAME:/home --ssh-key-expire-after=10m --project $PROJECT --zone $ZONE
printf "\nSecond step is sent"
sleep 1
printf "\nEstablishing SSH\n"
gcloud compute ssh $INSTANCE_NAME --project $PROJECT --zone $ZONE --command 'bash /home/build-gcp/conda/conda.sh'
echo "Setting default Zones as: " $ZONE
gcloud config set compute/zone $ZONE
echo''
echo "Setup is done. You can simply establish your SSH connection via:
gcloud compute ssh" $INSTANCE_NAME
echo ''