Skip to content
This repository was archived by the owner on Dec 12, 2025. It is now read-only.

Commit

Permalink
Create local ssh file the same as other platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiddelkoop committed Dec 13, 2021
1 parent 628fa4f commit 03e0abb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion content/GCP/02_intro_to_compute.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"tags": []
},
"source": [
"## Follow the Storage Allocation\n",
"## Follow the VM Allocation\n",
"\n",
"Just as with security, we will audit (follow) the *VM instance* creation by examining at the project *activity*.\n",
"\n",
Expand Down
18 changes: 16 additions & 2 deletions scripts/gcp-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,24 @@ REPO="git@${GITHUB}:CLASS/${PROJECT}.git"

echo "=== gcp-dev.sh $PROJECT $BRANCH"

echo "+++ creating VM"
gcloud compute instances create --zone=$ZONE $VM --machine-type=e2-highcpu-4 --preemptible
echo "+++ creating/starting VM"
gcloud compute instances create --zone=$ZONE $VM \
--scopes=cloud-platform \
--machine-type=e2-highcpu-4 --preemptible
gcloud compute instances start $VM
IP=$(gcloud compute instances describe essentials --format='value(networkInterfaces.accessConfigs[0].natIP)')

echo "+++ configure local ssh $IP"
gcloud compute config-ssh
ssh-keygen -R $IP
cat > ~/.ssh/$VM.config <<EOF
Host essentials
HostName $IP
CheckHostIP=no
ForwardAgent=yes
User=$NAME
EOF

echo "+++ wait for boot $IP"
while ! gcloud compute ssh --zone=$ZONE $NAME@$VM --command='hostname' ; do
sleep 1
Expand Down

0 comments on commit 03e0abb

Please sign in to comment.