Skip to content

team-data-science/Data-Engineering-On-GCP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 

Repository files navigation

Architecture of the course

  1. Set the environment

  2. Create a GCP Project
    Project name: weather-api-project

  3. Activate required APIs with

gcloud services enable cloudfunctions.googleapis.com sqladmin.googleapis.com run.googleapis.com cloudbuild.googleapis.com artifactregistry.googleapis.com eventarc.googleapis.com compute.googleapis.com servicenetworking.googleapis.com pubsub.googleapis.com logging.googleapis.com
  1. Setting up a Scheduler
  • Cron scheduler: Name: weather_call
    Region: us-central1
    Description: Information about the job
    Frequency: 0 * * * *
    Timezone: UTC

  • Pub/Sub Topic ID: weather_calls
    Message body: update

  1. Setting up CloudSQL(MySQL)
  • Compute Engine
    Name: weather-vm
    Machine configuration >> general-purpose:
    Series N1
    Machine type: f1-micro
    Allow http and https traffic
  • VPC Network
    Name: weather-vm-ip
  • Cloud SQL Database Engine: MySQL 8.0
    Instance ID: weather-db
    Password: admin1234
    Preset: Development
    Machine type: Lightweight 1vCPU 3.75GB
    Storage: SSD 10GB with automatic storage increases
    Network >> Name: connection-db-vm
    --VM IP address reserved
  • Compute Engine
    --install mysql server
sudo apt-get update
sudo apt-get install \
default-mysql-server

--log in to mysql database

mysql -h <weather-db> \
-u root -p

For example,

mysql -h 34.72.233.196 \
-u root -p

--create a weather_db database.

 CREATE DATABASE weather_db;
 SHOW DATABASES; 

--create a weather_db.weather_data table

CREATE TABLE IF NOT EXISTS weather_data (
                        id INT PRIMARY KEY AUTO_INCREMENT,
                        lat FLOAT NOT NULL,
                        lon FLOAT NOT NULL,
                        temperature_c FLOAT NOT NULL,
                        feelslike_c FLOAT NOT NULL,
                        humidity FLOAT NOT NULL,
                        last_updated timestamp,
                        wind_kph FLOAT,
                        name varchar(255));
  1. Working-on-topic-subscription
  • Pub/Sub topic
    Topic ID: apiweather-extract

  • Pub/Sub subscription
    Subscription ID: apiweather-extract-subscription

  1. Creating a Cloud Function
  1. Connect CloudSQL to Looker Studio - https://lookerstudio.google.com/
    Instance Connection Name
    Database name: weather_db
    Username: root
    Password: admin1234

  2. Making Dashboards

CONCAT(lat,",",lon)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages