Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a CDN with Google Cloud and Image Optimization

I have many websites and also websites made by clients which I would like to optimize. I am currently using different CDN providers but I would like to simplify my workflow and hopefully also lower the costs.

I would like to have a CDN with a Pull Zone, and that CDN would also optimize the images (while not modifying the other static resources).

Ideally, I would also have access to statistics for each Pull Zone (since I would like to charge my clients for this service instead of guessing).

What are the different ways to do this with the Google Cloud? Is there a way to do this only using Google Functions, CDN, and Google Storage? Of course, I guess that having a little NodeJS app running to optimize the images would be needed as well. I just wonder about the general architecture and if it is even possible (I know it is with Azure and AWS but I am already running a few things on the Google Cloud).

Thanks a lot :)

like image 327
TigrouMeow Avatar asked Dec 06 '18 07:12

TigrouMeow


1 Answers

In GCP a pull zone can be created by associating a HTTP(S) Load Balancer to a Cloud Storage Bucket and enabling Cloud CDN.

Having a different bucket for every client will break down the logs on your project, but not the billing for it.

To be able to separate billing you can always export the logs to a BigQuery and use it to break down the billing costs per client based on their use.


Regarding the optimization of the images, Google CDN will not perform any operation, neither GCS Bucket.

The only operation available in this direction is when using and serving GZip-compressed files.

I suggest you to dedicate one Instance to be able to prepare the images before storing or to add/replace the optimized versions of the images already inside the bucket.

like image 157
Daniel Avatar answered Oct 19 '22 11:10

Daniel