Now Google cloud sdk support python3.9 as well. Lets start.
Without any surprise,use your copy-paste skills to fire following script into your innocent terminal.
pkg install python3 openssh
curl -o sdk.sh sdk.cloud.google.com
chmod +x sdk.sh
./sdk.sh --install-dir=$PREFIX
Previous version with python2
python 2.7 requires because gcloud does't support python 3.9
pkg install python2 openssh
export CLOUDSDK_PYTHON='python2.7'
echo "export CLOUDSDK_PYTHON='python2.7'" >> ~/.bashrc
echo "export PATH=$PATH:$PREFIX/google-cloud-sdk/bin"
curl -o sdk.sh sdk.cloud.google.com
chmod +x sdk.sh
./sdk.sh --install-dir=$PREFIX
gcloud auth login
copy link and paste in your default browser, Choose account and copy code then fill that in terminal. now done. Let's do ssh in cloud shell.
gcloud cloud-shell ssh
Prevent from getting kills the vm after 20 minutes of inactivity by simple ssh config/trick
We are aware of limitations of Google cloudshell.
There are also hidden limitations. Probably more !!!
Among them. Let's deal with first one. First of all understand what does google cs mean by inactivity. In case of cloudshell inactivity means there's no data transfer between client and server. If it persist till 20 minutes, Your VM gets kills. So if you don't want to get kill. keep working on it or do something which transfer some bytes of data to/from server.
Simply put these two lines in ssh config and done. Either in global config (
$PREFIX/etc/ssh/ssh_config
) or user config {~/.ssh/config
)The first lines enable ssh to send some null bytes to server(cloudshell) once per 2 minutes and second lines count how many times have to do. Read about it more in manpages or duck it. Adjust number as per your needs.
Note: These setup may keep your VM alive until you don't kill it manually or gets disconnect as a result your 50 hours quota may waste. Also it don't gonna prevent you from 12 hours limits. VM still gets killed after 12 hours but you can connect again.
Disclaimer: Google collects and keep eyes on your cloudshell activities so don't think of abusing it better use for development purpose. It exist especially for those who use it for development purposes.