menu
arrow_back

Autoscaling an Instance Group with Custom Cloud Monitoring Metrics

—/100

Checkpoints

arrow_forward

Create a GCS bucket

Create an instance template

Create an instance group

Configure autoscaling for the instance group

Autoscaling an Instance Group with Custom Cloud Monitoring Metrics

1 hour 7 积分

GSP087

Google Cloud Self-Paced Labs

Overview

This lab will you will create a Compute Engine managed instance group that autoscales based on the value of a custom Cloud Monitoring metric.

Objectives

  • Deploy an autoscaling Compute Engine instance group.
  • Create a custom metric used to scale the instance group.
  • Use the Cloud Console to visualize the custom metric and instance group size.

Application architecture

The autoscaling application uses a Node.js script installed on Compute Engine instances. The script reports a numeric value to a Cloud monitoring metric. You do not need to know Node.js or JavaScript for this lab. In response to the value of the metric, the application autoscales the Compute Engine instance group up or down as needed.

The Node.js script is used to seed a custom metric with values that the instance group can respond to. In a production environment, you would base autoscaling on a metric that is relevant to your use case.

The application includes the following components:

  1. Compute Engine instance template - A template used to create each instance in the instance group.
  2. Cloud Storage - A bucket used to host the startup script and other script files.
  3. Compute Engine startup script - A startup script that installs the necessary code components on each instance. The startup script is installed and started automatically when an instance starts. When the startup script runs, it in turn installs and starts code on the instance that writes values to the Cloud monitoring custom metric.
  4. Compute Engine instance group - An instance group that autoscales based on the Cloud monitoring metric values.
  5. Compute Engine instances - A variable number of Compute Engine instances.
  6. Custom Cloud Monitoring metric - A custom monitoring metric used as the input value for Compute Engine instance group autoscaling.

49026757e5fe0712.png

Join Qwiklabs to read the rest of this lab...and more!

  • Get temporary access to the Google Cloud Console.
  • Over 200 labs from beginner to advanced levels.
  • Bite-sized so you can learn at your own pace.
Join to Start This Lab