newbie cdn questions: load balancing, instances cost and related

187 views
Skip to first unread message

Bearcat Şándor

unread,
Dec 1, 2017, 9:01:05 AM12/1/17
to gce-discussion
Hey folks,

My aim is to create a CDN of my hosting vm. To do this i need to set up load balancing and to do that i need to set up an instance group.

I'm just starting out with Google Cloud and have set up some wordpress websites on a vm (nginx, mysql etc).  I understand what CDNs are, but i'm a bit confused about the pricing and the scary warning about deleting root drives.

My setup
  • I have a single VM set up that's working fine, running debian linux ( i have a lot of linux experience, but not much cloud experience ), with a "standard persistent disk" of 10 gb
  • I created an instance group on this VM (so the group currently contains 1 instance)
  • I created a snapshot of the root disc

I'm lost in the mess of links in the documentation, but i ran across something to the effect of "vm instances will be dynamically created as needed so, persistent root discs should be backed up".  Does this mean that my vm may be deleted out from under me at any time, or is this just in case something goes wrong while it's creating a mirror?  

If if the instance group is creating duplicates of a vm on the fly, am i charged the base price of a vm x the number of instances? So if a vm costs $10 just to sit there and it creates 3 more copies am i charged $30 that month?

Does this create a new external ip for external computers to access websites [on the vm/in the instance group] and therefore i have to re-point all of my dns records to this new ip?

The documents mention serving from a bucket, but does this mean that i can stick the static html files into a bucket and serve them from there ... or something.

I realise this is RTFM stuff, but i've been reading weeks now, and it's hard to get up and running quickly when i'm falling down the rabbit hole of a 20 minute read for this and that term that google uses in a special way. Just looking up one idea i end up 10 pages deep and clawing my way back up to my original document confused.


Thanks





Digil (Google Cloud Platform Support)

unread,
Dec 1, 2017, 4:51:07 PM12/1/17
to gce-discussion

There are several different elements involved in your billing.  I will try to disaggregate them as much as I can.


To work with Cloud CDN as you mentioned, you have two options.


  1. If you are holding a Static Site, you can use a bucket configured as your backend. In this first case, you would be charged for the cloud CDN service and the storage used by the bucket.

  2. You could use instance managed groups in your back-end.  On this configuration, you can use autoscaler, which will create or delete instances as needed . In this case, you will have the Cloud CDN service price and you will also be billed by the resources used by the VM during their existence. You can find an estimate here in this Google Cloud Platform calculator.


As you also mentioned, VMs in your instance managed group can be deleted or recreated. That means the data on them must be static. If you have Website that is totally changing, the HTTP server can live on the VMs. But the data must be outside the persistent disk.


For example, you could have a Cloud SQL instance outside the group. Now, this could represent an additional charge on your architecture as well.


Bear in mind that independently of the solution you are using, all the back-end services are behind a Load Balancer. This LB has an external IP attached. Therefore independently on whatever happens on the back-end, the IP used  to access your website will not change.


Have you checked the documentation on HTTP(s) LB?. While setting up the LB you can set the  static external IP on that LB. This IP will be the address for the website. Every request will first hit the LB and the LB then redirect it to the appropriate instances. On a side note, reserved but assigned static IPs won't incur charges, however if it's reserved but unassigned you will be billed for it as mentioned in this help center article.


Bearcat Şándor

unread,
Dec 7, 2017, 6:34:36 PM12/7/17
to gce-discussion
Thank you for the reply Digil, that's all very helpful.

When you say that in the case of instance managed groups that "you will have the Cloud CDN service price and you will also be billed by the resources used by the VM during their existence" do you mean that if my original instance has a 10 gb disc (let's say that cost me $2 an hour) and the managed group creates 3 more copies of the original instance for an hour and then deletes them, that will be charged $8 for that hour ($2 for each machine in the group)? 

Carlos (Cloud Platform Support)

unread,
Dec 8, 2017, 1:58:13 PM12/8/17
to gce-discussion
Hi Bearcat

GCE resources are indeed charged based on the time they live in your project. A GCE VM certainly use a PD which is charged as described in this article. Nevertheless, other resources are needed to run the server  (i.e. CPU memory) and those are also charged. You can find the details on GCE billing here. If the instance managed group spin 3 VMs, you will be charge for all the resources these VMs consume during their existence. The best way to find an estimate the charge is by using the online calculator.  Instance groups are scaled base on load and metrics which you might not be able to predict if you do not have historical data. Nevertheless you can always define the maximum number of replicas that can be created. 

As per Digil previous post, CDN price has to be considered apart.
Reply all
Reply to author
Forward
0 new messages