DEV Community

Cover image for Google Cloud Platform Part 2
Shahriyar Al Mustakim Mitul
Shahriyar Al Mustakim Mitul

Posted on

Google Cloud Platform Part 2

See Google Cloud Fundamentals Part 1

Custom Machine Type

Image description
Image description

Instance Group
Group of VM instances managed as a single entity.

Image description

There are 2 types of Instance groups. 1)Managed 2) Unmanaged
Managed Instance Group (MIG)

Image description

Let's create managed instance group:

Image description
Under the Compute Engine, go to Instance Group

Image description

Image description
You may find managed and unmanaged groups there.

Image description
Managed (Stateful) is for database type of things. For web applications and APIs we use Managed (Stateless).

Let's create a Stateless Managed Instance:

  1. First give it a name
  2. Choose an instance template
  3. Choose Multiple Zone
  4. On the Auto Scaling. Choose minimum : 2 and maximum: 2
  5. In Autoscaling metrics, you can see "CPU Utilisation","HTTP Load balancing utilisation", "Cloud monitoring metric". Choose CPU utilisation and keep the default value.
  6. Don't need to on Predictive autoscaling( checks last weeks data etc to scale)
  7. You can select cooldown period where you will choose how long you want to wait before checking the metrics.
  8. You can enable scale in counts. For example: you have 100 instacnces and you want to reduce each time 10 instacnes.You can choose Don't scale by more than : 10 and 10min which will reduce 10instancecs per 10 min.
  9. In Auto healing , go to create a health check . Give it a name and change the protocol to "HTTP" . Under Health Criteria, check interval can be 5seconds to check instances after every 5seconds. If you choose 5 seconds for Timeout and the instance does not get any response for 5 seconds, it will be considered as timeout. Healthy threshold means how many consecutive success is needed to mark it as healthy.
  10. Initial delay (how much your instance need to boot up)
  11. Press Create

Load Balancing

Image description
Create a Load balancer:

  1. Go to Network services and choose load balancing.
  2. Select HTTP(S) Load balancing.

Image description

Image description
Give the load balancer a name.
The Backend Configuration is where we want to redirect the incoming traffics. Here we are going to use Managed Instance Group as Backend Configuration. From there create a Backend service.
Use Cloud CDN, if you want to cache static contents like HTML, CSS.
Add health Check and then create .

Host and path rules has rules how one ones to redirect traffic to the back end. Keep host and path empty and instance group as selected to send traffic to the instance group.

Frontend Configuration is where you would receive the traffic.

Image description
and done. Go to review finalize and Create.

The load balancer is ready.

Image description

Top comments (0)