Working with Instance Pools
Instance pools simplify the management of compute instances. An instance pool defines a set of compute instances that is managed as a group. Managing instances as a group enables you to efficiently provision instances and manage the state of instances.
In addition to provisioning or removing instances or stopping or starting instances by manually updating the instance pool, you can configure a pool to be scaled automatically according to a schedule. See Using Schedule-Based Autoscaling.
Creating an Instance Pool
An instance pool is a group of compute instances within the same region.
Performing operations such as reset or terminate on the pool object performs that operation on all instances that are members of the pool. Performing these operations on an individual instance that is a member of the pool does not affect any other member instances.
Creating an instance pool requires an instance configuration and a placement configuration. Instances that are added to the pool in a pool update can be created with different instance and placement configurations.
For instances in a pool, the value of the displayName
property in the
instance configuration is ignored. Instances in a pool are named
inst-aaaaa-pool_name
, where
aaaaa
is five random alphanumeric characters.
Placement Configuration
In addition to an instance configuration, pool creation requires a placement configuration. Values specified in a placement configuration override values specified in the instance configuration.
A placement configuration can specify fault domains, primary subnet, and secondary VNIC subnets.
Fault Domains
If you do not specify a fault domain in either the instance configuration or the placement configuration, the system automatically selects the best fault domains for the pool instances. If you specify only a single fault domain, all instances will be placed in only that fault domain. If you specify more than one fault domain, pool instances are placed in those fault domains evenly, providing better High Availability for the pool. If one fault domain cannot accommodate additional instances, instance creation stops. The system will not place more instances in one fault domain than in another fault domain.
If some instances cannot launch because of resource constraints, those instances remain in
the Provisioning state and the pool remains in the Scaling state. Once size
instances are launched, the pool can transition to the Running state. While the pool is in the
Scaling state, pool instances that are in the Running state are available to use.
The following are examples of actions you can take if a pool instance fails to launch because of resource constraints:
-
Update the pool and reduce the "Number of instances" or
size
value. -
Update the pool and change the Fault Domains specification in the Compute Web UI or in a new instance or placement configuration.
-
Update the pool to specify a new instance configuration that creates instances that require fewer resources.
-
Stop an instance that is not a member of a pool in the same fault domain where the pool instance is failing to launch because of resource constraints.
-
Terminate an instance that is not a member of a pool in the same fault domain where the pool instance is failing to launch because of resource constraints.
Using the Compute Web UI
-
In the navigation menu, click Compute, and then click Instance Configurations.
-
If the instance configuration that you want to use to create this pool is not listed, use the Compartment drop-down menu above the instance configurations list to select the correct compartment.
-
Click the instance configuration that you want to use for the instances in this pool.
-
In the Resources box on the instance configuration details page, click Attached Instance Pools. Use the Compartment drop-down menu above the instance pools list to list pools in other compartments.
Click the Create Instance Pool button.
-
In the Attach Instance Pool to
instance_configuration_name
dialog, enter the following information:-
Name: Enter a name for the instance pool. The name does not need to be unique. This name is used in the names of the created instances. If you do not provide a name for the pool, the default name of the instance pool is
instancepoolYYYYMMDDhhmmss
, whereYYYYMMDDhhmmss
is the creation date and time. -
Create in Compartment: Select a compartment for this instance pool definition. Note that the instances in the pool will be created in the compartment that is specified in the instance configuration.
-
Number of instances: Specify the number of instances to create in this instance pool.
-
Pool Placement: Select the Fault Domains, VCN, and Subnet for instances in this instance pool. You can select a different compartment from which to choose the VCN and Subnet. See the descriptions of Placement Configuration and Fault Domains at the beginning of this section.
-
Load Balancers: Click the Attach Load Balancers box to specify load balancing for this pool. For information about load balancing, see Load Balancer as a Service. Provide the following information:
-
Select the load balancer to attach to this pool.
-
Select the backend set to which to add these pool instances.
-
Enter the port number on the instances to which the load balancer must direct traffic.
-
Select the VNIC to use when adding the instance to the backend set. The private IP address is used.
To attach another load balancer, click the Add Load Balancer button. To attach a load balancer after the instance pool is created, see Managing Instance Pool Load Balancer Attachments.
-
-
Tagging: (Optional) Add defined or free-form tags for this instance pool as described in Adding Tags at Resource Creation. Tags can also be applied later.
These tags are applied to the pool definition, not to the member instances.
-
-
Click the Create Instance Pool button in the dialog.
The details page of the new pool is displayed. The requested instances are listed in the Attached Instances table in the Resources section as they are created. The new instances are named
inst-aaaaa-pool_name
, whereaaaaa
is five random alphanumeric characters. If you change the name of the pool and then add new instances to the pool, the new instances will have the new name.Click Work Request(s) in the Resources box to check the status of the instance pool create.
Using the OCI CLI
-
Get the following information:
-
The OCID of the compartment where you want to create the instance pool definition:
oci iam compartment list
Note that the instances in the pool will be created in the compartment that is specified in the instance configuration.
-
The OCID of the instance configuration that you want to use:
oci compute-management instance-configuration list
-
The size of the instance pool. This is the number of compute instances in the instance pool.
-
If you want load balancing for this pool, get the following information:
-
OCID of the load balancer to attach to this pool and name of the backend set to which to add these pool instances:
oci lb load-balancer list
-
Port value to use when creating the backend set.
-
VNIC to associate with the load balancer. The value can be
PrimaryVnic
or the display name of one of the secondary VNICs on the instance configuration that is associated with the instance pool.
-
-
-
Construct an argument for the
--placement-configurations
option.See the descriptions of Placement Configuration and Fault Domains at the beginning of this section.
Use the following command to show the content of the placement configurations argument:
$ oci compute-management instance-pool create \ --generate-param-json-input placement-configurations
-
If you want load balancing for this pool, construct an argument for the
--load-balancers
option.Use the following command to show the content of the load balancers argument:
$ oci compute-management instance-pool create \ --generate-param-json-input load-balancers
To attach a load balancer after the instance pool is created, see Managing Instance Pool Load Balancer Attachments.
-
Run the instance pool create command.
Syntax:
oci compute-management instance-pool create -c compartment_OCID \ --instance-configuration-id instance_configuration_OCID \ --placement-configurations file://placement_configuration.json \ --size number_of_instances
Example:
$ oci compute-management instance-pool create \ --compartment-id ocid1.compartment.unique_ID \ --display-name support-pool \ --instance-configuration-id ocid1.instanceConfiguration.unique_ID \ --placement-configurations file://./placement_configurations.json \ --load-balancers file://./load_balancers.json --size 10
The value of the
--display-name
option is the name of the pool. The pool name is not required to be unique. If you do not provide a value for the--display-name
option, the default name of the instance pool isinstancepoolYYYYMMDDhhmmss
, whereYYYYMMDDhhmmss
is the creation date and time.The pool name is used in the names of the instances. Instances in a pool are named
inst-aaaaa-pool_name
, whereaaaaa
is five random alphanumeric characters. If you change the name of the pool and then add new instances to the pool, the new instances will have the new name.The output of this command is the same as the output of the
instance-pool get
command. The list of instances in the pool is not shown.To list the instances that belong to this pool, use the following command:
$ oci compute-management instance-pool list-instances -c compartment_OCID \ --instance-pool-id instance_pool_OCID
The output for each instance is abbreviated compared with the output from the
instance get
command.The following command shows the same abbreviated output for only the specified instance:
$ oci compute-management instance-pool-instance get --instance-id ocid1.instance.unique_ID \ --instance-pool-id ocid1.instancePool.unique_ID
Using Schedule-Based Autoscaling
Autoscaling instance pools enables you to effectively manage instance resource use.
An instance pool can have an autoscaling configuration and policies that scale the instance pool in the following ways according to a schedule:
-
Scale out: add instances
-
Scale in: remove instances
-
Lifecycle or power action: stop, start, or reboot instances
When an instance pool scales out or scales in, instances are created or terminated as described in Updating an Instance Pool.
Policies define the schedule for autoscaling and the specific actions to take. An autoscaling configuration can have up to 50 schedule-based autoscaling policies, each with a different schedule and target pool size or lifecycle action. An instance pool can have only one autoscaling configuration.
If you manually change the pool size or lifecycle state as described in Updating an Instance Pool and Stopping and Starting Instances in an Instance Pool, autoscaling resets the pool size or lifecycle state to the value that is set in the policy the next time the scheduled autoscaling policy runs.
Note:
To use autoscaling, ensure that you have installed OCI CLI 3.15.1 or newer and Oracle Cloud Infrastructure Python SDK 2.80.0 or newer.
Multiple Schedule Management
When you create and enable an autoscaling configuration, the Autoscaling service evaluates the schedule rules in the policies in the configuration.
If multiple policies in the same configuration run at the same time, only one lifecycle state policy and one pool size policy will run. The lifecycle state policy runs first.
If multiple lifecycle state policies in the same configuration run at the same time, the policy with the highest priority action runs. The following list shows actions in priority order from highest to lowest priority:
-
Force Reboot
-
Reboot
-
Start
-
Force Stop
If multiple pool size policies in the same configuration run at the same time, the policy that specifies the largest pool size runs.
Creating an Autoscaling Configuration
An autoscaling configuration contains policies that schedule adding or removing instances in a specified pool, or stopping, starting, or rebooting all the instances in the pool.
Using the Compute Web UI
-
In the navigation menu, click Compute, and then click Autoscaling Configurations.
-
Click the Create Autoscaling Configuration button.
-
In the Create Autoscaling Configuration dialog, enter the following information:
-
Name: Enter a name for the autoscaling configuration.
-
Create in Compartment: Select the compartment where you want to create the autoscaling configuration.
-
Instance Pool: Select the instance pool that you want to scale with this autoscaling configuration.
-
Autoscaling Policies: For each policy, provide the following information:
-
Action To Perform: Select either Change Lifecycle State or Scale Pool Size.
-
Policy Name: Enter a name for the policy.
-
Lifecycle Action: If you selected Change Lifecycle State for Action To Perform, then select one of the following states to which to transition all instances of the pool when this policy is executed: Start, Stop, Soft Reset, Reset.
-
Instance Pool Limit: If you selected Scale Pool Size for Action To Perform, then enter a value for the pool size.
-
Enable Schedule: By default, the Schedule Enabled box is selected to enable the policy to execute at the next scheduled time. Uncheck the box to disable this policy.
-
Policy Schedule: Enter values for Minute, Hour, Day Of Month, Month, Day Of Week, and Year. Provide all schedule times in UTC. For more information, see Creating a Schedule-Based Autoscaling Policy.
To add another policy, click the Add Policy button. You can also add policies after the autoscaling configuration is created, as described in Creating a Schedule-Based Autoscaling Policy.
To delete a policy, click the trash can icon for that policy.
-
-
Tagging: (Optional) Add defined or free-form tags for this instance as described in Adding Tags at Resource Creation. Tags can also be applied later.
-
Click Submit.
The details page for the new autoscaling configuration is displayed.
On the details page, ignore the Cooldown Period value. Cooldown period does not apply to schedule-based autoscaling configurations.
The new autoscaling configuration is enabled by default. To disable the configuration, see Updating an Autoscaling Configuration.
-
Using the OCI CLI
-
Get the following information:
-
The OCID of the compartment where you want to create this autoscaling configuration:
oci iam compartment list
-
The OCID of the instance pool that will be managed by this autoscaling configuration:
oci compute-management instance-pool list
-
-
Construct a file that contains all the input for the command.
Use the following command to show the content and format of the command input:
$ oci autoscaling configuration create \ --generate-full-command-json-input > autoscalingCfgCreate.json
The
resource
property is required and is the OCID of the instance pool that will be managed by this autoscaling configuration. Thetype
of this resource must beinstancePool
.At least one policy is required to create an autoscaling configuration. To add policies after the autoscaling configuration is created, see Creating a Schedule-Based Autoscaling Policy.
The optional display name is 1-255 characters, does not need to be unique, and can be updated. If you do not provide a value for
-displayName
, the default name of the autoscaling configuration isautoscalingConfigurationYYYYMMDDhhmmss
, whereinstanceconfigurationYYYYMMDDhhmmss
is the creation date and time.The autoscaling configuration is enabled by default. To disable the configuration, set
isEnabled
tofalse
.Note:
Do not specify values for
coolDownInSeconds
orcapacity
min
ormax
. These properties do not apply to schedule-based autoscaling configurations.The default values for
cool-down-in-seconds
andcapacity
min
andmax
appear in the created autoscaling configuration but are not used for schedule-based autoscaling.The following is an example autoscaling configuration create input file with one policy:
{ "compartmentId": "ocid1.compartment.unique_ID", "displayName": "salesPoolCfg", "policies": { "displayName": "reboot policy", "executionSchedule": { "expression": "0 0 2 ? * 1#1 *", "timezone": "UTC", "type": "cron" }, "policyType": "scheduled", "resourceAction": { "actionType": "power", "action": "SOFTRESET" } }, "resource": { "id": "ocid1.instancePool.unique_ID", "type": "instancePool" } }
-
Run the command to create the autoscaling configuration.
Syntax:
oci autoscaling configuration create --compartment-id compartment_OCID \ --from-json file://input_file.json
Example:
$ oci autoscaling configuration create --c ocid1.compartment.unique_ID \ --from-json file://./salesPoolCfg.json { "data": { "compartment-id": "ocid1.compartment.unique_ID", "cool-down-in-seconds": 300, "defined-tags": {}, "display-name": "salesPoolCfg", "freeform-tags": {}, "id": "ocid1.autoScalingConfiguration.unique_ID", "is-enabled": true, "max-resource-count": null, "min-resource-count": null, "policies": { "capacity": null, "displayName": "reboot policy", "executionSchedule": { "expression": "0 0 2 ? * 1#1 *", "timezone": "UTC", "type": "cron" }, }, "id": "unique_ID", "is-enabled": true, "policy-type": "scheduled", "resourceAction": { "actionType": "power", "action": "SOFTRESET" }, "time-created": "2023-01-25T21:28:56.131801+00:00" }, "resource": { "id": "ocid1.instancePool.unique_ID", "type": "instancePool" }, "time-created": "2023-01-25T21:28:56.140747+00:00" }, "etag": "7c70532a-1d41-4861-a40f-bf840136a9c5" }
Use the
work-requests work-request get
command to check the status of the autoscaling configuration creation.
Creating a Schedule-Based Autoscaling Policy
An autoscaling policy is part of an autoscaling configuration. Each policy of a schedule-based autoscaling configuration has a schedule and either a target pool size or a lifecycle action.
The procedures in this section describe how to create policies separate from creating the autoscaling configuration.
Designing Policies
This section provides some tips for designing and troubleshooting policies.
Create two separate policies to scale a pool in and out or to change the state of the pool between stopped and running.
-
Scale example: One policy specifies a larger size for the pool at the beginning of a high demand period, and a second policy specifies a smaller pool size at the end of the high demand period.
-
State example: One policy stops all instances in the pool at the beginning of a regular compute node maintenance period, and a second policy starts the pool at the end of the maintenance period.
Design the policy schedule as follows:
-
Use
cron
expressions. Autoscaling uses a cron implementation similar to the Quartz cron implementation. All fields require a value. If fields conflict, such as day of month and day of week, use a specific value for one and a question mark for the other. -
Provide all schedule times in UTC.
-
Use an online
cron
expression generator such as Cron Expression Generator & Explainer - Quartz to verify your schedule expressions. -
Ensure that policy schedules do not conflict. See the descriptions in Multiple Schedule Management of which policies run when schedules conflict.
Take the following steps if a policy fails to run, or appears to fail to run:
-
Check that the autoscaling configuration and autoscaling policy are both enabled.
-
Check the schedule expression. Is the policy set to run when you meant for it to run? Remember, all expression times must be provided in UTC.
-
Was the policy set to start instances that were already running, or stop instances that were already stopped?
In addition to a policy conflict, a power action might have been performed on the pool separate from any autoscaling policy. That separate power action could prevent the policy action from succeeding. The policy power action will not be retried.
-
Was the policy set to scale out, but not enough resources were available?
The scale policy sets the pool size, and the pool will continue to attempt to reach that size as resources become available.
-
Is the operation specified by the policy still executing or waiting to execute?
-
Check whether the pool is in the Scaling, Starting, Stopping, or Rebooting state, which indicates that the policy operation is still running.
-
If a state change operation attempts to run while a state change operation is already running on the same pool, the second operation will fail to run.
-
A limited number of pools can be changing state concurrently. If too many other pools are already changing state, then your pool will need to wait to begin changing state. The time to change state is longer when more instances are involved since instances are started, stopped, or rebooted serially.
-
A limited number of pools can be changing size concurrently. If other pools are already changing size, your pool might need to wait to begin scaling. The time to scale is longer when more instances are involved since instances are terminated or created serially. Terminating and creating instances are both background operations and take some time to begin after the pool size has been updated by the policy.
-
Using the Compute Web UI
-
In the navigation menu, click Compute, and then click Autoscaling Configurations.
-
If the configuration to which you want to add a policy is not listed, use the Compartment drop-down menu above the autoscaling configurations list to select the correct compartment.
-
Click the name of the autoscaling configuration to which you want to add a policy.
-
On the autoscaling configuration details page, scroll to the Resources section, click Autoscaling Policies, and click the Create Scheduled Policy button.
-
In the Create policy dialog, enter the following information:
-
Name: Enter a name for the new autoscaling policy.
-
Action to perform: Select Scale pool size or Change lifecycle state of all instances.
-
Scale pool size: Enter the number of instances that the pool should scale to at the scheduled time.
-
Change lifecycle state of all instances: Select the state that all instances in the pool should transition to at the scheduled time.
-
Enable Schedule: By default, the Schedule Enabled box is selected to enable the policy to execute at the next scheduled time. Uncheck the box to disable this policy.
-
-
Execution schedule: Define the schedule for implementing this autoscaling policy. See Designing Policies.
-
-
Click the Submit button.
Using the OCI CLI
-
Get the OCID of the autoscaling configuration where you want to add this autoscaling policy:
oci autoscaling configuration list
-
Construct a file that contains the policy definitions.
Use the following command to show the content and format of the file:
$ oci autoscaling policy create \ --generate-full-command-json-input > autoscalingPolicyCreate.json
Note:
Do not specify values for
capacity
min
ormax
. These properties do not apply to schedule-based autoscaling configurations.The default values for
capacity
min
andmax
appear in the created autoscaling policy but are not used for schedule-based autoscaling.The display name is 1-255 characters, does not need to be unique, and can be updated.
Use the references in Designing Policies for help with setting the policy execution schedule. The
timezone
must beUTC
and thetype
must becron
.The policy is enabled by default.
The policy type must be
scheduled
.The resource action type must be
power
, and the action must be one ofSTOP
,START
,SOFTRESET
,RESET
.The following is an example autoscaling policy create input file:
{ [ { "capacity": { "initial": 10 }, "displayName": "size 10", "executionSchedule": { "expression": "0 0 10 ? 1 2#2 *", "timezone": "UTC", "type": "cron" }, "isEnabled": true, "policyType": "scheduled" }, "capacity": { "initial": 30 }, "displayName": "size 30", "executionSchedule": { "expression": "0 0 7 ? 11 5#1 *", "timezone": "UTC", "type": "cron" }, "isEnabled": true, "policyType": "scheduled" }, { "displayName": "stop policy", "executionSchedule": { "expression": "0 0 7 ? JAN,APR,JUL,OCT 4#3 *", "timezone": "UTC", "type": "cron" }, "isEnabled": true, "policyType": "scheduled", "resourceAction": { "actionType": "power", "action": "STOP" } }, { "displayName": "start policy", "executionSchedule": { "expression": "0 0 13 ? JAN,APR,JUL,OCT 4#3 *", "timezone": "UTC", "type": "cron" }, "isEnabled": true, "policyType": "scheduled", "resourceAction": { "actionType": "power", "action": "START" } } ] }
-
Run the command to create new policies for the specified autoscaling configuration.
Syntax:
oci autoscaling policy create \ --auto-scaling-configuration-id autoscaling_configuration_OCID \ --from-json file://policy_definitions.json --policy-type scheduled
Example:
$ oci autoscaling policy create \ --auto-scaling-configuration-id ocid1.autoscalingConfiguration.unique_ID \ --from-json file://./salesPoolPolicies.json --policy-type scheduled
Use the
work-requests work-request get
command to check the status of the autoscaling policy create command.
Updating an Autoscaling Configuration
You can change the display name of the autoscaling configuration, the tags, and whether the autoscaling configuration is enabled.
To add policies to an autoscaling configuration or update existing policies, see Creating a Schedule-Based Autoscaling Policy and Updating a Schedule-Based Autoscaling Policy.
Using the Compute Web UI
-
In the navigation menu, click Compute, and then click Autoscaling Configurations.
-
If the autoscaling configuration that you want to update is not listed, use the Compartment drop-down menu above the autoscaling configurations list to select the correct compartment.
-
For the autoscaling configuration that you want to update, click the Actions menu and click Edit.
-
In the Update Autoscaling Configuration dialog, make the changes. Ignore the Cooldown Period value.
-
Click the Submit button.
Using the OCI CLI
-
Get the OCID of the autoscaling configuration that you want to update:
oci autoscaling configuration list
-
Run the update command.
Example:
$ oci autoscaling configuration update \ --auto-scaling-configuration-id ocid1.autoscalingConfiguration.unique_ID \ --is-enabled false
Use the
work-requests work-request get
command to check the status of the update operation.
Updating a Schedule-Based Autoscaling Policy
These procedures describe how to update the specified autoscaling policy in the specified autoscaling configuration. You can update the policy display name, either the target pool size or the lifecycle action, and the execution schedule. You can enable or disable the policy.
Using the Compute Web UI, you can delete the policy or add a new policy. To add or delete a policy using the OCI CLI, see Creating a Schedule-Based Autoscaling Policy and Deleting an Autoscaling Policy.
Using the Compute Web UI
-
In the navigation menu, click Compute, and then click Autoscaling Configurations.
-
If the configuration for which you want to update a policy is not listed, use the Compartment drop-down menu above the autoscaling configurations list to select the correct compartment.
-
Click the name of the autoscaling configuration for which you want to update a policy.
-
On the autoscaling configuration details page, scroll to the Resources section and click Autoscaling Policies.
-
For the policy that you want to update, click the Actions menu and then click Edit.
-
In the Update Policy dialog, change the policy information.
-
Click the Submit button.
Using the OCI CLI
-
Get the following information:
-
The OCID of the autoscaling configuration from which you want to remove this autoscaling policy:
oci autoscaling configuration list
-
The ID of the autoscaling policy within that autoscaling configuration:
oci autoscaling configuration get
-
-
Construct a file that contains the updated policy definition.
Use the following command to show the content and format of the file:
$ oci autoscaling policy update \ --generate-full-command-json-input > autoscalingPolicyUpdate.json
See Creating a Schedule-Based Autoscaling Policy for information about policy properties.
-
Run the autoscaling policy update command.
Syntax:
oci autoscaling policy update \ --auto-scaling-configuration-id autoscaling_configuration_OCID \ --auto-scaling-policy-id autoscaling_policy_ID \ --from-json file://policy_definition.json --policy-type scheduled
Example:
$ oci autoscaling policy update \ --auto-scaling-configuration-id ocid1.autoscalingConfiguration.unique_ID \ --auto-scaling-policy-id ID \ --from-json file://./stop_policy.json --policy-type scheduled
Use the
work-requests work-request get
command to check the status of the policy update operation.
Deleting an Autoscaling Configuration
These procedures describe how to delete the specified autoscaling configuration.
Alternatively, you could disable the configuration as described in Updating an Autoscaling Configuration.
Using the Compute Web UI
-
In the navigation menu, click Compute, and then click Autoscaling Configurations.
-
If the autoscaling configuration that you want to delete is not listed, use the Compartment drop-down menu above the autoscaling configurations list to select the correct compartment.
-
For the autoscaling configuration that you want to delete, click the Actions menu and click Delete.
Using the OCI CLI
-
Get the OCID of the autoscaling configuration that you want to delete:
oci autoscaling configuration list
-
Run the autoscaling configuration delete command.
Example:
$ oci autoscaling configuration delete \ --auto-scaling-configuration-id ocid1.autoscalingConfiguration.unique_ID --force
Use the
work-requests work-request get
command to check the status of the delete operation.
Deleting an Autoscaling Policy
These procedures describe how to delete the specified autoscaling policy in the specified autoscaling configuration.
Alternatively, you could disable the policy in the configuration as described in Updating a Schedule-Based Autoscaling Policy.
Using the Compute Web UI
-
In the navigation menu, click Compute, and then click Autoscaling Configurations.
-
If the autoscaling configuration from which you want to delete a policy is not listed, use the Compartment drop-down menu above the autoscaling configurations list to select the correct compartment.
-
Click the name of the autoscaling configuration for which you want to delete a policy.
-
On the autoscaling configuration details page, scroll to the Resources section and click Autoscaling Policies.
-
For the policy that you want to delete, click the Actions menu and then click Delete.
Using the OCI CLI
-
Get the following information:
-
The OCID of the autoscaling configuration from which you want to remove this autoscaling policy:
oci autoscaling configuration list
-
The ID of the autoscaling policy within that autoscaling configuration:
oci autoscaling configuration get
-
-
Run the autoscaling policy delete command.
Syntax:
$ oci autoscaling policy delete \ --auto-scaling-configuration-id ocid1.autoscalingConfiguration.unique_ID \ --auto-scaling-policy-id unique_ID --force
Use the
work-requests work-request get
command to check the status of the policy delete operation.
Updating an Instance Pool
When you update an instance pool, you can change the name of the pool, the size of the pool, the instance configuration that is used to create new instances, the fault domains, VCN, and subnet.
To attach or detach an instance, see Attaching an Instance to an Instance Pool and Detaching an Instance from an Instance Pool.
To attach load balancers or detach load balancer attachments, see Managing Instance Pool Load Balancer Attachments.
Configuration changes do not affect existing instances; configuration changes only affect new instances. New instances will be provisioned using the new instance configuration and placement configuration.
If you increase the size of the pool, new instances are provisioned. The new instances are launched evenly across the fault domains specified by the instance configuration or the placement configuration.
If you decrease the size of the pool, instances are terminated evenly across the fault domains specified by the instance configuration or the placement configuration. In each fault domain, instances are terminated in creation date order, oldest first.
You cannot select which instances to terminate when you decrease the size of a pool. If you terminate an individual instance that is a member of a pool, as described in Terminating an Instance, a new instance is automatically provisioned to keep the pool at the specified pool size.
If you increase the size of the pool, and some new instances cannot be provisioned because of resource constraints, those instances remain in Provisioning state and the pool remains in Scaling state until all instances are provisioned. See the suggested remedies in Creating an Instance Pool.
Using the Compute Web UI
-
In the navigation menu, click Compute, and then click Instance Pools.
-
If the instance pool that you want to update is not listed, use the Compartment drop-down menu above the instance pools list to select the correct compartment.
-
For the instance pool that you want to update, click the Actions menu, and click the Edit option.
-
In the Update Instance Pool dialog, make the changes.
-
When you are finished editing, click the Update Instance Pool button in the dialog.
Using the OCI CLI
-
Get the OCID of the instance pool that you want to update:
oci compute-management instance-pool list
-
Run the instance pool update command.
Syntax:
oci compute-management instance-pool update \ --instance-pool-id instance_pool_OCID \ options_with_values_to_update
Example:
$ oci compute-management instance-pool update \ --instance-pool-id ocid1.instancePool.unique_ID \ --instance-configuration-id new_instance_configuration_OCID --size 20
The output of this command is the same as the output of the
instance-pool get
command.
Attaching an Instance to an Instance Pool
When you attach an instance to an instance pool, the pool size increases.
Important:
If an autoscaling configuration is associated with the instance pool, then ensure that the autoscaling policy defines a target pool size that is large enough for the expanded pool. The next time the scheduled autoscaling policy runs, the target pool size is reset to the value that is set in the policy; if the policy size is smaller than the current size, instances will be deleted.
If load balancers are attached to the pool, then the instance is also added to the load balancers.
Ensure the following conditions before you attach an instance to an instance pool:
-
Both the pool and the instance to be attached are running.
-
The instance is not attached to another pool.
-
The instance is in the same fault domain as the pool.
-
The primary VNIC of the instance is in the same VCN and subnet as the pool.
-
If secondary VNICs are defined, then the secondary VNIC of the instance is in the same VCN and subnet as the secondary VNICs used by other instances in the pool.
To attach an instance that is in a fault domain that is not included in the pool instance configuration, or is using a VCN and subnet that are not specified by the pool instance configuration, first update the instance configuration, then attach the instance.
Using the OCI CLI
-
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 attach:
oci compute instance list
-
-
Run the instance pool attach instance command.
$ oci compute-management instance-pool-instance attach \ --instance-pool-id ocid1.instancePool.unique_ID \ --instance-id ocid1.instance.unique_ID
The output of this command is the same as the output of the
instance get
command. If you run theinstance-pool get
command, you see that thesize
property is incremented.
Detaching an Instance from an Instance Pool
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 OCI CLI
-
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
-
-
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 do not 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 isfalse
. -
--is-decrement-size
-
If
true
, decrement the poolsize
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. -
Managing Instance Pool Load Balancer Attachments
These procedures describe how to attach a load balancer to an instance pool or detach a load balancer attachment from an instance pool.
Using the Compute Web UI
-
In the navigation menu, click Compute, and then click Instance Pools.
-
If the instance pool for which you want to manage load balancer attachments is not listed, use the Compartment drop-down menu above the instance pools list to select the correct compartment.
-
Click the name of the pool that you want to manage.
-
On the instance pool details page, scroll to the Resources section and click Load Balancers.
-
To attach a load balancer, click the Attach Load Balancer button.
On the Attach Load Balancer dialog, specify the load balancer, backend set, port number, and VNIC as described in Creating an Instance Pool, and click the Attach Load Balancer button.
-
To remove a load balancer attachment, click the Actions menu for the load balancer attachment that you want to remove, and click Detach.
The load balancer attachment remains visible in the load balancers list in the Detached state for at least 24 hours, up to 24.5 hours. No further action is needed to detach the load balancer attachment.
-
Using the OCI CLI
-
To attach a load balancer to an instance pool:
-
Get the following information:
-
OCID of the instance pool to which you want to attach a load balancer:
oci compute-management instance-pool list
-
OCID of the load balancer and name of the backend set:
oci lb load-balancer list
-
Port value to use when creating the backend set.
-
VNIC to associate with the load balancer. The value can be
PrimaryVnic
or the display name of one of the secondary VNICs on the instance configuration that is associated with the instance pool.
-
-
Run the instance pool attach load balancer command.
Example:
$ oci compute-management instance-pool attach-lb \ --instance-pool-id ocid1.instancePool.unique_ID \ --load-balancer-id ocid1.loadbalancer.unique_ID \ --backend-set-name BES1 --port 80 --vnic-selection PrimaryVnic
-
-
To remove or detach a load balancer from an instance pool:
-
Get the following information:
-
OCID of the instance pool
-
OCID of the load balancer
-
Backend set name
-
-
Run the instance pool detach load balancer command.
Example:
$ oci compute-management instance-pool detach-lb \ --instance-pool-id ocid1.instancePool.unique_ID \ --load-balancer-id ocid1.loadbalancer.unique_ID \ --backend-set-name BES1
When you
get
orlist
the instance pool, the load balancer attachment remains visible in stateDETACHED
for at least 24 hours, up to 24.5 hours. No further action is needed to detach the load balancer attachment.
-
Stopping and Starting Instances in an Instance Pool
Performing operations such as reset or stop on the pool object performs that operation on all instances that are members of the pool. Performing these operations on an individual instance that is a member of the pool does not affect any other member instances.
When instances are stopped, compute resources are released and the instances are disconnected and unassigned from their compute nodes. When instances are started, the Compute service restarts the instances in the same fault domain that they were in when they were stopped.
Instances continue to count toward the pool size while they are stopped, and configuration of stopped pool instances is preserved. Configuration changes such as fault domain changes do not apply to pool instances that are restarted or reset.
Using the Compute Web UI
-
In the navigation menu, click Compute, and then click Instance Pools.
-
If the instance pool that you want to manage is not listed, use the Compartment drop-down menu above the instance pools list to select the correct compartment.
-
For the instance pool that you want to manage, click the Actions menu, and click the Start, Stop, or Reboot option.
By default, clicking Stop selects Soft Stop and clicking Reboot selects Soft Reboot. To stop or reboot all instances in a pool immediately, click the Force option on the confirmation dialog.
All of the instances in the pool are stopped, started, or rebooted. See Stopping, Starting, and Resetting an Instance for how to prepare for an instance to stop. Stopping and starting an instance can take up to five minutes.
-
Click the Start Instance Pool, Stop Instance Pool, or Reboot Instance Pool button on the confirmation dialog.
In the Resources section of the pool details page, click Work Request(s) to check the status of the instance pool stop, start, or reboot. Click Attached Instances to view the status of the instances.
Using the OCI CLI
-
Get the OCID of the instance pool that you want to manage:
oci compute-management instance-pool list
-
Run the instance pool stop, start, or reset command.
Syntax:
oci compute-management instance-pool {start | stop | softstop | reset | softreset} \ --instance-pool-id instance_pool_OCID
For descriptions of these commands, enter:
$ oci compute-management instance-pool -h
Example:
$ oci compute-management instance-pool reset --instance-pool-id ocid1.instancePool.unique_ID
Use the
work-requests work-request get
command to check the status of the instance pool management change.
Deleting an Instance Pool
When you delete an instance pool, the resources that were created by the pool are permanently deleted, including associated instances, attached boot volumes, and block volumes.
Using the Compute Web UI
-
In the navigation menu, click Compute, and then click Instance Pools.
-
If the instance pool that you want to delete is not listed, use the Compartment drop-down menu above the instance pools list to select the correct compartment.
-
For the instance pool that you want to delete, click the Actions menu, and click the Delete option.
-
On the confirmation dialog, click the Confirm button.
All of the instances in the pool are terminated. Terminated instances are not attached and therefore are not listed in Attached Instances in the Resources box on the pool details page.
Click Work Request(s) in the Resources box to check the status of the instance pool delete. Instances that had been attached to this pool remain visible in the instance list in state Terminated for at least 24 hours, up to 24.5 hours, as described in Terminating an Instance.
Using the OCI CLI
-
Get the OCID of the instance pool that you want to terminate:
oci compute-management instance-pool list
-
Run the instance pool terminate command.
Example:
$ oci compute-management instance-pool terminate \ --instance-pool-id ocid1.instancePool.unique_ID Are you sure you want to delete this resource? [y/N]: y { "etag": "34153f54-0cc9-4e6b-bc02-328166efbb4a", "opc-work-request-id": "ocid1.workrequest.unique_ID" }
Use the
work-requests work-request get
command to check the status of the instance pool terminate. Instances that had been attached to this pool remain visible in instancelist
orget
inlifecycle-state
TERMINATED
for at least 24 hours, up to 24.5 hours, as described in Terminating an Instance.