3

Does anyone know of a way to persist configurations done using "gcloud init" commands inside cloudshell, so they don't vanish each time you disconnect?

I figured out how to persist python pip installs using the --user

example: pip install --user pandas

But, when I create a new configuration using gcloud init, use it for a bit, close cloudshell (or cloudshell times out on me), then reconnect later, the configurations are gone.

Not a big deal, I bounce between projects/etc so it's nice to have the configs saved so I can simply run gcloud config configurations activate config-name

Thanks...Rich Murnane

Rich Murnane
  • 2,697
  • 1
  • 11
  • 23

2 Answers2

4

Google Cloud Shell only persists data in your $HOME directory. Commands like gcloud init modify the environment variables and store configuration files in /tmp which is deleted when the VM is restarted. The VM is terminated after being idle for 20 minutes or 60 minutes depending on which document you read.

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.

You can also store your files and configuration scripts on Google Cloud Storage. Modify .bashrc to download your cloud files and run your configuration script.

Either method will allow you to create a persistent environment.

This StackOverflow answer covers in detail what gcloud init does and how to basically emulate the same thing via script or command line.

gcloud init details

John Hanley
  • 74,467
  • 6
  • 95
  • 159
0

this isn't exactly what I wanted, but since my account (userid) isn't changing, I'm simply going to do the command gcloud config set project second-project-name

good enough, thanks...Rich

Rich Murnane
  • 2,697
  • 1
  • 11
  • 23