airflow.providers.google.cloud.hooks.compute_ssh

Module Contents

Classes

ComputeEngineSSHHook

Hook to connect to a remote instance in compute engine.

Attributes

CMD_TIMEOUT

airflow.providers.google.cloud.hooks.compute_ssh.CMD_TIMEOUT = 10[source]
class airflow.providers.google.cloud.hooks.compute_ssh.ComputeEngineSSHHook(gcp_conn_id='google_cloud_default', instance_name=None, zone=None, user='root', project_id=None, hostname=None, use_internal_ip=False, use_iap_tunnel=False, use_oslogin=True, expire_time=300, cmd_timeout=NOTSET, max_retries=10, impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.ssh.hooks.ssh.SSHHook

Hook to connect to a remote instance in compute engine.

Parameters
  • instance_name (str | None) – The name of the Compute Engine instance

  • zone (str | None) – The zone of the Compute Engine instance

  • user (str | None) – The name of the user on which the login attempt will be made

  • project_id (str | None) – The project ID of the remote instance

  • gcp_conn_id (str) – The connection id to use when fetching connection info

  • hostname (str | None) – The hostname of the target instance. If it is not passed, it will be detected automatically.

  • use_iap_tunnel (bool) – Whether to connect through IAP tunnel

  • use_internal_ip (bool) – Whether to connect using internal IP

  • use_oslogin (bool) – Whether to manage keys using OsLogin API. If false, keys are managed using instance metadata

  • expire_time (int) – The maximum amount of time in seconds before the private key expires

  • gcp_conn_id – The connection id to use when fetching connection information

  • max_retries (int) – Maximum number of retries the process will try to establish connection to instance. Could be decreased/increased by user based on the amount of parallel SSH connections to the instance.

  • impersonation_chain (str | None) – Optional. The service account email to impersonate using short-term credentials. The provided service account must grant the originating account the Service Account Token Creator IAM role and have the sufficient rights to perform the request

conn_name_attr = 'gcp_conn_id'[source]
default_conn_name = 'google_cloud_ssh_default'[source]
conn_type = 'gcpssh'[source]
hook_name = 'Google Cloud SSH'[source]
classmethod get_ui_field_behaviour()[source]

Return custom UI field behaviour for SSH connection.

get_conn()[source]

Return SSH connection.

Was this entry helpful?