command-linegoogle-cloud-bigtablegoogle-cloud-shell

Cloud Shell, I should install CBT each time I open cloud shell the day after


To use any GCloud component, I have installed on Cloud Shell just once, and I could use it each time I open cloud shell. But for CBT component for BigTable, I don't know what is happening that each time I close the browser the CBT tool is not installed any more and I have to re-install it. The problem does not appear immediately, generally each day I have to install it and it exist between installed components for the whole day, and the day after I see it is not installed any more!

Any idea?


Solution

  • This problem is caused by Google terminating idle Cloud Shell instances when they are not being used. Termination happens after about 60 minutes of non-use.

    Only data stored in the $HOME directory persists after a new Cloud Shell is launched.

    To install cbt the following steps are recommended:

    gcloud components update
    gcloud components install cbt
    

    Since these components are not being installed in $HOME, they do not persist after Cloud Shell is terminated.

    There are two methods that I recommend to solve this problem:

    1. Google Cloud Shell is a Docker container. You can modify the docker image to customize to fit your needs. This method will allow you to install packages, tools, etc that are not located in your $HOME directory.
    2. Modify .bashrc to run a script located in the $HOME directory to install cbt each time a new instance is created.

    Note: It appears as of now that cbt is included in the default Cloud Shell instance. This answer should help others understand what is happening and be able to install other programs, tools, etc. persistently.