Options for the connect command

This page describes the datalab connect command.


datalab connect [-h] [--no-user-checking] [--port PORT]
                [--max-reconnects MAX_RECONNECTS]
                [--connection-health-timeout-seconds CONNECTION_HEALTH_TIMEOUT_SECONDS]
                [--ssh-log-level {quiet,fatal,error,info,verbose,debug,debug1,debug2,debug3}]
                [--no-launch-browser] [--beta-internal-ip]
                [--project PROJECT] [--quiet]
                [--verbosity {debug,info,default,warning,error,critical,none}]
                [--zone ZONE] [--diagnose-me]

datalab connect creates a persistent connection to a Datalab instance running in a Google Compute Engine VM.

This is a thin wrapper around the ssh(1) command that takes care of authentication and the translation of the instance name into an IP address.

This command ensures that the user's public SSH key is present in the project's metadata. If the user does not have a public SSH key, one is generated using ssh-keygen(1) (if the --quiet flag is given, the generated key will have an empty passphrase).

Once the connection is established, this command opens a browser window pointing at Cloud Datalab. To disable the browser opening, add the --no-launch-browser flag.

This command will attempt to re-establish the connection if it gets dropped. However, that connection will only exist while this command is running.



Show a help message and exit


Do not check if the current user matches the Datalab instance

--port PORT

Local port on which Cloud Datalab is accessible

--max-reconnects MAX_RECONNECTS

Maximum number of times to reconnect.

A negative value means no limit.

--connection-health-timeout-seconds CONNECTION_HEALTH_TIMEOUT_SECONDS

Maximum amount of time in seconds, to wait for a connection to become healthy before giving up and retrying.

--ssh-log-level {quiet,fatal,error,info,verbose,debug,debug1,debug2,debug3}

The log level for the SSH command.

This may be useful for debugging issues with an SSH connection.

The default log level is "error".


Do not open a browser connected to Cloud Datalab


Connect to the internal IP address of the instance. This flag must also be used with the datalab create) command.

--project PROJECT

The Google Cloud Platform project name to use for this invocation.

If omitted then the current project is assumed.


Do not issue any interactive prompts

--verbosity {debug,info,default,warning,error,critical,none}

Override the default output verbosity for this command.

--zone ZONE

The zone containing the instance. If not specified, you may be prompted to select a zone.

To avoid prompting when this flag is omitted, you can set the compute/zone property:

$ gcloud config set compute/zone ZONE

A list of zones can be fetched by running:

$ gcloud compute zones list

To unset the property, run:

$ gcloud config unset compute/zone

Alternatively, the zone can be stored in the environment variable CLOUDSDK_COMPUTE_ZONE.


Print additional diagnostics information to help troubleshoot issues.