--- title: "Set an elastic policy" description: "Make an E2E scale group add and remove nodes as CPU use goes up and down, set how long it watches and waits, and change the policy later." content_type: "how-to" product: "auto-scaling" platform: "MyAccount" url: "/myaccount/auto-scaling/how-to/set-an-elastic-policy/" topic: ["scaling-policies"] relationships: {"requires":["/myaccount/auto-scaling/how-to/create-a-scale-group/"]} --- # Set an elastic policy An elastic policy adds one node when CPU use is above the value you set, and removes one node when it is below a second, lower value. The policy keeps the scale group between its minimum and maximum. You set the policy when you create the scale group, with **Elastic Policy** or **Elastic and Scheduled Policy** under **Select Policy**, and you can change it later on the scale group's **Scale Group Details** tab. To scale at set times instead, see [Set a scheduled policy](/myaccount/auto-scaling/how-to/set-a-scheduled-policy/). ## Before you begin - For a new scale group, you have chosen **Elastic Policy** or **Elastic and Scheduled Policy** under **Select Policy** while creating it, and your role in the current project has the create permission for Auto Scaling. See [Create a scale group](/myaccount/auto-scaling/how-to/create-a-scale-group/#choose-a-policy). - If you are changing an existing scale group, it reads **Running**, and your role has the update permission for Auto Scaling. ## Choose the parameter Keep **Policy Parameter Type** on **Default**, and pick **CPU** under **Select a policy parameter**. **Default** offers only **CPU**, so the policy scales on CPU use alone. To scale on memory or another measurement, watch it with your own monitoring and set the count with **Resize Service**, or from a script with the [as-resize operation](/api/myaccount/operations/as-resize/); see [Resize the scale group](/myaccount/auto-scaling/how-to/resize-stop-or-start-a-scale-group/#resize-the-scale-group). ## Set when a node is added and removed The policy has two rules: **Add node when**, the scale-up rule, and **Remove node when**, the scale-down rule. Each time a rule fires, the scale group adds or removes one node. For **Add node when**, choose **more than** or **more than equal to**. For **Remove node when**, choose **less than** or **less than equal to**. To make a rule fire at the value itself too, choose **more than equal to** or **less than equal to**. Both values are percentages: - **Add node when** takes a value from 30 to 99, and starts at 60 with **more than**. - **Remove node when** takes a value from 10 up to half the scale-up value, and starts at 30 with **less than**. When you type a scale-up value, the portal sets **Remove node when** to half of it, rounded down, and you can lower it from there. The CPU percentage is the node's CPU use as a share of its plan's vCPUs. For example, 60% on a four-vCPU plan means 2.4 vCPUs are busy. ## Set the watch period and cooldown The scale group adds a node when CPU use stays above the scale-up value for **Watch Period** periods in a row, each **Period durations(s)** long. It removes a node the same way, when CPU use stays below **Remove node when** for that many periods. After each scaling action, the scale group waits for **Cooldown(s)** before it scales again. - **Watch Period** is the number of periods in a row. It starts at 3. - **Period durations(s)** is the length of each period, in seconds. It starts at 10. - **Cooldown(s)** is the wait after a scaling action, in seconds. It starts at 150. Each takes any whole number from zero up. Under the fields, the portal sums up the policy in one sentence with your values in it. Read it before you save. With the starting values, once a steady load goes above the scale-up value, the scale group starts adding a node after about 4.5 minutes, and the node takes about 2.5 minutes more to be added. Removing a node takes about 20 seconds. ## Change the policy of a running scale group 1. In MyAccount, under **Compute**, click **Auto Scaling**, click your scale group, and open its **Scale Group Details** tab. You edit its settings there one at a time. 2. Click the edit button beside **Scale group policy**. **Select Policy** opens with the policy's values ready to change. 3. Choose **Elastic Policy**, **Scheduled Policy**, or **Elastic and Scheduled Policy**, and change the values, the watch period, the period duration, and the cooldown. 4. Click **Update** to save, or **Cancel** to drop the changes. Saving shows this message, where `` is your scale group's name: ```text The scaling service - - has been successfully updated. ``` The **Activity Timeline** records the change as **UPDATE_POLICY**. ## Check the policy The elastic policy's panel on **Scale Group Details** shows **Policy Parameter** and the two rules, under **Adds a node when** and **Removes a node when**. It also shows **Watch period policy**, **Duration (second)**, and **Cooldown (second)**, as you set them. When the policy adds or removes a node, the scale group's **Audit Logs** tab records it; see [Read the audit logs](/myaccount/auto-scaling/how-to/monitor-a-scale-group/#read-the-audit-logs). To see the nodes running now, open **Active Node Details**. Your scale group now scales on CPU use. To also scale at set times, see [Set a scheduled policy](/myaccount/auto-scaling/how-to/set-a-scheduled-policy/). To remove every node for a while, see [Stop the scale group](/myaccount/auto-scaling/how-to/resize-stop-or-start-a-scale-group/#stop-the-scale-group). If the scale group scales differently from what you expect, see [Troubleshooting Auto Scaling](/myaccount/auto-scaling/troubleshooting/auto-scaling/#the-scale-group-does-not-add-or-remove-nodes).