Open main menu

Changes

Run relax at Google Cloud Computing

1,343 bytes removed, 22:34, 28 November 2015
This will start a browser to authenticate you. When it ask for a ID, just write "test" and say no to cloning.
Then go to:=== ssh-config with gcloud ===* See https://console.developerscloud.google.com/sdk/gcloud/reference/compute* In the line of relax, click SSH, and drop down to: '''View gcloud command'''./config-ssh
It could look like this. Try this in your own terminal. This should make some SSH keys and bring you to the server<source lang="bash">gcloud compute config--project "relax-1" ssh --zone "us-central1-f" "relax"<makes SSHing to virtual machine instances easier by adding an alias for each instance to the user SSH configuration (~/.ssh/source>config) file.
This should bring you to the google server.
<source lang="bash">
lscpu
cat $HOME/.ssh/authorized_keys
exit
 
# At your own computer
ls -l $HOME/.ssh/google*
cat $HOME/.ssh/config
ssh-add -l
ssh-add $HOME/.ssh/google_compute_engine
ssh-add -l
</source>
 
=== Copy files ===
See: https://cloud.google.com/sdk/gcloud/reference/compute/copy-files
 
The ssh command was
<source lang="bash">
bash
PROJ=relax-1
ZONE=us-central1-f
PRID=relax
GCC=gcc
gcloud compute --project $PROJ ssh --zone $ZONE $PRID
exit
</source>
 
We make a test file on our local conouter and copy it
<source lang="bash">
touch test.txt
gcloud compute --project $PROJ copy-files test.txt $PRID:~ --zone $ZONE
 
# Try a directory
mkdir testdir
cp test.txt testdir
gcloud compute --project $PROJ copy-files testdir $PRID:~ --zone $ZONE
 
# Back again
cd testdir
gcloud compute --project $PROJ copy-files $PRID:~/testdir . --zone $ZONE
</source>
 
=== ssh-config with gcloud ===
See https://cloud.google.com/sdk/gcloud/reference/compute/config-ssh
 
gcloud compute config-ssh makes SSHing to virtual machine instances easier by adding an alias for each instance to the user SSH configuration (~/.ssh/config) file.
 
<source lang="bash">
gcloud compute --project $PROJ config-ssh
cat $HOME/.ssh/config
 
# ssh in
ssh $PRID.$ZONE.$PROJ
exit
# Use sed to change value of your local computes ssh config file
grep "$PRID.$ZONE.$PROJ" $HOME/.ssh/config
sed "s/$PRID.$ZONE.$PROJ/$GCC/g" $HOME/.ssh/config
sed -i.bak "s/$PRID.$ZONE.$PROJ/$GCC/g" $HOME/.ssh/config
ls -l $HOME/.ssh/config*