Creating an Instance Pool

Use instance pools to create and manage multiple compute instances within the same region as a group.

When you create an instance pool, you use an instance configuration as the template to create new instances in the pool. You can also attach existing instances to a pool by updating the pool. For background information about instance pools and instance configurations, see Managing Compute Instances with Instance Pools.

Optionally, you can associate one or more load balancers with an instance pool. If you do this, when you add an instance to the instance pool, the instance is automatically added to the load balancer's backend set  . After the instance reaches a healthy state (the instance is listening on the configured port number), incoming traffic is automatically routed to the new instance.

Instance pools are supported for virtual machine (VM) and bare metal instances.

Required IAM Policy

To use Oracle Cloud Infrastructure, you must be granted security access in a policy  by an administrator. This access is required whether you're using the Console or the REST API with an SDK, CLI, or other tool. If you get a message that you don’t have permission or are unauthorized, verify with your administrator what type of access you have and which compartment  to work in.

For administrators: For a typical policy that gives access to instance pools and instance configurations, see Let users manage Compute instance configurations, instance pools, and cluster networks.

Tagging Resources

You can add tags to your resources to help you organize them according to your business needs. You can add tags at the time you create a resource, or you can update the resource later with the desired tags. For general information about applying tags, see Resource Tags.

Distributing Instances Across Fault Domains for High Availability

By default, the instances in a pool are distributed across all fault domains in a best-effort manner based on capacity. If capacity isn't available in one fault domain, the instances are placed in other fault domains to allow the instance pool to launch successfully.

In a high availability scenario, you can require that the instances in a pool are evenly distributed across each of the fault domains that you specify. When sufficient capacity isn't available in one of the fault domains, the instance pool will not launch or scale successfully, and a work request for the instance pool will return an "out of capacity" error. To fix the capacity error, either wait for capacity to become available, or use the UpdateInstancePool operation to update the placement configuration (the availability domain and fault domain) for the instance pool.

Prerequisites

Before you can create an instance pool, you need:

  • An instance configuration. An instance configuration is a template that defines the settings to use when creating instances. When you create the instance pool, monitoring will be enabled by default on instances that support monitoring, regardless of the settings in the instance configuration. For more information, see Creating an Instance Configuration.

    Note

    You cannot create an instance pool from an instance configuration where the image source is a boot volume.
  • If you want to associate the instance pool with a load balancer, you need a load balancer and backend set. For steps to create a load balancer, see Managing Load Balancers.

Using the Console

  1. Open the navigation menu and click Compute. Under Compute, click Instance Pools.
  2. Click Create Instance Pool.

  3. On the Add Basic Details page, do the following:

    1. Select the compartment to create the instance pool in.
    2. Enter a name for the instance pool. It doesn't have to be unique, and it cannot be changed later in the Console (but you can change it with the API). Avoid entering confidential information.
    3. Select the Instance configuration that you want to use.
    4. Specify the targeted Number of instances for the instance pool.
    5. Show Tagging Options: Optionally, you can add tags. If you have permissions to create a resource, you also have permissions to add free-form tags to that resource. To add a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you are not sure whether you should add tags, skip this option (you can add tags later) or ask your administrator.
  4. Click Next.
  5. On the Configure Pool Placement page, select the location where you want to place the instances. Do the following:

    1. Select the Availability domain to launch the instances in.
    2. For the Fault domains box, do one of the following things:

      • If you want the system to make a best effort to distribute instances across fault domains based on capacity, leave the box blank.
      • If you want to require that the instances in the pool are distributed evenly in one or more fault domains, select the fault domains to place the instances in. The pool will not launch or scale successfully if sufficient capacity is unavailable in the selected fault domains. For more information, see Distributing Instances Across Fault Domains for High Availability.
    3. In the Primary VNIC section, configure the network details for the instances:

      • Virtual cloud network: The virtual cloud network (VCN) to create the instances in.
      • Subnet: A subnet within the cloud network to attach the instances to. The subnets are either public or private. Private means the instances in that subnet can't have public IP addresses. For more information, see Access to the Internet. Subnets can also be either AD-specific or regional (regional ones have "regional" after the name). We recommend using regional subnets. For more information, see About Regional Subnets.
    4. If secondary VNICs are defined by the instance configuration, a Secondary VNIC section appears. Select the secondary VCN and subnet for the instance pool.
    5. If you want the instance pool to create instances in more than one availability domain, click + Another Availability Domain. Then, repeat the previous steps.
  6. If you want to associate a load balancer with the instance pool, select the Attach a load balancer check box. Then, do the following:

    1. Select the Load balancer to associate with the instance pool.
    2. Select the Backend set on the load balancer to add instances to.
    3. In the Port box, enter the server port on the instances to which the load balancer must direct traffic. This value applies to all instances that use this load balancer attachment.
    4. In the VNIC list, select the VNIC  to use when adding the instance to the backend set. Instances that belong to a backend set are also called backend servers. The private IP address is used. This value applies to all instances that use this load balancer attachment.
    5. If you want to associate additional load balancers with the instance pool, click + Another Load Balancer. Then, repeat the previous steps. Do this for each additional load balancer you want to associate with the instance pool.

    For background information about load balancers, see Overview of Load Balancing.

  7. Click Next.
  8. Review the instance pool details, and then click Create.

    To track the progress of the operation, you can monitor the associated work request.

Using the CLI

For information about using the CLI, see Command Line Interface (CLI). To create and manage instance pools using the CLI, open a command prompt and run any of the following commands.

To create an instance pool, use the instance-pool create command:

oci compute-management instance-pool create --compartment-id, -c <COMPARTMENT_OCID> --instance-configuration-id <INSTANCE_CONFIGURATION_OCID> --placement-configurations <PLACEMENT_CONFIGURATIONS> --size <NUMBER_OF_INSTANCES>

To attach a load balancer to the instance pool, use the instance-pool attach-lb command:

oci compute-management instance-pool attach-lb --backend-set-name <NAME> --instance-pool-id <INSTANCE_POOL_OCID> --load-balancer-id <LOAD_BALANCER_OCID> --port <PORT> --vnic-selection <PrimaryVnic_OR_displayName>

To detach a load balancer to the instance pool, use the instance-pool detach-lb command:

oci compute-management instance-pool detach-lb --backend-set-name <NAME> --instance-pool-id <INSTANCE_POOL_OCID> --load-balancer-id <LOAD_BALANCER_OCID>

To update the instance pool, use the instance-pool update command:

oci compute-management instance-pool update --instance-pool-id <INSTANCE_POOL_OCID>

To terminate the instance pool, use the instance-pool terminate command:

oci compute-management instance-pool terminate --instance-pool-id <INSTANCE_POOL_OCID>

To get information about a load balancer that is attached to an instance pool, use the instance-pool lb-attachment get command:

oci compute-management instance-pool lb-attachment get --instance-pool-id <INSTANCE_POOL_OCID> --lb-attachment-id <LOAD_BALANCER_ATTACHMENT_OCID>