IBM Cloud Docs
Creating an instance group for auto scaling

Creating an instance group for auto scaling

With Auto Scale for VPC, you can create an instance group to scale according to your requirements. Based on the target utilization metrics that you define, the instance group can dynamically add or remove instances to achieve your specified instance availability.

If you are going to use a custom image in a private catalog, you must first create a service-to-service policy to globalcatalog-collection.instance.retrieve before you can create the instance group. For more information, see Using a custom image in a private catalog with an instance group.

Auto scale for VPC

With Auto Scale for VPC, you can improve performance and costs by dynamically creating virtual server instances to meet the demands of your environment. You set scaling policies that define the average utilization that you want to achieve for metrics like CPU, memory, and network usage. The policies that you define determine when virtual server instances are added or removed from your instance group.

As an example, imagine that the fictitious company, Acme Web Retailer, sets up an instance group for auto scaling. They define that they always want to maintain a minimum of three instances and a maximum of seven instances. They create a dynamic scaling policy for CPU usage with their specified average utilization for instances at 70%. They set an aggregation window of 10 minutes, so the instance group manager monitors each instance for 10 minutes before it calculates the average utilization. If adjustments are needed to meet the target utilization across instances, the instance group manager provisions or reclaims more instances as needed.

Auto scale uses the following computation to determine how many instances are running at any time:

Σ(Current average utilization of each instance)/target utilization = membership count

If Acme Web Retailer has four virtual server instances that are running when the aggregation window elapses, the formula looks like this: VSI1 + VSI2 + VSI3 + VSI4 / 70% = membership count. CPU utilization for the four running instances is 80%, 70%, 65%, and 85%, so the following computation takes place:

80% + 70% + 65% + 85% / 70% = 4.29

Based on this calculation, the instance group manager rounds 4.29 up to 5 and provisions another instance. Now Acme Web Retailer has a total of five instances and maintains their specified average CPU utilization across the instances in the group.

Image showing an instance that is being added to an instance group
Auto scale instance group adds new instance

When an instance group scales up to create an instance, a subnet is selected randomly from the subnets that are defined for the instance group. When an instance group scales down to remove instances, it uses a first in first out (FIFO) strategy. The oldest instances are deleted first. If at any time an instance in the instance group fails, it is replaced with a new instance.

You can configure your instance group with a load balancer to balance incoming requests across instances. With a load balancer, you can configure specific health checks for the pool members that are associated with instances in your instance group. If an instance fails health checks, a new instance is created in the instance group to replace the failed membership. When the new instance is available, the instance that failed health checks is deleted.

The monitoring service reflects the same health information for instances that health checks access.

Setting up auto scale with the UI

Before you can create an instance group, you need to create an IBM Cloud VPC.

To create an instance group for auto scale, you must complete the following tasks.

  1. Create an instance template that is used to provision instances in your group.
  2. Create an instance group in a single region that is made up of like virtual server instances.
  3. Choose a scaling method (static or dynamic) and create scaling policies.

Creating an instance template

An instance template is required before you can create an instance group for auto scaling. The instance template defines the details of the virtual server instances that are created for your instance group. For example, specify the profile (vCPU and memory), image, attached volumes, and network interfaces for the image template. All of the virtual server instances that are created for an instance group use the instance template that is defined in the instance group.

All resources that are defined in an instance template must all be in the same resource group as the instance group.

To create an instance template, complete the following steps.

  1. In the IBM Cloud console, go to Navigation Menu icon menu icon > Infrastructure VPC icon > Compute > Instance templates.
  2. Click New instance template and enter the information that is in Table 1.
  3. Click Create instance template when the information is complete.
Instance template selections
Field Value
Location Locations are composed of regions (specific geographic areas) and zones (fault tolerant data centers within a region). Select the geography, region, and zone where you want your virtual server instance to be created.
Name A name is required for your virtual server instance.
Resource group Select a resource group for the instance.
Image

Click Change image to select an image. On the Select an image page, you can select a stock image, custom image, catalog image, snapshot, or an existing volume. If the geographic location where you are provisioning an instance supports it, you can select an x86 or s390x architecture. After you select your image, click Save.

  • Stock images: You can select from available stock images. For more information, see x86 virtual server images and s390x virtual server images.
  • Custom images: A custom image can be an image that you customize and upload to IBM Cloud Object Storage, which you can then import into IBM Cloud VPC. You can also use a custom image that was created from a boot volume. For more information about custom images, see Getting started with custom images.
  • Catalog images: A catalog image is a custom image that is imported into a private catalog. For more information about catalog images, see VPC considerations when using custom images in a private catalog.
  • Snapshot: You can select from available snapshots. For more information, see About Block Storage Snapshots for VPC.
  • Existing volume: You can select from existing volumes. The specified volume must be unattached, and must have an operating system with the same architecture as the instance profile.
Profile Click Change profile to select from all available vCPU and RAM combinations. The profile families are Balanced, Compute, Memory, and GPU. For more information, see Profiles.
SSH Key You must select an existing public SSH key or click Create an SSH key to create a new one. You can create only RSA SSH keys. For ED25519 SSH keys, you must upload the key information. For more information about creating an SSH key, see Creating your SSH key by using the UI. SSH keys are used to securely connect to the instance after it's running.

Note:** Alpha-numeric combinations are limited to 100 characters. SSH keys can be either RSA or ED25519. ED25519 can be used only if the operating system supports this key type. ED25519 can't be used with Windows or VMware images.

For more information, see Getting started with SSH keys.

Boot volume The default boot volume size for all profiles is 100 GB. You can specify a larger boot volume capacity, up to 250 GB, depending on what the image allows. You can also specify user tags.
Data volumes You can add one or more secondary data volumes to be included when you provision the instance. To add volumes, click Create. You can specify customer-managed encryption and user tags for the volume.
Virtual private cloud Specify the IBM Cloud VPC where you want to create your instance. You can use an existing VPC or you can create a new VPC. To create a new VPC, click New VPC.
Network interfaces Defines the networking connection into the IBM Cloud VPC. By default, the new option Network attachment with a virtual network interface is selected for your instance template. Alternatively, you can select the legacy option Instance network interface. Whichever type of network interface option that you select when you provision the virtual server persists through the lifecycle of the virtual server. After you selected your network interface type, you can click the Edit icon Edit icon to update the details of the network interface, for example, the subnet or the associated security group.
User data You can add user data that automatically performs common configuration tasks or runs scripts. For more information, see User data.
Metadata Disabled by default, lets the instance that is created from this template gather metadata about itself. Click the toggle to turn on the metadata service. For more information, see About Instance Metadata for VPC.
Add to dedicated host You can add the virtual server instance to a dedicated host, creating the instance in a single-tenant space. To provision a dedicated instance, you must have a dedicated host available or create one.
Add to placement group You can select a placement group for the instance. To enable placement groups, click the toggle. Then, select or create a placement group for the instance. If you add a placement group, the instance is placed according to the placement group strategy. For more information, see About placement groups.
Host failure auto restart This setting is enabled by default. To disable host failure auto restart, click the toggle. For more information, see Host failure recovery policies.

Important: Instance groups don't support instance templates that have the following configurations:

  • Secondary network interfaces aren't supported. Only one primary network interface for an instance template is supported in an instance group.
  • A primary IP address or floating IP address that is assigned to the primary interface isn't supported.

When you create an instance template, validation steps are performed to make sure that you can use this template to provision a virtual server instance.

Creating an instance group

An instance group is a collection of like virtual server instances. You define how many instances to maintain in the group. You can set a static number of instances or choose to dynamically scale instances according to your requirements.

If you want to include a load balancer for your instance group to balance incoming requests across instances and configure specific health checks, you must create the load balancer before you create the instance group. For more information, see the following topics:

For more information about health checks for load balancer pools, see the following topics:

Not all network load balancer offerings support integration with instance groups. Before attaching an instange group to a network load balancer pool, ensure that the instance_groups_supported property of the load balancer detail is true.

  1. Make sure that you have the required IBM Cloud Identity and Access Management (IAM) permissions to create an instance group. For more information, see Managing IAM access for VPC Infrastructure Services.
  2. In the IBM Cloud console, go to Navigation Menu icon menu icon > Infrastructure VPC icon > Compute > Instance groups.
  3. Click New instance group and enter the information in Table 2.
  4. If you want to create dynamic scaling policies as part of instance group creation, see Creating scaling policies. You can also add policies later after you create your instance group.
  5. Click Create instance group when the information is complete.
Instance group selections
Field Value
Name A name is required for your virtual server instance.
Resource group Select a resource group for the instance.
Region Select the location where you want your virtual server instance to be created.
Placement group Select a placement group for the instance. If you add a placement group, the instance is placed according to the placement group policy. For more information, see About placement groups.
Subnets Select the subnets where you want to create your instance group. To maximize the availability of your applications, select subnets in different zones. For the best performance of an auto scale instance group, ensure that you use a subnet size of 32 or greater.
Use a load balancer Select this checkbox if you plan to use a load balancer to balance incoming requests across instances in your instance group. The load balancer must already be configured, attached to the subnets that you select for this instance group, and have at least one back-end pool.
Instance template Select the instance template that you want to use for provisioning the virtual server instances in your auto-scale instance group. All virtual server instances in the group are provisioned with the same instance template.
Scaling method Select whether you want to use a dynamic or static scaling method. With the dynamic scaling method, instances are added or removed based on the metric targets that you specify. With the static scaling method, you can specify a fixed number of instances that you always want to maintain.
Instance group size For a static group, enter the number of instances that you want to constantly have in this instance group. For a dynamic group, enter the minimum and maximum number of instances for your group. The number of instances scale automatically within that range based on the target metrics that you define.
Aggregation window (seconds) For a dynamic group, this value determines the time period that the instance group manager monitors each instance and determines the average utilization.
Cooldown period (seconds) For a dynamic group, the cooldown period is the time in seconds to pause further scaling actions after scaling takes place.

Creating scaling policies

For the dynamic scaling method, you define certain metrics (like CPU utilization percent) and the target utilization that you want to achieve for that metric. Together, the metric and the average target utilization, determine when your instance group needs to dynamically add or remove virtual server instances from your group.

To add scaling policies, complete the following fields on the New instance group for VPC page. If you need to add policies after your instance group is already created, see add policies.

Scaling policies selections
Field Value
Metric type Select the metric type that you want to associate with a target utilization value to use for adding or removing instances from your group. You can choose one of these metrics: CPU utilization (%), RAM utilization (%), Network in (Mbps), Network out (Mbps). You can define more than one target metric policy, but only one policy for each type of metric.
Average target utilization Specify the average utilization that you want to achieve for the metric that you select. This target value defines when the instance group manager needs to scale up instances or scale down instances in your group. At the end of each aggregation window, the instance group manager adds the current utilization of each instance and divides it by this target utilization value to determine the membership count.

Setting up auto scale with the CLI

You can create an instance group in your IBM Cloud VPC to auto scale according to your requirements by using the IBM Cloud CLI.

Before you begin

Make sure that you set up your IBM Cloud® CLI environment and your IBM Cloud VPC.

To create an auto scale instance group by using the CLI, you must complete the following tasks:

  1. Make sure that you have the required IBM Cloud Identity and Access Management (IAM) permissions to create instance group resources. For more information, see * Managing IAM access for VPC Infrastructure Services.
  2. Create an instance template that is used to provision instances in your group.
  3. Create an instance group in a single region that is made up of like virtual server instances.
  4. Create an instance group manager so that you can apply your scaling policies.
  5. Create scaling policies to dynamically add or remove instances from your group based on the target utilization metrics that you define.

Creating an instance template

All resources that are defined in an instance template must all be in the same resource group as the instance group.

Gathering information to create an instance template

Ready to create an instance template? Before you can run the ibmcloud is instance-template-create command, you need to know the details about your instance template and command options, such as what profile or image you want to use. Follow these steps to prepare for running the command.

Gather the following required instance template details.

Required instance template details
Instance template details Listing command
VPC ibmcloud is vpcs
Zone ibmcloud is zones
Profile ibmcloud is instance-profiles
Subnet ibmcloud is subnets
Image ibmcloud is images

Use the following commands to determine the required information for creating a new instance template.

  1. List the regions associated with your account.

    ibmcloud is regions
    

    See the following example.

    $ ibmcloud is regions
    Listing regions under account Test Account as user test.user@ibm.com...
    Name       Endpoint                              Status
    au-syd     https://au-syd.iaas.cloud.ibm.com     available
    br-sao     https://br-sao.iaas.cloud.ibm.com     available
    ca-tor     https://ca-tor.iaas.cloud.ibm.com     available
    eu-de      https://eu-de.iaas.cloud.ibm.com      available
    eu-es      https://eu-es.iaas.cloud.ibm.com      available
    eu-gb      https://eu-gb.iaas.cloud.ibm.com      available
    jp-osa     https://jp-osa.iaas.cloud.ibm.com     available
    jp-tok     https://jp-tok.iaas.cloud.ibm.com     available
    us-east    https://us-east.iaas.cloud.ibm.com    available
    us-south   https://us-south.iaas.cloud.ibm.com   available
    
  2. Switch to your target region.

    ibmcloud target -r <region-name>
    
  3. List the zones associated with the target region.

    ibmcloud is zones
    

    In the following example, the command is run in the us-south region and the output shows the available zones in the region.

    $ ibmcloud is zones
    Listing zones in target region us-south under account Test Account as user test.user@ibm.com...
    Name         Region     Status
    us-south-1   us-south   available
    us-south-2   us-south   available
    us-south-3   us-south   available
    
  4. List the IBM Cloud VPCs that are associated with your account.

    ibmcloud is vpcs
    

    For this example, you see a response similar to the following output:

    ID                                          Name                                  Default          Status      Tags
    0738-xxx1xx23-4xx5-6789-12x3-456xx7xx123x   my-vpc                                yes              available   -
    0738-xxxx1234-5678-9x12-x34x-567x8912x3xx   my-other-vpc                          no               available   -
    

    If you don't have one available, you can create an IBM Cloud VPC by using the ibmcloud is vpc-create command. For more information about creating an IBM Cloud VPC, see IBM Cloud VPC CLI reference.

  5. List the available profiles for creating your instance template.

    ibmcloud is instance-profiles
    

    For this example, you see a response similar to the following output:

    Name           Architecture   Family     vCPUs   Memory(G)   Network Performance (Gbps)   GPUs
    bx2-2x8        amd64          balanced   2       8           4                            -
    bx2-4x16       amd64          balanced   4       16          8                            -
    bx2-8x32       amd64          balanced   8       32          16                           -
    bx2-16x64      amd64          balanced   16      64          32                           -
    bx2-32x128     amd64          balanced   32      128         64                           -
    bx2-48x192     amd64          balanced   48      192         80                           -
    cx2-2x4        amd64          compute    2       4           4                            -
    cx2-4x8        amd64          compute    4       8           8                            -
    cx2-8x16       amd64          compute    8       16          16                           -
    cx2-16x32      amd64          compute    16      32          32                           -
    cx2-32x64      amd64          compute    32      64          64                           -
    mx2-2x16       amd64          memory     2       16          4                            -
    mx2-4x32       amd64          memory     4       32          8                            -
    mx2-8x64       amd64          memory     8       64          16                           -
    
  6. List the subnets that are associated with the IBM Cloud VPC.

    ibmcloud is subnets
    

    For this example, you see a response similar to the following output:

    ID                                          Name                     Status
    0076-2249dabc-8c71-4a54-bxy7-953701ca3999   subnet1                  available
    0767-173bn4aa-060b-47e7-am45-b3395a593897   subnet2                  available
    

    For the best performance of an auto scale instance group, ensure that you use a subnet size of 32 or greater.

    If you don't have one available, you can create a subnet by using the ibmcloud is subnet-create command. For more information about creating a subnet, see IBM Cloud VPC CLI reference.

  7. List the available images for creating your instance template. You can create an instance by using a stock image, a custom image from your account, or an image that was shared with your account from a private catalog. Run one of the following commands based on the image that you plan to use.

    • Select a stock image or image from your account for your instance.

    To list all available images, run the following command:

    ibmcloud is images
    

    Deprecated images do not include the most current support.

    Now select image ibm-debian-11-3-minimal-amd64-1. To get the image ID, run the following command:

    image=$(ibmcloud is images | grep -i "debian.*available.*amd64.*public" | cut -d" " -f1)
    

    Save the image ID as a variable, which is used later to provision an instance.

    • Select an image shared from a private catalog for the instance

    To list all available images, run the following command.

    ibmcloud is catalog-image-offerings
    

    This command returns both the offering_crn and the offering_version_crn for the available images. When you create an instance, you can either provision an instance from the private catalog image at the latest version in a catalog product offering by using the offering_crn or from a specific version in the catalog product offering by using the offering_version_crn.

    Save the offering_crn and offering_version_crnin variables, which is used later to provision an instance.

    offering_crn="crn:v1:bluemix:public:globalcatalog-collection:global:a/a1234567:0b322820-dafd-4b5e-b694-6465da6f008a:offering:136559f6-4588-4af2-8585-f3c625eee09d"
    offering_version_crn="crn:v1:bluemix:public:globalcatalog-collection:global:a/a1234567:0b322820-dafd-4b5e-b694-6465da6f008a:version:136559f6-4588-4af2-8585-f3c625eee09d/8ae92879-e253-4a7c-b09f-8d30af12e518"
    

After you know these values, use them to run the instance-template-create command. In addition to the information that you gathered, you must specify a name for the instance.

The following example creates an instance template by using a stock image or a custom image from your account.

ibmcloud is instance-template-create INSTANCE_TEMPLATE_NAME VPC ZONE_NAME PROFILE_NAME SUBNET --image-id IMAGE_ID

For example, if you create an instance template that is called my-instance-template in us-south-1, use the bx2-2x8 profile, with a custom image _r008-54e9238a-feaa-4f90-9742-7424cb2b9ff1_ your instance-template-create command would look similar to the following sample.

ibmcloud is instance-template-create my-instance-template r006-680c56cb-7fbb-41e6-833b-029beb7b6ba3 us-south-3 bx2-2x8 0076-2249dabc-8c71-4a54-bxy7-953701ca3999 --image-id r008-54e9238a-feaa-4f90-9742-7424cb2b9ff1

Where:

  • INSTANCE_TEMPLATE_NAME is my-instance-template
  • VPC is r006-680c56cb-7fbb-41e6-833b-029beb7b6ba3
  • ZONE_NAME is us-south-3
  • PROFILE_NAME is bx2-2x8
  • SUBNET_ID is 0076-2249dabc-8c71-4a54-bxy7-953701ca3999
  • --image_ID is r008-54e9238a-feaa-4f90-9742-7424cb2b9ff1

For this example, you see a response similar to the following output Note: The following response varies depending on what values you use.

ID                             0738-c3809e5b-8d48-4629-b258-33d5b14fa84f
Name                           my-instance-template
CRN                            crn:v1:bluemix:public:is:us-south-3:a/a1234567::instance-template:0738-c3809e5b-8d48-4629-b258-33d5b14fa84f
Resource group                 Default
VPC ID                         r006-680c56cb-7fbb-41e6-833b-029beb7b6ba3
Image ID                       r008-54e9238a-feaa-4f90-9742-7424cb2b9ff1
Profile                        bx2-2x8
Primary Network Interface ID   Name      Subnet ID                                   Security Groups
                               primary   0076-2249dabc-8c71-4a54-bxy7-953701ca3999   r006-9fd0b586-6876-4e8a-a0a1-586aeff5167c

If you want to create an instance template from an image shared from a private catalog, replace --image_ID with either --catalog-offering or catalog-offering_version.

For more examples of the ibmcloud is instance-template-create command, see the VPC CLI reference.

When you create an instance template, validation steps are performed that ensure you can use your template to provision a virtual server instance. Need more help? You can always run ibmcloud is help instance-template-create to display help for creating an instance template.

Creating an instance group

After you have your instance template in hand, your next step is to create an instance group. Before you can run the instance-group-create command, you must specify a name for the instance group and determine values for the command options, such as what instance template you want to use.

If you want to include a load balancer for your instance group to balance incoming requests across instances and configure specific health checks, you must create the load balancer before you create the instance group. For more information, see

For more information about health checks for load balancer pools, see

Gather the following information.

Required instance group details
Instance group details Description
Instance template ID of the instance template that you created in the previous task
Subnet IDs Comma-separated IDs of subnets that you must select from the ibmcloud is subnets command in the previous task
--membership-count Number of members in the instance group

After you know these values, use them to run the instance-group-create command. In addition to the information that you gathered, you must specify a name for the instance group.

ibmcloud is instance-group-create INSTANCE_GROUP_NAME --instance-template INSTANCE_TEMPLATE --subnet-ids IDS --membership-count MEMBERS

For example, if you create an instance group that is called my-instance-group with instance template ID 72251a2e-d6c5-42b4-97b0-b5f8e8d1f479 and 1 member initially, your instance-group-create command would look similar to the following sample.

ibmcloud is instance-group-create my-instance-group --instance-template 72251a2e-d6c5-42b4-97b0-b5f8e8d1f479 --subnet-ids 0076-2249dabc-8c71-4a54-bxy7-953701ca3999,0767-173bn4aa-060b-47e7-am45-b3395a593897 --membership-count 1

Where:

  • INSTANCE_GROUP_NAME is my-instance-group
  • --instance-template is 72251a2e-d6c5-42b4-97b0-b5f8e8d1f479
  • --subnet IDs are 0076-2249dabc-8c71-4a54-bxy7-953701ca3999 and 0767-173bn4aa-060b-47e7-am45-b3395a593897
  • --membership-count is 1 initially

For this example, you see a response similar to the following output:

ID                  r006-4f7d0010-33f5-40bf-9f21-ab5bee04fd71
Name                my-instance-group
Status              healthy
Instances           1
Instance Template   72251a2e-d6c5-42b4-97b0-b5f8e8d1f479
Subnets             Name       Subnet ID
                    subnet-1   0076-2249dabc-8c71-4a54-bxy7-953701ca3999
                    subnet-2   0767-173bn4aa-060b-47e7-am45-b3395a593897

Resource group      ID                                 Name
                    11caaa983d9c4beb82690daab08717e9   Default

For more examples of the ibmcloud is instance-group-create command, see the VPC CLI reference.

Need more help? You can always run ibmcloud is instance-group-create --help to display help for creating an instance group.

Creating an instance group manager

Now you can create an instance group manager so that you can apply your scaling policies in the next and final task. Before you can run the ibmcloud is instance-group-manager-create command, you need to determine values for the command options, such as what instance group you want to manage.

Gather the following information.

Required instance group manager details
Instance group manager option Description
INSTANCE_GROUP ID of the instance group you created in the previous task
--max-members The maximum number of members in a managed instance group; range 1 - 100

After you know these values, use them to run the instance-group-manager-create command.

ibmcloud is instance-group-manager-create INSTANCE_GROUP --max-members MAX_MEMBERS

For example, if you create an instance group manager with instance group ID 72251a2e-d6c5-42b4-97b0-b5f8e8d1f479 and options --max-members = 20, your instance-group-manager-create command would look similar to the following sample.

ibmcloud is instance-group-manager-create 72251a2e-d6c5-42b4-97b0-b5f8e8d1f479 --max-members 20

Where:

  • INSTANCE_GROUP is 72251a2e-d6c5-42b4-97b0-b5f8e8d1f479
  • --max-members is 20

For this example, you see a response similar to the following output:

ID                     r006-bcf54494-f63a-41a7-8368-9f7d002c9020
Status                 enabled
Max Membership Count   20

For more examples of the ibmcloud is instance-group-manager-create command, see the VPC CLI reference.

Need more help? You can always run ibmcloud is instance-group-manager-create --help to display help for creating an instance group manager.

Creating scaling policies

Now you're ready to take full advantage of autoscaling! For the dynamic scaling method, you define certain metrics like CPU utilization percent and the target utilization that you want to achieve for that metric. Together, the metric and the average target utilization determine when your instance group needs to dynamically add or remove virtual server instances from your group. This target value defines when the auto scale manager needs to scale up instances or scale down instances in your group. At the end of each aggregation window, the auto scale manager adds the current utilization of each instance and divides it by the target utilization value that you specify to determine the membership count.

Before you can run the group-manager-policy-create command, you need to specify an instance group and a group manager, then specify values for the metric type and the average target utilization.

Gather the following information.

Required instance group manager policy details
Instance group manager policy option Description
INSTANCE_GROUP ID of the instance group
MANAGER ID of the manager
--metric-type The type of metric to be evaluated: cpu (utilization percent), memory (utilization percent), network_in (Mbps), network_out (Mbps)
--metric-value The metric target value to be evaluated

Use the following commands to determine the required information for creating a new instance template.

  1. List the available instance groups for creating your scaling policy.

    ibmcloud is instance-groups
    

    For this example, you see a response similar to the following output:

    ID                                          Name                     Status           Instances
    72251a2e-d6c5-42b4-97b0-b5f8e8d1f479        my-instance-group        healthy          1
    72271a2e-d6c7-64b6-99c7-ac7426ew3495        my-other-instance-group  healthy          1
    
    
  2. List the available instance groups managers for creating your scaling policy.

    ibmcloud is instance-group-managers 72251a2e-d6c5-42b4-97b0-b5f8e8d1f479
    

    Where:

    • INSTANCE_GROUP is 2251a2e-d6c5-42b4-97b0-b5f8e8d1f479

    For this example, you see a response similar to the following output:

    ID                                          Status    Aggregation Window   Cooldown   Max Membership Count   Min Membership Count
    72b27b5c-f4b0-48bb-b954-5becc7c1dcb3        enabled   90                   300        20                     1
    
    

After you know these values, run the following command to create a scaling policy.

ibmcloud is instance-group-manager-policy-create INSTANCE_GROUP MANAGER --metric-type METRIC_TYPE --metric-value METRIC_VALUE

For example, if you create a scaling policy with instance group ID 72251a2e-d6c5-42b4-97b0-b5f8e8d1f479 and manager ID 72b27b5c-f4b0-48bb-b954-5becc7c1dcb3 with options --metric-type cpu and --metric-value = 50, your ibmcloud is instance-group-manager-policy-create command would look similar to the following sample.

ibmcloud is instance-group-manager-policy-create 2251a2e-d6c5-42b4-97b0-b5f8e8d1f479 72b27b5c-f4b0-48bb-b954-5becc7c1dcb3 --metric-type cpu --metric-value 50

Where:

  • INSTANCE_GROUP is 2251a2e-d6c5-42b4-97b0-b5f8e8d1f479
  • MANAGER is 72b27b5c-f4b0-48bb-b954-5becc7c1dcb3
  • --metric-type is cpu
  • --metric-value is 50

For this example, you see a response similar to the following output:

ID             r006-5f5c1127-da5c-4c7a-a8ae-9a539b56fa56
Metric Type    cpu
Metric Value   50
Policy Type    target

The response indicates that the auto scale manager needs to scale up the number of instances in your group when the average CPU utilization reaches 50 percent. Likewise, the auto scale manager also scales down the number of instances in your group when the average CPU utilization drops to less than 50 percent.

For more examples of the ibmcloud is instance-group-manager-policy-create command, see the VPC CLI reference.

You can define more than one target metric policy, but only one policy for each type of metric. Need more help? You can always run ibmcloud is instance-group-manager-policy-create --help to display help for creating a scaling policy.

Next steps

You can use IBM Cloud Activity Tracker to find specific details that are related to instance group events. For more information, see Instance group events.