GCS Connection Testing
In order to test connection to a Google Storage (GCS) bucket you need to execute
connect test gcs
followed by one mandatory parameter:
--bucket
then the GCS bucket name
Depending on the type of authentication you need to either use --auth-json
for key based authentication
or use the service account assigned to the instance (if the server is running on GCP).
Authentication with auth JSON
Section titled “Authentication with auth JSON”To use JSON key for the authentication you need to provide:
--auth-json
then the path to the file containing the auth JSON
For example:
$ connect test gcs --auth-json /path/to/key-file.json --bucket my-gcs-bucket2025/05/22 08:42:12 INFO Testing connection to gcs://my-gcs-bucket/2025/05/22 08:42:13 INFO Connection successful
Application Default Credentials (ADC)
Section titled “Application Default Credentials (ADC)”To authenticate with Application Default Credentials (ADC) you need to
set GOOGLE_APPLICATION_CREDENTIALS
environment variable that points to the key file.
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/key-file.json"
Then you can omit providing the key file as it will be obtained from the environment variable. For example:
$ connect test gcs --bucket my-gcs-bucket2025/05/22 08:44:11 INFO Testing connection to gcs://my-gcs-bucket/2025/05/22 08:44:12 INFO Connection successful
For user credentials, ADC can be set by running Following
$ gcloud auth application-default login
Once authenticated you can connect without specifying the JSON key.
$ connect test gcs --bucket my-gcs-bucket2025/05/22 08:45:00 INFO Testing connection to gcs://my-gcs-bucket/2025/05/22 08:45:01 INFO Connection successful
All GCS Connection Test Options
Section titled “All GCS Connection Test Options”Usage: connect test gcs [command] [flags]
Flags: --auth-json string GCS authentication json file --bucket string GCS bucket
Global Flags: --godebug Turns on debug mode --help Prints help for the command --log-format string Log output format: text|json (default "text") --no-color Do not use colors in logs --quiet Makes no output
Errors
Section titled “Errors”Please check here for information on the possible errors.