GCP Classroom Series – 13/Mar/2021

Instance Template

  • Scenario: Consider a ficticious application called as lt-ehealth, the architecture of the application is as shown below Preview

  • Now to realize this architecture, we can

    • create a vm called as lt-web and install/configure/deploy web application
    • Similarly create vms and deploy the following applications
      • lt-epharma
      • lt-eradiology
      • lt-econsul
    • We can create gcloud sql for primary and secondary database
  • We need to address the following concerns

    • When lt-eweb or any of the application modules are having more load, then how to address this situation?
    • We need to enable auto scaling. Auto scaling is a feature of cloud where you increase/decrease number of systems (vms) running a particular application automatically based on certain conditions like cpu utilization, network etc.
    • In the vm the application should be pre-installed, its not a good idea to install application on the fly
    • We also need to address the following concern when i have more than one vm running my application how can i create a load balancer
  • Instance template is a resource that you can use to create vms or managed instance groups

  • Each instance template defines the machine type, boot disk image, labels and other instance properties so that we can create multiple vm’s from that

Scenario

  • Lets create a image of the machine where lamp stack is installed and consider it to be lt-eweb
  • Create a ubuntu18 vm Preview
  • Now install lamp stack excluding mysql and firewall by following steps Refer Here
  • Install stress tool
sudo apt install stress -y
  • Now lets try to create a image Preview Preview Preview
  • Now lets try to create an instance template with lt-eweb image and in the us-central in all zones Preview Preview Preview
  • We would be also create image templates for our application components
    • lt-epharma
    • lt-eradiology
    • lt-econsul
  • To automate this image creation we have tool called as Packer Refer Here
  • We can use instance template to create a vm instance or instance groups Preview Preview
  • But our idea is not to create one vm but to create vms that can be autoscaled
  • So we have to create instance groups, There are two types of instance groups
    • Managed Instance Groups:
      • This allows our workloads to be scalable and highly available via automated services in the groups such as auto scaling or auto healing
      • Google recommends using this type of group
    • Unmanaged Instance Groups
      • This type of instance groups allows for load balancing across vm’s which are not identical.
      • These are self managed and auto scaling and auto healing is not supported

Managed Instance Groups (MIGs)

  • We can use MIGs for scenarios
    • Stateless serving workloads
    • Statelful applications (legacy applications)
  • A MIG creates each of its managed instance based on instance template and optional stateful configuration

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Customized Social Media Icons from Acurax Digital Marketing Agency

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube