简体   繁体   中英

Failed to Make a Connection from Airflow to Google Cloud

I want to make a connection from Airflow to Google Cloud. I have made a service account in Google Cloud, downloaded the JSON file, and saved the JSON file inside the docker.

I am following this https://cloud.google.com/composer/docs/how-to/managing/connections documentation, but it returns the following error:

HTTPSConnectionPool(host='oauth2.googleapis.com', port=443): Max retries exceeded with url: /token (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f765dfbeb10>: Failed to establish a new connection: [Errno 113] No route to host')) 在此处输入图像描述

Am I doing something wrong or is there an update on the documentation?

Nb:

  1. I use Apache Airflow 2.4.2
  2. I already tested the service account JSON file and it works perfectly to upload data using Python

You can create a connection to Google Cloud from Airflow webserver admin menu. In this menu you can pass the Service Account key file path.

在此处输入图像描述

In this picture, the keyfile Path is /usr/local/airflow/dags/gcp.json .

Beforehand you need to mount your key file as a volume in your Docker container with the previous path.

You can also directly copy the key json content in the Airflow connection, in the keyfile Json field:

在此处输入图像描述

You can check from these following links:

Airflow-connections

Airflow-with-google-cloud

Airflow-composer-managing-connections

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM