Setting environment vars in a Vertex AI jupyter notebook

43 views Asked by At

This may sound simple, but its giving me a headache. I want to set some environment vars on about 10 Vertex AI Instances for whoever logs on.

I have set a script to do this however it just doesn't seem to work. Script looks something like this

#! /bin/bash

export API_KEY="some value"

It is in a GCS storage bucket and the --post-startup-script is set to that location of the script.

When the notebook starts up, nothing is put into the environment.

I have got this working on normal VMs using the startup-script below to write into /etc/environment however this doesn't work with notebooks.

        cat <<'EOF' >> env.sh
        #! /bin/bash

        testenv='TESTKEY="somevalue"
        TESTKEY2="thisisatestvalue'
        echo "$testenv" > /etc/environment

        EOF

Has anyone got this successfully working ?

I have also tried executing the shell script directly on the box, which just returns a permission denied.

0

There are 0 answers