Slide 1

Slide 1 text

How to optimize cost on cloud ☁ Kamolphan Liwprasert β€œFon” Machine Learning Engineer, Sertis

Slide 2

Slide 2 text

1. Why we need to optimize cloud cost πŸ’Έ 2. Choose the right services πŸš€ 3. Demo: Cloud Functions with Compute Engine API 🌧 + β˜€ = 🌈 4. Other tips to save the cost 🏦 5. Summary πŸ“ Agenda

Slide 3

Slide 3 text

Why we need to optimize cloud cost πŸ’Έ

Slide 4

Slide 4 text

It’s money πŸ’° ● reduce cost ● utilize more

Slide 5

Slide 5 text

Tip 0 : Free Tier πŸŽ‰

Slide 6

Slide 6 text

Free Trial: Free $300 USD for new users (90 days)

Slide 7

Slide 7 text

https://cloud.google.com/free

Slide 8

Slide 8 text

US region only Free Compute Engine Or, use Preemptible VM to reduce the cost

Slide 9

Slide 9 text

Choose the right services πŸš€

Slide 10

Slide 10 text

Compute Services πŸ€–

Slide 11

Slide 11 text

Google Compute Engine GCE Virtual Machine Google Kubernetes Engine GKE Managed K8s cluster Google Cloud Run Serverless container Google App Engine GAE Serverless application platform Google Cloud Functions GCF Serverless functions IAAS : Infrastructure as a service CAAS : Container as a service PAAS : Platform as a service FAAS : Function as a service Compute Services

Slide 12

Slide 12 text

Go Serverless

Slide 13

Slide 13 text

Tip 1 : Choose the right service πŸš€

Slide 14

Slide 14 text

Demo Time! 🌧 + β˜€ = 🌈

Slide 15

Slide 15 text

Goal: Reduce GCE Cost 🎯

Slide 16

Slide 16 text

Tip 2 : β€œTurn off when not using it” πŸ’‘

Slide 17

Slide 17 text

https://github.com/fonylew/ simple-cloud-functions-vm-controller

Slide 18

Slide 18 text

https://github.com/fonylew/ simple-cloud-functions-vm-controller Fully managed Cron service Serverless Messaging service Serverless Functions Virtual Machine

Slide 19

Slide 19 text

Q:How to stop GKE Cluster? πŸš› 🚚 πŸš›

Slide 20

Slide 20 text

Resizing a cluster https://cloud.google.com/sdk/gcloud/reference/container/clusters/resize (to 0 )

Slide 21

Slide 21 text

Other Tips? 🏦

Slide 22

Slide 22 text

Save the Storage πŸ“¦

Slide 23

Slide 23 text

Tip 3 : Add Storage Lifecycle β™»

Slide 24

Slide 24 text

Storage object Lifecycle cannot be undeleted. Delete Multi-Regional Storage/ Regional Storage Nearline Storage Coldline Storage Archive Storage OR

Slide 25

Slide 25 text

Storage classes

Slide 26

Slide 26 text

How to set Storage Lifecycle

Slide 27

Slide 27 text

BigQuery: set Dataset Expiration ⏱

Slide 28

Slide 28 text

Tip 4 : Delete when not using it (anymore) πŸ—‘β›”

Slide 29

Slide 29 text

this page has been deleted

Slide 30

Slide 30 text

1. Persistence Disk (even VM is not started) => Always start small, and resize later 2. Reserved IP addresses 3. Minimize egress network 4. . . . 5. Delete unused projects What can be a cost:

Slide 31

Slide 31 text

Tip 5 : Add label to resources 🏷

Slide 32

Slide 32 text

Adding Label https://cloud.google.com/compute/docs/labeling-resources#gcloud_1

Slide 33

Slide 33 text

Summary πŸ“

Slide 34

Slide 34 text

0. Free Tier πŸŽ‰ 1. Choose the right service πŸš€ 2. Turn off when not using it πŸ’‘ 3. Add Storage Lifecycle β™» 4. Delete when not using it (anymore) πŸ—‘β›” 5. Add label to resources 🏷 Tips:

Slide 35

Slide 35 text

Every minute counts ⏳

Slide 36

Slide 36 text

Q&A ❓

Slide 37

Slide 37 text

Thank you! πŸ˜ƒ

Slide 38

Slide 38 text

Thank you! πŸ˜ƒ Feedback is a gift 🎁 bit.ly/ feedback-form-fon Sertis is hiring bit.ly/sertis-apply-now Road to data engineer bit.ly/road2de This Slide: bit.ly/fon-slide-gdg2020