# Delete CloudWatch Alarms in Insufficient State

## What It Does

Identifies and deletes CloudWatch Alarms that are in the `INSUFFICIENT_DATA` state. These alarms often indicate that metrics are no longer being reported or monitored.

## Risk and Scope

| Detail                   | Value             |
| ------------------------ | ----------------- |
| **Risk Level**           | Low               |
| **AWS Service Targeted** | Amazon CloudWatch |

{% hint style="warning" %}

## Permissions Required

**Read Permissions**

* `cloudwatch:DescribeAlarms`

**Delete Permissions**

* `cloudwatch:DeleteAlarms`&#x20;

> These permissions are granted **only to the runbook**, not to the OneLens platform itself.
> {% endhint %}

## Optimization Policies Addressed

This runbook remediates violation tickets triggered by the following policy:

| Policy ID | Policy Name                                           |
| --------- | ----------------------------------------------------- |
| cw\_101   | Ensure no CloudWatch Alarms are in insufficient state |

## Risk Mitigation

{% hint style="success" %}

## Risk Mitigation Strategy

* The change is assessed as **low risk** with limited scope and impact.
* **No downtime** is expected during or after implementation.
* **No additional safety measures** are required due to the non-disruptive nature of the change.
* A **rollback plan is not defined**, as standard procedures are sufficient to manage the change.
  {% endhint %}

## How to Install

Refer to the [Runbook Setup Guide ](/automate/remediations/runbooks/install-runbooks.md#installing-a-runbook)for steps to install and enable this runbook in your environment.

## Runbook Workflow

### 1. Start

**Trigger:** Initiates the Runbook execution for deleting unused CloudWatch alarms.

### 2. DescribeAlarms

**Action:** Executes the `DescribeAlarms` API call to retrieve the list of alarms and their current states.

### 3. If/Else

**Condition:** Evaluates whether any alarms meet the criteria for further action based on their state.

1. **IsValidForDelete** \
   Validates if the filtered alarms meet criteria for deletion.
   1. **DeleteAlarms**\
      Executes the `DeleteAlarms` API call on the validated alarms.
   2. **RunScript**\
      If no other eligible resource is found, raises a runtime error, failing the workflow explicitly.
2. **Else (no alarms in that state or invalid structure):**

   Exit through the `Else` path — no further action taken.

## See How it Works

<figure><img src="/files/MWRn60H9NN7VTQpSbpZO" alt=""><figcaption></figcaption></figure>

## Triggering the Runbook

To run this workflow:

### **1. Locate the Ticket**

Identify the ticket associated with the above mentioned policy violation.

### **2. Execute the Runbook**

Follow the steps described in the [executing a runbook](/automate/remediations/runbooks.md#executing-a-runbook) section to apply this runbook to the ticket.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.onelens.cloud/automate/remediations/runbooks/runbook-catalog/delete-cloudwatch-alarms-in-insufficient-state.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
