# Smart Stop (AWS)

## Overview

Smart Stop is an advanced feature of the Autofix module designed to eliminate "silent waste" in cloud environments. Unlike conventional fixed-schedule automation, Smart Stop monitors the actual state and utilization of resources to execute the automatic shutdown of idle workloads, especially in development, staging, and testing environments.

## Business Objective

The primary focus is Utilization Efficiency. Smart Stop resolves unnecessary costs associated with:

* Active instances outside business hours or on weekends.
* Test environments forgotten after the completion of development cycles.
* Resources with continuous low utilization that do not justify the cost of remaining powered on.

***

## Operating Modes

Smart Stop offers two main approaches for resource management:

#### 1. Only Stop (Filter-Based)

Shuts down AWS resources based on specific selection criteria (Tags, IDs, or Names). If the resource matches the configured filters, it is turned off to ensure compliance with the organization's policy.

* **Supported Resources:** EC2 instances, RDS instances/clusters, and Auto Scaling Groups (in this case, Min, Max, and Desired capacities are reduced to 0).

#### 2. Metric Analyzer (Utilization-Based)

Analyzes real performance before taking action. The resource is only shut down if the maximum CPU utilization during the configured period is below the defined threshold.

* **Shutdown Requirements:** The instance must be running, have been created longer ago than the configured analysis period, and must not have protection tags or active Overrides.

***

## Control and Protection Mechanisms

#### Override (Temporary Restart)

Allows a resource shut down by Smart Stop to be temporarily restarted for a determined period.

* The user defines the start time and the duration of the Override.
* The system starts the resource at the scheduled time.
* At the end of the period, the system executes the automatic shutdown again, recording the entire cycle in the history.

#### Resource Protection (Safety Net)

To prevent the accidental shutdown of critical resources, the system respects the following rules:

* **Exception Tag:** Any resource with the `PIER_CLOUD_SMART_STOP_SKIP_RESOURCE` tag will be permanently ignored by the automation.
* **Override Priority:** Resources with an active Override are ignored by the standard shutdown cycle to avoid operational conflicts.

***

## Configuration and Execution

#### How to Configure

In the Autofix → Smart Stop module, the process follows three steps:

1. **Scope Definition:** Selection of accounts, regions, and filters (Tags, ID, or Name).
2. **Idleness Criteria:** Definition of the CPU threshold and minimum inactivity period.
3. **Activation:** Activation via status toggle to begin monitoring.

#### Frequency and Audit

* **Verification:** The system analyzes resources every 1 minute.
* **History:** All actions (successes, failures, ASG capacity changes, and before/after states) are recorded with detailed logs for technical auditing.

***

## FinOps Impact

The implementation of Smart Stop directly reflects on the financial health of the cloud operation:

* **Waste Reduction:** Immediate cut in unused Compute costs.
* **Accountability Culture:** Encourages engineering teams to maintain lean and tagged environments.
* **Continuous Optimization:** Replaces manual audits with automated and resilient governance.

***

## Best Practices

* Start the application in non-production environments (Dev/Sandbox).
* Use tag-based scoping to ensure production resources are not affected.
* Monitor "Monthly Recurring Savings" metrics generated by the first executions before expanding to the entire organization.

***

## For use and access in the Pier platform:

Smart Stop is an Autofix feature that automates the shutdown of existing instances in the environment through a key and value.&#x20;

Smart Stop includes the following AWS services: **EC2, RDS and Auto Scaling Group**

1. **Accessing Smart Stop**.&#x20;

In the Autofix side menu, select **Smart Stop**.

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2FkJ071N6v3VU4cK4XYR6i%2Fimage.png?alt=media&#x26;token=ee54ef1c-8867-4c01-b795-430969abf9d2" alt=""><figcaption></figcaption></figure>

Select the **EC2, RDS, or Auto Scaling Group** service:

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2FFdsBSFbffrvp1t5qdvlh%2Fimage.png?alt=media&#x26;token=69ccb5da-55fb-496d-8aa3-555805d022e5" alt=""><figcaption></figcaption></figure>

2. **Creating an action**&#x20;

On the main screen, click the "Add" button

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2FBUGdGxZJcllxxWhwd0JN%2Fimage.png?alt=media&#x26;token=56822fd9-c9c6-4c24-bb29-4d809f5d36ba" alt=""><figcaption></figcaption></figure>

3. **Properties**&#x20;

The system will open a screen to create the action&#x20;

* **Add a name to the Smart Stop action**:

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2FV0KszLi3z1IMLxA8Dzmv%2Fimage.png?alt=media&#x26;token=ef943a38-a222-43ed-8926-84a25b36b91f" alt="" width="542"><figcaption></figcaption></figure>

* **Set the Smart Stop type**:

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2FkdHq8hK4y4Zs7XR30YU2%2Fimage.png?alt=media&#x26;token=64238972-bf7e-463c-b1e7-1f18f0073f53" alt="" width="542"><figcaption></figcaption></figure>

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2FPzBgBZty4OophhjPg9yi%2Fimage.png?alt=media&#x26;token=d5c0a5d8-d62d-4f1e-9184-aab6643b03c0" alt="" width="530"><figcaption></figcaption></figure>

{% tabs %}
{% tab title="Metrics" %}
Sets metrics so that Smart Stop can monitor resources and stop resources that are outside the configured metric.&#x20;
{% endtab %}

{% tab title="Stop 24/7" %}
Will stop the selected resources, without using specific metrics.
{% endtab %}
{% endtabs %}

* **Define the regions:**

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2F11UKDBKIwloB3WhfywoR%2Fimage.png?alt=media&#x26;token=26344c97-22b2-4968-ae5f-1e1ae973acf2" alt="" width="542"><figcaption></figcaption></figure>

The system allows to select more than one region

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2FgcSvS4WWSoo37m5gFncr%2Fimage.png?alt=media&#x26;token=05160cd5-af62-4005-b4d7-5bc9e53c4949" alt="" width="523"><figcaption></figcaption></figure>

* **Define accounts**:

&#x20;The system allows to select more than one account

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2FftGWD8vd05ja5UvoqRsG%2Fimage.png?alt=media&#x26;token=aff42ae3-aa1d-4397-ba8c-980e06e13e6d" alt="" width="542"><figcaption></figcaption></figure>

4. **Filters**

By clicking the next button, the system will advance to the filters screen, where it is possible to add the desired filters.

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2F0Z7kaHmaRYFcQHLYkN9a%2Fimage.png?alt=media&#x26;token=b042f43e-415f-4911-ba59-94bdda2a1058" alt="" width="543"><figcaption></figcaption></figure>

Filters are where Smart Stop will locate resources by key and value&#x20;

* In "**Filter Type**" it is possible to locate the resource in three ways: **tag, resource name and resource id**:

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2F2QOA5SQP1cwkRE3L34NY%2Fimage.png?alt=media&#x26;token=41a7909c-efda-4af0-81a0-815570344f86" alt=""><figcaption></figcaption></figure>

* Set the expression **CONTAINS** and **NOT CONTAIN**:

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2FnV1VbnFnKWpWaixeUsHq%2Fimage.png?alt=media&#x26;token=800a0d66-9a11-44aa-9400-9b2906b422ed" alt="" width="518"><figcaption></figcaption></figure>

* In key and value, add the resource ID so it can be found.

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2FemPLuvB96O35WmoJWSsI%2Fimage.png?alt=media&#x26;token=e0874ea2-6dbd-4f4b-873a-bf8b34e736c5" alt="" width="516"><figcaption></figcaption></figure>

* When adding, you can view the filter of the created resource

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2FveFscujCkGnfqpr7G9v7%2Fimage.png?alt=media&#x26;token=737e78f2-89b9-4f3b-a7be-ef3483badb35" alt=""><figcaption></figcaption></figure>

5. **Metrics**&#x20;

By clicking the next button, the system will advance to the **Metrics** screen&#x20;

* Set the metrics to check the Smart Stop action. For example, vCPU usage:

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2FXqB4Jz3h58Cs4sSVyrd0%2Fimage.png?alt=media&#x26;token=30161672-2e2f-4efb-b44d-d9c457f738b1" alt=""><figcaption></figcaption></figure>

**Note**: Smart Stop will monitor the VCPU usage of resources.

* Set the period during which Smart Stop will monitor the resource that has VCPU usage below the defined value:

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2Fi4E8k2oFNy0b1OHS35tY%2Fimage.png?alt=media&#x26;token=24610b36-241f-4506-9055-c88adc19a12b" alt=""><figcaption></figcaption></figure>

* Set the maximum percentage less than: VCPU usage value that will indicate Smart Stop monitoring:

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2F2upcWVjAYCN7LObIWlUi%2Fimage.png?alt=media&#x26;token=3ea8c786-1b18-4c1d-bdf6-7698f1370b78" alt=""><figcaption></figcaption></figure>

6. **Schedule**&#x20;

By clicking the next button, the system will advance to the **Schedule** screen&#x20;

* Set the Smart Stop monitoring schedule

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2FmEFYdiDyjkQInPr58gvr%2Fimage.png?alt=media&#x26;token=7cdfc4ba-59dc-400f-afa2-a1be9615967e" alt=""><figcaption></figcaption></figure>

Execution interval that Smart Stop will monitor resources to find resources outside the defined metric.

Once the rule has been created, the configuration is visible on the Smart Stop home screen, where it is possible to Activate and deactivate the rule in the “**Status**” column.

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2FMMXw09EOWkwlT0uO77jD%2Fimage.png?alt=media&#x26;token=9cce7d26-5191-4b7b-9be8-8dbbc41c15cc" alt=""><figcaption></figcaption></figure>

7. **Edit**&#x20;

* Allows the user to edit any information created in the action.

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2FYJG4qPOob0mYvqiKniN7%2Fimage.png?alt=media&#x26;token=5dfc8887-1044-470f-b169-871410221cb4" alt=""><figcaption></figcaption></figure>

8. **Delete**

* Allows the user to delete the created action.

<figure><img src="https://1687673077-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9sinLUl52lDK1vg6b8g%2Fuploads%2FXEyoHr05fVZAME1LUoG2%2Fimage.png?alt=media&#x26;token=fbddf79e-adb4-4e2f-8e6d-f8d6f32bec5c" alt=""><figcaption></figcaption></figure>
