GCP
Prerequisite: Set Up Proxy
Set up a proxy or load balancer that will intercept and manage traffic to your resources. This component is what enables the seamless start/stop functionality.
An AutoStopping Proxy is a virtual machine that sits in front of your virtual machines and intelligently starts or stops them based on incoming traffic. It supports both HTTP(S) and TCP connections. Built on the proven, open-source Envoy Proxy, the AutoStopping Proxy is capable of managing traffic for multiple AutoStopping-managed VMs from a single instance

In Harness, go to the Cloud Costs module. Click on AutoStopping Rules from left Navbar.
Click Load Balancers.
Click +Create New Load Balancer. Click Create New AutoStopping Proxy.
Enter a name and select GCP in Cloud Provider.
Choose an existing connector or create a new one.
Enter Autostopping Proxy Configuration.
Region: Select the GCP region where your target resources are hosted
Zone: Select the zone from the dropdown list.
VPC: Select the Virtual Private Cloud where your resources are located
Network tags: Select the Network tags to enable ports on the proxy VM which would be receiving traffic or the one that would be used to access the proxy.
Subnet: Select the subnet for the proxy deployment
Machine type: Select an appropriate AWS instance type for the proxy
Choose based on your expected traffic volume and performance needs
TLS Certificate Secret Version: Create a secret in your GCP account. Go to Create a secret.
TLS Private Key Secret Version: Provide the ARN of your private key secret
API Key: Enter a valid NG API key. Choose No Expiration in the Expiration dropdown list while creating this API key. Go to Create an API Key for more information.
[OPTIONAL] Enable Allocate Static IP if you need to assign an elastic IP address to make the VM publicly accessible. Update the DNS route to point to the public IP. You don't need to enable this field it is pointing to a private IP provided the DNS resolves. For example, when the DNS resolution is done within the VPC.
Click Save AutoStopping Proxy.
Create AutoStopping Rule
In Harness, navigate to Cloud Costs > AutoStopping Rules and click New AutoStopping Rule.
Step 1: Configuration

Enter a Name for your rule
AutoStopping Type: Choose how you want your resources to be managed automatically. You can either choose Traffic-based with schedules optionally or Schedules only.
Traffic-based with schedules optionally: Resources automatically stop when idle and restart when traffic is detected. You can configure schedule overrides in advanced settings.
Schedules only: Resources automatically start and stop based on defined schedules. You can configure multiple schedules in advanced settings.
Set the Idle Time - how long an instance should be inactive before stopping
From the Resources to be managed section, choose the resource type you want to manage:
Click on + Add an instance. Add the instances that you want to manage by this rule.

Click on + Add instance group. Add the instance groups that you want to manage by this rule. And optionally choose to convert the selected instance(s) to spot or remain on-demand.

Advanced Configuration (Optional):
Hide Progress Page: Toggle this to disable the display of a progress page during instance warm-up.
Dry-Run: Toggle this button if you wish to evaluate the feature without terminating your cloud resources.
Link your rule to other AutoStopping rules if resources depend on each other.
Click Add Dependency and select a rule from the RULES drop-down list.
In DELAY IN SECS, enter the number of seconds the dependent rule should wait after warming up before warming up this rule.

Create fixed uptime or downtime schedules for the resources managed by this rule. A fixed schedule takes precedence over the idle time logic.
Click Add Fixed Schedule.
Give the schedule a Name.
Select the Type of schedule (Uptime or Downtime).
Select the Time Zone.
Set the schedule period with Begins on and Ends on dates and times. You can also select the Never ends checkbox.
To set a recurring schedule, select the repeat frequency and the days of the week, and set the Start and End times. You can also select All Day.

Step 2: Setup Access
Choose how users will access your VM instances:
Setup Access for TCP workload or SSH/RDP
Setting up access for TCP workload or SSH/RDP allows AutoStopping to detect activity and idleness, and ensure that the database is up and running only when you need it. Use the AutoStopping Proxy URL (IP/Hostname of the Proxy and a unique autogenerated port number) for this AutoStopping Rule when you connect to the RDS database using any database client. The Proxy URL is generated when you save the AutoStopping Rule. If you need to access the resources managed by this AutoStopping rule using TCP or SSH/RDP HTTPS URL, you need to perform the following steps:
Choose an AutoStopping Proxy from the Specify AutoStopping Proxy dropdown list to set up access.
Toggle SSH or RDP to specify the listening ports. The port number is autopopulated based on the security group.
Specify the source port numbers and the target TCP ports your application is listening to. If the source port is not specified, a random port will be generated at the backend. This auto-generated port will continue to be used as long as the target port remains unchanged or unless the user explicitly modifies the source port.
Click Next.
Set up access for HTTP/HTTPS workload
If you need to access the resources managed by this AutoStopping rule using an HTTP or HTTPS URL, you need to perform the following steps:
Choose an AutoStopping Proxy from the dropdown list to set up access.
SSH/RDP Access (AutoStopping Proxy)
In Setup Access, select Proxy from drop-down list or create a new one > click Next.
Step 3: Review
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.
GCP AutoStopping Savings Computation
There are two types of exports in GCP: Standard and Detailed. Ensure the billing export is the detailed billing export. It is important to have a billing-enabled connector set up with detailed billing exports. The billing data will be used to compute savings for GCP instance and instance-group-based rules.
Last updated
Was this helpful?