Skip to main content

aws-as

Last updated on

Prerequisite: Set Up Proxy and/or Load Balancer

AutoStopping is designed to integrate seamlessly with native load-balancing solutions like AWS ALB. However, for use cases that fall outside of these integrations such as SSH, RDP, or RDS connections, AutoStopping offers an advanced reverse proxy solution: AutoStopping Proxy.

AWS Load Balancer

A cloud-native service that distributes incoming HTTP/HTTPS traffic across multiple targets. It monitors web traffic patterns and automatically starts your resources when traffic arrives.

AutoStopping Proxy

This proxy VM 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.

The table below shows the resources supported by AutoStopping and the appropriate traffic management you can use for each resource type.

AWS ResourceAutoStopping ProxyApplication Load Balancer (ALB)
Amazon EC2
Auto Scaling Groups
Amazon RDS Instances
Amazon ECS
  1. In the AutoStopping Rules page, click Load Balancers in the top right. Please refer to offcial AWS documentation for details.

  2. Enter a name and select AWS in Cloud Provider

  3. Choose a cloud connector or create a new one.

  4. Enter Load Balancer Configuration:

    • Access Type: Choose Internal (for private network access within your VPC) or External (for public internet access). Internal load balancers are ideal for backend services, while external load balancers are necessary for user-facing applications.

    • Region: Select the AWS region where your resources are located. This must match the region where your target EC2 instances or ECS services are running.

    • SSL Certificate: Choose an existing certificate from AWS Certificate Manager or create a new one for HTTPS connections. This is required for secure HTTPS traffic and helps establish trust with your users.

    • VPC: Select the Virtual Private Cloud where your target instances are running. The load balancer must be in the same VPC as the resources it will manage.

    • Security Groups: Choose security groups that allow appropriate traffic (HTTP/HTTPS) to your load balancer. These act as a virtual firewall controlling which traffic can reach your load balancer and subsequently your instances.

    tip

    For optimal security, configure your security groups to allow only necessary traffic on required ports (typically 80 for HTTP and 443 for HTTPS).

  5. Click Save Load Balancer


Create AutoStopping Rule

  • In Harness, navigate to Cloud Costs > AutoStopping Rules and click New AutoStopping Rule.
  • Select Cloud Provider as AWS. Select an existing AWS connector or create a new one.
  1. Enter a descriptive Name for your rule.
  2. 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.
info

Please note: Schedule-only rules can be changed to traffic-based during edit, but traffic-based rules cannot be reverted to schedule-only. (Schedules on traffic-based rules remain editable)

  1. Set the Idle Time - the duration an instance should be inactive before stopping
  2. From the Resources to be managed section, choose the resource type you want to manage:
EC2 VMs
  • Select EC2 VMs as the resource type

  • Choose the idle behavior: Shut Down or Hibernate

  • Select the mode how you would like the resource to be handled once idle for the specified idle time: either Shut Down or Hibernate

    • Shut Down: Completely shuts down the resources until it is brought up by a request. Higher Savings.
    • Hibernate: Resources go into hibernate until it receives a request. Quicker warmup time.
  • Select EC2 instances manually or by Tag-based inclusion. For manual selection, choose the region and optionally apply tags. For Tag-based selection, specify tag keys and values. Any new resources that match your selected criteria will automatically be affected by Tag-based selection and will be added to the Rule.

  • Choose to Convert to Spot Instances or keep as On-Demand
ECS Service
  • Select ECS Service as the resource type
  • Click Add an ECS Service
  • Choose your ECS Service by either:
    • Service Name: Select region, cluster, and service
    • Service Tags: Select region, cluster, and tags
  • Specify the Desired Task Count that Harness should instantiate when the service is running
Auto-Scaling Groups
  • Select ASG as the resource type
  • Click + Add an auto-scaling group and select the ASG to onboard
  • Choose the on-demand vs. spot ratio for your ASG

    Note: The Mixed Instance Policy must be enabled for the ASG

RDS Instances
  • Select RDS as the resource type
  • Click Add RDS Instance and select the instance you want to manage

Alerts and other Advanced Configuration (Optional):

Get instant notifications when resources managed by the rule experience problems starting up or shutting down properly.

AutoStopping Alerts: Configure notifications for critical events related to your AutoStopping rules. Click on +Add Alert to add an alert.

  • Rule create: Receive notifications when new AutoStopping rules are created in your environment. This helps track who is creating rules and when, providing better governance.
  • Rule update: Get alerts when existing rules are modified. This helps maintain awareness of configuration changes that might affect resource availability or cost savings.
  • Rule delete: Be notified when rules are removed. This ensures you're aware of any changes that might affect resource management or cost optimization strategies.
  • Rule warm up failures: Receive alerts when resources fail to start properly. This is critical for addressing availability issues quickly and preventing application downtime.
  • Rule cool down failures: Get notifications when resources fail to stop as expected. This helps identify potential issues that could prevent cost savings or indicate resource problems.
  • Notification Channels: Receive real-time notifications directly in Slack or e-mail. Configure specific channels for different types of alerts to streamline your team's response workflow.

Run Options:

  • Hide Progress Page: Toggle this to disable the display of a progress page during instance warm-up. This option is especially useful when the service is invoked by an automation system, as it prevents misinterpretation of the progress page as the intended response from a service that is onboarded to AutoStopping. By hiding the progress page, the first response of warming up a rule after a downtime will be delayed until the intended service is up and running.

  • Dry-Run: Toggle this button if you wish to evaluate the feature without terminating your cloud resources.

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 dependent on a database server, create two AutoStopping Rules managing both the servers. Add a dependency on the Rule managing the application server to be dependent on the Rule managing the database server. 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.

AWS AutoStopping Savings Computation

For AWS, the savings are determined by calculating the total cost based on amortized values after deducting total discounts.

Cost = Amortized Cost - Total Discounts

Savings numbers will become precise only after the savings numbers are finalized after the 15th of the next month (after the final settlement). Savings will be recomputed for the previous month on the 15th of the next month to ensure any updates to CUR/billing-export are considered in the final savings numbers for the month.