Edit on GitHub

Google Cloud Storage

Start with dvc remote add to define the remote. Set a name and a valid Google Cloud Storage URL:

$ dvc remote add -d myremote gs://<mybucket>/<path>

Upon dvc push (or when needed), DVC will try to authenticate using your gcloud CLI authorization. This reads the default GCP key file.

Make sure to run gcloud auth application-default login unless you use a service account or other ways to authenticate (more info).

To use custom auth or further configure your DVC remote, set any supported config param with dvc remote modify.

Cloud versioning

Requires Object versioning enabled on the bucket.

$ dvc remote modify myremote version_aware true

version_aware (true or false) enables cloud versioning features for this remote. This lets you explore the bucket files under the same structure you see in your project directory locally.

Custom authentication

For service accounts (a Google account associated to your GCP project instead of a user), you can set the path to the file that contains a service account key:

$ dvc remote modify --local myremote \
                    credentialpath 'path/to/project-XXX.json'

The dvc remote modify --local flag is needed to write sensitive user info to a Git-ignored config file (.dvc/config.local) so that no secrets are leaked through Git. See dvc config.

Alternatively, the GOOGLE_APPLICATION_CREDENTIALS environment variable can be set:

$ export GOOGLE_APPLICATION_CREDENTIALS='.../project-XXX.json'

More configuration parameters

See dvc remote modify for more command usage details.

  • url - modify the remote location (scroll up for details)

  • projectname - override or provide a project name to use if a default one is not set.

Content

๐Ÿ› Found an issue? Let us know! Or fix it:

Edit on GitHub

โ“ Have a question? Join our chat, we will help you:

Discord Chat