> For the complete documentation index, see [llms.txt](https://docs.finops.softwareone.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.finops.softwareone.com/insights/recommendations/clean-up-scripts-based-on-recommendations.md).

# Clean-up scripts based on recommendations

{% hint style="danger" %}
The script deletes all recommended resources (based on the downloadable JSON file) and ignores errors. After completion, a summary lists deleted resources, non-existent or already deleted resources, and resources that couldn't be deleted due to other reasons.
{% endhint %}

## Amazon Web Services (AWS) <a href="#aws-source" id="aws-source"></a>

### Prerequisites

* [AWS Command Line Interface (AWS CLI)](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
* jq - The package allows executing JSON scripts with bash. See [Download jq](https://stedolan.github.io/jq/download/).

### Implementation

1. Install the requirements on a machine running Linux OS.
2. Configure the AWS Command Line Interface. (Run the **aws configure** command. For information, see the [AWS User Guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html)).
3. Download the script from the corresponding subsection on the **Recommendations** page.
4. From the same page, download the JSON file containing a list of all resources recommended for deletion.
5. Run the script as follows: `bash <script_name> <path to json file>.`

## Microsoft Azure <a href="#azure-source" id="azure-source"></a>

### Prerequisites

* [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt)
* jq - The package allows executing JSON scripts with bash. See [Download jq](https://stedolan.github.io/jq/download/).

### Implementation

#### Azure Azure CLI

1. Install the requirements on a machine running Linux OS.
2. Sign in with the Azure CLI.
3. Download the script from the corresponding subsection of the Recommendations page.
4. From the same page, download the JSON file containing a list of all resources that are recommended for deletion.
5. Run the script as follows: `bash <script_name> <path to json file>`.

#### Azure Shell

1. Open [Azure Cloud Shell](https://portal.azure.com/#cloudshell/).
2. Download the script and the JSON file from the corresponding subsection of the Recommendations page.
3. Copy these files using the **Upload/Download files** button. The files will be placed in `/usr/csuser/clouddrive`.
4. Run the script as follows: `bash <script_name> <path to json file>` using absolute paths or navigate to the necessary folder before executing.

## Google Cloud Platform

### Prerequisites&#x20;

* [Google Cloud CL](https://cloud.google.com/sdk/gcloud)
* jq - The package allows executing JSON scripts with bash. See [Download jq](https://stedolan.github.io/jq/download/).

### Implementation

1. Install on a machine running Linux OS.
2. Configure gcloud: run gcloud init. See [Initializing the gcloud CLI](https://cloud.google.com/sdk/docs/initializing) for more information.
3. Run script bash `<script_name> <path to recommendation json file>`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.finops.softwareone.com/insights/recommendations/clean-up-scripts-based-on-recommendations.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
