I have Google Cloud Project with VPN enabled connectivity and Google Cloud SQL (PostgreSQL) database instance with the same VPN connectivity along with SSL enabled. Cloud SQL has both Public and Private IP addresses. Public IP I used for connecting database from external such as PgAdmin client tool and Private IP used for internal connectivity such as Dataflow. Now I want to connect this CloudSQL from Cloud Composer. Used PostgresOperator to connect the Cloud Postgresql database. Created separate connection with Puplic IP as port in under Airflow -> Connections section. Since this CloudSQL has SSL enabled, so pushed the certificates to DAG's GCS location. In the connection under the extra properties section just passed ssl certificates path information as like below,
{
"sslmode": "verify-ca",
"sslcert": "/home/airflow/gcs/dags/certificates/client-cert.pem",
"sslca": "/home/airflow/gcs/dags/certificates/server-ca.pem",
"sslkey": "/home/airflow/gcs/dags/certificates/client-key.pem"
}
Got below error message,
psycopg2.OperationalError: private key file "/home/airflow/gcs/dags/certificates/client-key.pem" has group or world access; permissions should be u=rw (0600) or les
It would be good if some one help me on this issue fix.
postgresoperator = PostgresOperator(
task_id='create_field_reports',
sql=create_field_reports_query,
postgres_conn_id='pgconnection_google_private',
dag=dag
)