Detaching an Instance from an Instance Pool

On Compute Cloud@Customer, when you detach an instance from a pool, you can choose whether to delete the instance or to retain the instance separate from the pool. You can also choose whether to replace the detached instance by creating a new instance in the pool. If you don't replace the detached instance, then the pool size is decremented.

If load balancers are attached to the pool, then the instance is removed from the load balancers.

Using the CLI

Use the oci compute-management instance-pool-instance detach command and required parameters to detach an instance from an instance pool.

For a complete list of CLI commands, flags, and options, see the Command Line Reference.

Procedure

  1. Get the information you need to run the command.

    • OCID of the instance pool that you want to update: oci compute-management instance-pool list

    • OCID of the instance that you want to detach: oci compute-management instance-pool list-instances

  2. Run the instance pool detach instance command.

    Syntax:

    oci compute-management instance-pool-instance detach \
    --instance-pool-id instance_pool_OCID --instance-id instance_OCID \
    --is-auto-terminate [true|false] --is-decrement-size [true|false]

    Provide the following options if you don't want the default behavior:

    --is-auto-terminate

    If true, permanently terminate (delete) the instance and its attached boot volume when the instance is detached from the instance pool. The default value is false.

    --is-decrement-size

    If true, decrement the pool size when the instance is detached from the instance pool. This is the default.

    If false, provision a new, replacement instance using the pool’s instance configuration after the existing instance is detached from the instance pool. The pool size remains the same as it was before you performed this detach operation.

    Example:

    In the following example, the specified instance is detached from the pool and terminated, and a new instance is provisioned for the pool.

    $ oci compute-management instance-pool-instance detach \
    --instance-pool-id ocid1.instancePool.unique_ID \
    --instance-id ocid1.instance.unique_ID \
    --is-auto-terminate true --is-decrement-size false

    The output of this command is the same as the output of the instance-pool get command.