-1

I'm quite new to GCP and tried to set up a website on the GCP compute engine. I was aware of egress charges but never thought I will get so much fake traffic from China. I thought of blocking all the traffic from China. But I felt, it would not be the right thing to do. I would like to understand how egress traffic bills a webpage. This may sound amateur or funny, please bear with me.

Scenario 1: Let's assume I have 2 MB size of images in my webpage, and a 20kb html file with youtube video; are in compute engine. I understood that the egress traffic will be calculated on the 2 MB images and 20 kb transferred. But when I/someone play a youtube video that is embedded in the html, is it considered as egress traffic as well?

Scenario 2: The files size is same as above, now, the images are shifted to CDN/Cloud storage and only the html file of 20kb with youtube video is in compute engine. If someone try to access the webpage, will they calculate compute engine egress charges based on the total transfer of 2MB images and 20kb html file? or just the 20kb of html file?

Note: This is not just to cut costs on the billing, I'm just trying to create a effective solution without blocking a country's access to my website. I'm trying to understand the egress traffic from a few days, but I'm not sure if I really understood the core concept.

Manoj
  • 11
  • 1
  • All egress traffic is billed. You mention **youtube video is in compute engine**. Be very clear on what you are specifying. If the video is downloaded from YouTube and not from your instance, that traffic is not part of your egress traffic. Unless your content is very popular, using a CDN might not help with your bill due to the cache needing to load data over and over. A real answer requires a detailed analysis. Your question does not have those details. – John Hanley Nov 26 '22 at 05:11
  • I have mentioned that the youtube video is embedded in the html page which means the video will only be playing from the website, not for downloading. And please let me know what are details I'm missing, I would love to make it as detailed as possible to get better answers. – Manoj Nov 26 '22 at 07:23
  • What is the difference between playing and downloading? In order for a video to be played it must be transferred from the source to the destination. What the destination does after that, such as allowing the saving of the data, does not matter to your egress calculations. – John Hanley Nov 26 '22 at 07:37
  • I agree, I just want to understand while playing a video that is uploaded on youtube from the web page that is hosted in compute engine, will the transfer of video from youtube to destination via compute engine be counted as egress traffic or not. – Manoj Nov 26 '22 at 09:49
  • If the data is transferred by Compute Engine, yes it will be counted. – John Hanley Nov 26 '22 at 14:07

1 Answers1

0

Based on your scenarios, there are two types of egress involved here, Compute Engine/Cloud Storage and Google Cloud CDN with different costs. For China, costs are almost double. Please refer to following google docs:

https://cloud.google.com/cdn/pricing#cloud-cdn-pricing https://cloud.google.com/vpc/network-pricing#internet_egress

Scenario 1: You will be charged for 20 MB + 20 Kb Compute egress. For youtube video, you don't have to pay egress as user's browser will be playing it from youtube servers

Scenario 2: If you put in Cloud Storage, egress costs will be same as Scenario 1. But, if you put in Cloud CDN, then costs will become lower.

SmartCoder
  • 856
  • 6
  • 11
  • Thank you so much for the quick response. With CDN I only get charged for caching, but while loading for the first time, will I be charged for the egress traffic from the compute engine or based on the cache fill? – Manoj Nov 26 '22 at 07:30
  • Please see the case: Cacheable content, cache miss. So, for first time you will have to pay cache lookup + cache egress + cache fill + applicable Cloud Load Balancing data processing or Cloud Storage operation charges. These charges replace the network egress charges that apply when serving directly from Compute Engine or Cloud Storage. – SmartCoder Nov 26 '22 at 07:47