Create AutoStopping Rules for Azure
- Before You Begin
- Step 1: Add a Cloud Provider
- Step 2: Add a New AutoStopping Rule
- Step 1: Define an AutoStopping Rule
- Step 2: Select the Resources to be Managed by the AutoStopping Rule
- Step 3: Select the Instance Fulfillment Type
- (Optional) Step 4: Set Up Advanced Configuration
- Setup Access Using DNS Link
- Setup Access Using SSH/RDP
AutoStopping Rules make sure that your non-production resources run only when used, and never when idle. It also allows you to run your workloads on fully orchestrated spot instances without any worry of spot interruptions.
In this topic:
Before You Begin
- Create an Azure Connector for Autostopping Rules
- Create a Kubernetes Connector for AutoStopping Rules
- AutoStopping Rules Overview
- Ensure that you have Azure on-demand VMs created
- Make sure that you have the Application Administrator role assigned for your Azure AD. Users in this role can create and manage all aspects of enterprise applications, application registrations, and application proxy settings. See Application Administrator
- Many Azure CLI commands act within a subscription. Ensure that you have selected the right subscription before executing the commands. If you need to switch the subscription, use the following command:
az account set -s <
For more information, see Manage Subscriptions
- Permissions to create an application gateway:
- A dedicated subnet with no other resources
- A public IP belonging to the same VPN as the application gateway
- SKU : Basic for V1 Application gateway and Standard for V2 application gateway
- Type : Static or Dynamic
- Permissions to create Azure function and a dedicated storage account
- SSL certificate in *.pfx format to support HTTPS traffic if required. You can use a wild card certificate or specific to the domain certificate
Step 1: Add a Cloud Provider
Perform the following steps to link your Azure cloud account to Harness.
- In Cloud Costs, click New AutoStopping Rule.
- In AutoStopping Rules, select Azure. It is the cloud account in which your workloads are running that you want to manage using AutoStopping rules.
- If you have already linked your Azure account and want to use that account, then select the Azure account from Connect to your Azure account drop-down list.
- If you have not added your cloud account, click + Link a new Azure account. For the detailed steps, see Connect to an Azure Connector.
Step 2: Add a New AutoStopping Rule
Perform the following steps to add a new AutoStopping rule for Azure:
- Configuration: In this step, do the following:
- Setup Access: In this step, do the following:
- Review: Verify the configurations.
Step 1: Define an AutoStopping Rule
Perform the following steps to get started with AutoStopping Rule.
- In Cloud Costs, in AutoStopping Rules, click New AutoStopping Rule.
- In the cloud account type, select Azure. It is the cloud account in which your workloads are running that you want to manage using AutoStopping rules.
- Select your Azure account from the Connect to your Azure account drop-down list and click Next.
If you have not added an Azure cloud account, see Connect to an Azure Connector.
- In Define your AutoStopping rule, in Name your Rule, enter a name for your rule. This is the name of your AutoStopping rule.
- In Idle time, enter the idle time in minutes. This is the time that the AutoStopping rule will wait before stopping the idle instances.
AutoStopping will shut down (for on-demand) or snapshot and terminate (for spot) the instances after the idle time period has elapsed.
Step 2: Select the Resources to be Managed by the AutoStopping Rule
Select the cloud resources that you want to manage using this rule. AutoStopping Rule will monitor the selected resources and stop them when they are idle beyond the configured idle time.
Option 1: Select Instances
- Select Instances and click Add an Instance.
- Select the instances that you want to manage using the AutoStopping rules. You can use the search option to search the instances.
- Once you have finished selecting the instances, click Add selected.
Option 2: Select Kubernetes Clusters
Add a cluster to be managed by the AutoStopping Rule.
- Select Kubernetes Cluster and then click Add a cluster.
- Select the Kubernetes cluster that you want to manage using the AutoStopping rules. If you wish to create a new connector for the Kubernetes cluster, see Create a Kubernetes Connector for AutoStopping Rules.
- Once you have finished selecting the Kubernetes cluster, click Add selected.If you select a Kubernetes cluster, follow the steps in Create AutoStopping Rules for Kubernetes Cluster.
Step 3: Select the Instance Fulfillment Type
- Select On demand.
(Optional) Step 4: Set Up Advanced Configuration
In this step, you can configure the following settings:
Hide Progress Page
Toggle the button to enable or disable the instances warming up progress status. If you turn this ON, the progress status will not be displayed.
Set dependencies between two or more AutoStopping Rules when you want one Rule to make one or more Rules to be active based on the traffic that it receives. For example for an application server dependant on a database server, create two AutoStopping Rules managing both the servers. Add a dependency on the Rule managing the application server to be dependant on the Rule managing the database server.
- Click add dependency to add a dependency on any existing rule.
- Select the rule from the RULES drop-down list.
- In DELAY IN SECS, enter the number of seconds that rule should wait after warming up the dependent rule. For example, you have Rule 1 dependent on Rule 2 and you have set 5 seconds delay. In that case, when the request is received to warm up Rule 1, then first Rule 2 (dependent rule) is warmed up, and then there will be a delay of 5 seconds before warming up Rule 1.
- Once you're done with all the configurations, click Next.
Now that you have the AutoStopping Rule configured, define how to access the instances.
Setup Access Using DNS Link
A DNS link allows you to access the resources managed by the AutoStopping rule using an URL.
- In Setup Access, select DNS Link.
- Select a Load Balancer from the drop-down list. If your Load Balancer is not added, click New Application Gateway. For detailed steps, see Create an Application Gateway for Azure.
- Verify listeners information under the Routing tab. If the security groups are configured for the selected instances, then the routing information is auto-populated for those instances.
You can edit or delete the routing information. However, it is mandatory to have at least one port listed. For more information, see Listeners.
- Click add port if you wish to add more ports.
- Toggle the Health check button to configure the health check. Health check makes sure that the specified parameters are met before stopping the instances. Health check status should be successful for the AutoStopping rules to come into effect.
- In PROTOCOL, select http or https.
- Enter Path, port, and timeout details. For example, you have configured port 80 and the timeout as 30 seconds for your instance, then the AutoStopping rule will check these specified parameters before stopping the instance.
- (Optional) Specify the URL used to access the resources. You can select either of the following options:
- Select the auto-generated URL to access the resources managed by this AutoStopping Rule.
- Enter the URL currently used to access the instances
The domain name should be entered without prefixing the scheme. A rule can have multiple URLs. You can enter comma-separated values into the Custom URL to support multiple URLs.
- Select the checkbox This url is publicly accessible, if the URL is publicly accessible.
- Once you're done, click Next.
Setup Access Using SSH/RDPSSH and RDP allow you to access the resources managed by the AutoStopping rule via SSH or RDP HTTPS URL. Select this option if the underlying applications running on the resources managed by AutoStopping Rule are accessed via SSH or RDP.
- In Setup Access, select SSH/RDP.
- Select your operating system to download the Harness CLI for your system.
- Click Download CLI.
- You can connect using SSH or RDP.
SSH CommandsRun the following commands for SSH:
harness ssh --host default-test-ssh-1.abc1000test.lightwingtest.com --user ubuntu --config lwc.toml -- -i ~/.ssh/ry-jupyter.pem
connectcommand to open a proxy connection in your machine which can be used from other applications.
harness connect --host default-test-ssh-1.abc1000test.lightwingtest.com --port 22 -- -i ~/.ssh/ry-jupyter.pem
Here is the output:
Proxy listening details:
Rule name: Test SSH 1
Listen address: 127.0.0.1
Port forwarding: 14527 => 22
Started at: 2021-05-19 21:53:38.320943 +0530 IST m=+48.950643931
For RDP run the following command:
harness rdp --host default-test-rdp-1.abc1000test.lightwingtest.com
Run the following command to connect via private IP:
harness rdp --host default-test-rdp-1.abc1000test.lightwingtest.com --internal-ip
- Click Next.
- In Review, verify all the configuration details and click Save Rule. To edit any of the configuration settings, click EDIT and modify the settings.
Your AutoStopping rule is listed under the AutoStopping Rules dashboard.