IBM Cloud Docs
Bulk provisioning instances with instance groups

Bulk provisioning instances with instance groups

You can provision a large number of virtual server instances at the same time by using the IBM Cloud command-line interface to create an instance group.

Before you begin

  1. Make sure that you completed set up for your IBM Cloud® CLI environment and your IBM Cloud VPC.
  2. Make sure that you have the required IBM Cloud Identity and Access Management (IAM) permissions to create instance group resources. For more information, see Required permissions for VPC resources.
  3. Make sure that you have created an instance template with the instance details that are used to provision like instances in your group.

Creating an instance group

When you have an instance template created, you can proceed with creating an instance group. When you create the instance group, you can specify 0-1000 for the membership count. The membership count determines how many instances are provisioned in the instance group.

If you want to include a load balancer for your instance group to balance incoming requests across instances, you must create the load balancer before you create the instance group. For more information, see About application load balancers. If you attach a load balancer to your instance group, you are limited to a membership count of 50.

Gather the following information before running the ibmcloud is instance-group-create command.

Table 2. Required instance group details
Instance group details Description
Instance template ID of the instance template that you want to use. You can list templates with the ibmcloud is instance-templates command.
Subnet IDs Comma separated IDs of subnets that you want to use from the ibmcloud is subnets command.
--membership-count Number of instances that you want to provision 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 0738-c3809e5b-8d48-4629-b258-33d5b14fa84f and 100 members, your instance-group-create command would look similar to the following sample.

ibmcloud is instance-group-create my-instance-group --instance-template 0738-c3809e5b-8d48-4629-b258-33d5b14fa84f --subnet-ids 0076-2249dabc-8c71-4a54-bxy7-953701ca3999,0767-173bn4aa-060b-47e7-am45-b3395a593897 --membership-count 100

Where:

  • INSTANCE_GROUP_NAME is my-instance-group
  • --instance-template is 0738-c3809e5b-8d48-4629-b258-33d5b14fa84f
  • --subnet IDs are 0076-2249dabc-8c71-4a54-bxy7-953701ca3999 and 0767-173bn4aa-060b-47e7-am45-b3395a593897
  • `--membership-count is 100

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

ID                  r006-4f7d0010-33f5-40bf-9f21-ab5bee04fd71   
Name                my-instance-group   
Status              healthy   
Instances           100
Instance Template   0738-c3809e5b-8d48-4629-b258-33d5b14fa84f   
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.

Next steps

After your instance group is created with the number of instances you need, you can use the following commands to manage the instance group and the instance memberships of the group.

Table 2. CLI commands for managing instance groups
Instance group command Description
ibmcloud is instance-group-update Update an instance group.
ibmcloud is instance-group-delete Delete instance groups.
ibmcloud is instance-group-membership View details of a member of an instance group.
ibmcloud is instance-group-membership-delete Delete membership for an instance group.
ibmcloud is instance-group-memberships List all members for an instance group.
ibmcloud is instance-group-memberships-delete Delete all memberships for an instance group.

Optionally, you can set auto scaling policies for your instance group to dynamically add or remove virtual server instances from your group. For more information, see Creating an instance group for auto scaling.