Coder Social home page Coder Social logo

gcp's Introduction

s204

Implementation of ETL pipeline on GCP Infrastructure

Build Status

In this cloud specialization module we'll be implementing an ETL (Extract,Transform,Load) pipeline through a Google cloud function written in GOLANG. We'll be using Terraform as IAC tool to provision and use following GCP resources for our ETL pipeline.

  • Google Cloud Storage.
  • Google CLoud Function.
  • Google Cloud Scheduler.
  • GCP BigQuery

Features

  • Extract 100 csv records per function invocation.
  • Transform records which meet the transformation criteria.
  • Insert the records into the BigQuery Table.
  • Enable periodic function invocation using Google Cloud Scheduler.

Step-by-Step Guide

1 - Clone the xldp repo to your system and navigate to the directory relevant to this module.

git clone https://github.com/X-CBG/xldp.git
cd xldp/cloud_specializations/s204/noman

2 - Download the csv file from this link.

3 - Navigate to the CloudFunction directory and create a zip archive (ETL.zip) of the cloud function source code files.

cd CloudFunction/
zip ETL.zip main.go go.mod && cd ..

4 - Navigate to the Terraform folder. initialize terraform in the directory.

cd Terraform && terraform init

5 - Open the directory in any editor for example VScode and update the values of sourcepath and csv_local_path
variables in variables.tf according to the absolute path of the csv file and ETL.zip on your system. Futher, please update the value of project in main.tf to reflect the ProjectID of your project in your GCP account.

6 - Authenticate your gcloud cli with GCP.

gcloud auth login 
#you will be prompted with a window in your default browser, check the boxes as per requirements and your gcloud CLI will be authenticated with GCP automatically.

7 - Apply the terraform configuration to setup the infrastructure resources

terraform apply --auto-approve

GCP Resources

Login into your gcp account and verify that the following resources with the mentioned names have been created inside your project.

Resource Name
Cloud Storage Bucket for_s204_xgrid
Cloud Storage Object covid-csv-s204.csv
Cloud Function etl_function
Cloud Scheduler invoke_ETL
BigQuery Dataset covidDataset
BigQuery Table covid-table

Verify

You may verify the functionality by manually triggering the cloud fucntion http endpoint from your browser.

http://us-east1-your-projectID.cloudfunctions.net/etl_function/?a=your-projectID&&b=covidDataset&&c=covid-table

** Note: Please replace "your-projectID" with the projectID of your project in your GCP accout.

You can now verify the functionality of the ETL pipeline by previewing the BigQuery table in the dataset which will now be including the first 100 records from the csv after the first invocation.


gcp's People

Contributors

noman-xg avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.