I understand that egress traffic is outgoing traffic. Why is egress traffic charged rather than ingress traffic? And how are different kinds of egress traffics charged differently?
I hope my little understanding can explain it 🙂
When you provision a VPC, then create a Subnet in a region and deploy a Compute Engine instance in a particular zone inside that region, you’re basically assigned with a few units of underlying hardware including network switch, router, server, etc.
Let’s say you have 3 GCE instances (A, B and C) in the same zone, they will end up being deployed in the same DC or in two/three DCs close to each other (still in the same zone). If they end up in the same DC, it’s like communicating between floors in a house. If they end up in different DCs but close to each other (same zone), it’s like communicating with your next door neighbor. The cost to maintain networking infrastructure for this communication in this case is very very small and the provider (GCP) can withstand it as "free".
Now imagine a different scenario where you have 3 GCP instances in 3 different zones (in the same region), your instances are now in 3 distinct DCs that are physically far from each other (not too far though). To handle this kind of communication the provider has to maintain the linkage between distant DCs, so they have to charge if the traffic flow crosses from one zone to another.
Moving on, now you have 3 GCE instances in 3 different regions, for sure they will be in 3 different DCs that are geologically far from each other (hundreds of miles up to thousands of miles). You may know that maintaining network traffic between states/countries/continents are very expensive, so that explain the cross-region cost is very high.
That’s why there are different rates for egress traffic :).
About why egress is charged and not ingress, I think it’s because:
For regular network traffic (intra-VPC or inter-VPC), you will always have two-way network communication, so the provider only need to charge you on one end (think about toll-booths on highways).
If you use GCP to serve contents to everybody on the globe, you will end up having a huge amount of egress traffic and GCP will obviously charge you for egress so that they have the most benefits in return 😉
Great answer, that helps a lot. Thanks!