This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: cloud-sql-to-bq | |
labels: | |
name: cloud-sql-to-bq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
run: cloud-sql-proxy | |
name: cloud-sql-proxy | |
namespace: cloud-sql-to-bq | |
spec: | |
replicas: 1 | |
selector: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kind: Service | |
apiVersion: v1 | |
metadata: | |
labels: | |
run: cloud-sql-proxy-service | |
name: cloud-sql-proxy-service | |
namespace: cloud-sql-to-bq | |
spec: | |
ports: | |
- port: 3306 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from airflow import DAG | |
from datetime import datetime | |
from airflow.contrib.operators.mysql_to_gcs import MySqlToGoogleCloudStorageOperator | |
from airflow.contrib.operators.gcs_to_bq import GoogleCloudStorageToBigQueryOperator | |
from airflow.contrib.operators.bigquery_operator import BigQueryOperator | |
CLOUD_SQL_INSTANCE = 'mysql-instance-prod-v1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcloud config set project <project_id> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcloud services enable composer.googleapis.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcloud iam service-accounts create cloud-composer --display-name='Cloud Composer service account' | |
gcloud projects add-iam-policy-binding <project_id> --member=serviceAccount:cloud-composer@<project_id>.iam.gserviceaccount.com --role=roles/composer.worker | |
gcloud projects add-iam-policy-binding <project_id> --member=serviceAccount:cloud-composer@<project_id>.iam.gserviceaccount.com --role=roles/cloudsql.client | |
gcloud projects add-iam-policy-binding <project_id> --member=serviceAccount:cloud-composer@<project_id>.iam.gserviceaccount.com --role=roles/bigquery.user | |
gcloud projects add-iam-policy-binding <project_id> --member=serviceAccount:cloud-composer@<project_id>.iam.gserviceaccount.com --role=roles/bigquery.dataEditor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcloud composer environments create data-synchronization-env --location=europe-west1 --zone=europe-west1-b --service-account=cloud-composer@<project_id>.iam.gserviceaccount.com --python-version=3 --enable-ip-alias --enable-private-environment --image-version=composer-1.12.4-airflow-1.10.10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcloud services enable servicenetworking.googleapis.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcloud compute addresses create google-managed-services-default --global --purpose=VPC_PEERING --prefix-length=16 --network=default --project=<project_id> | |
gcloud services vpc-peerings connect --service=servicenetworking.googleapis.com --ranges=google-managed-services-default --network=default --project=<project_id> |
OlderNewer