# Install Runbooks

Runbooks in OneLens allow you to automate actions across your cloud environment with minimal manual effort. Before you install your first runbook, you'll need to complete a one-time setup in your AWS accounts. Once that’s done, installing a runbook becomes a simple, account-level action.

## One Time Setup

Before installing your first runbook, you need to perform a one-time setup in your AWS environment. Depending on how your infrastructure is structured, follow the steps for either a **Master-Child Setup** or an **Individual Account**.

{% hint style="success" %}

## Step-by-Step Guide

OneLens will automatically prompt you with the one time setup steps when you attempt your first runbook installation.
{% endhint %}

### For Master Child Setup

If you have multiple AWS accounts through AWS Organizations, follow these steps:

{% hint style="warning" %}

## NOTE

If you're using a **third-party billing partner**, make sure you have access to the actual **master/management account** in AWS Organizations. You'll need this to designate a delegated administrator and proceed with the setup.&#x20;

In case you don't have the access, follow the[ individual account setup](#for-an-individual-account) in each account.
{% endhint %}

{% stepper %}
{% step %}

#### **Create a Delegated Account**

Begin by setting up a **delegated account** from your master account. This account will be used to manage resources and permissions across multiple AWS accounts.

{% hint style="danger" %}

## **Important**

The **master/payer account cannot be used as a delegated account**. Ensure you create the delegated account from the master account, not as the master account itself.
{% endhint %}
{% endstep %}

{% step %}

#### **Enable AWS Change Manager**

After the delegated account setup, enable AWS Systems Manager **Change Manager** in that account. This will enable OneLens to execute changes securely across your cloud infrastructure.

{% hint style="success" %}
For detailed steps on enabling Change Manager, refer to the [**Enable Change Manager**](https://astuto.ai/deployment-guide-install-change-manager).
{% endhint %}
{% endstep %}

{% step %}

#### **Deploy the CFT as a StackSet for Child Accounts**

Once the CFT has been deployed in the delegated account, use a **CloudFormation StackSet** from the delegated account to deploy the CFT to all **child accounts**. This ensures that each child account is configured with the required resources.

**Child Accounts CFT URL:**

```url
https://prod-onyx-backend.s3.ap-south-1.amazonaws.com/onyx/aws/cft/onyx-child.template.json
```

{% endstep %}

{% step %}

#### **Deploy CFT as a Stack in the Delegated Account**

In the **delegated account**, deploy the **OneLens CloudFormation Template (CFT)** as a CloudFormation **Stack**. This step sets up the necessary permissions and resources that OneLens needs to operate.

**Delegated Account CFT URL:**&#x20;

```url
https://prod-onyx-backend.s3.ap-south-1.amazonaws.com/onyx/aws/cft/onyx-master.template.json
```

{% hint style="danger" %}

## **Note**

If you are using a **Master-Child (Multi-Account)** setup, complete the StackSet deployment for your child accounts.\
If you are managing a **single account**, simply follow the previous steps and do not run the StackSet.
{% endhint %}

{% hint style="success" %}
For detailed steps on deploying the CFT (both as a Stack in the delegated account and as a StackSet for child accounts), refer to the [**Deploy CFT (Stack and StackSet)**](https://www.astuto.ai/deployment-guide-deploy-cloudformation).
{% endhint %}
{% endstep %}
{% endstepper %}

### For an Individual Account

If you're setting up OneLens in a single AWS account without AWS Organizations, follow these two steps:

{% stepper %}
{% step %}

#### Enable AWS Change Manager

Enable **Change Manager** in your account to allow secure runbook execution.
{% endstep %}

{% step %}

#### **Deploy the CloudFormation Template (CFT) as a Stack**

Deploy the OneLens CloudFormation Template as a **Stack** in your account to configure required permissions.

**CFT URL:**

```url
https://prod-onyx-backend.s3.ap-south-1.amazonaws.com/onyx/aws/cft/onyx-master.template.json
```

{% endstep %}
{% endstepper %}

{% hint style="warning" %}

## CFT Verification&#x20;

To verify or inspect any of the CloudFormation templates before deploying, click on the respective link provided above.
{% endhint %}

## Installing a Runbook

Once the setup is complete, here’s how you can install a runbook:

1. Open the **particular** **runbook** page in the OneLens UI.

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

2. Click the **Install** button at the bottom right of the page. This will open the **Accounts Tab** where you can see all your connected AWS accounts.

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

3. In the Accounts Tab, locate the specific account where you want to install the runbook.

<figure><img src="/files/4KDKQ3maZrMXEBn6op2l" alt=""><figcaption></figcaption></figure>

4. Click the **Install** button next to the account you want to deploy the runbook to.

&#x20;OneLens will then deploy the runbook using the permissions granted during one time setup.

{% hint style="success" %}

## Uninstall Runbook

After installation, the **Install** button changes to **Uninstall**, allowing you to remove the runbook if needed.
{% endhint %}


---

# 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/install-runbooks.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.
