# Script for automated incremental backups

### Overview

This script demonstrated in this tutorial will use public cloud APIs to communicate with the cloud and generate volume backups for all instances. You can follow the instructions to set up this script on crontab. With the help of crontab, it will run automatically every day. On the first run, this script will generate full-volume backups of all the VMs. After the first day, it will take incremental backup for 20 days. On the 21st day, the script will remove all the volume backups and generate a full volume back up again, so the cycle repeats itself every 20 days. These settings are customizable; if you need any other settings, you can open a ticket by clicking [here](https://customer.acecloudhosting.com/index.php?rp=/knowledgebase/18/How-to-Raise-a-Support-Ticket-on-Ace-Public-Cloud.html).

### **Prerequisites**

There are some prerequisites that need to be met before you begin:

* Python 3
* Instance on Public Cloud console

### Get Started

**Step 1:** You have to create an instance first. Follow [this](https://customer.acecloudhosting.com/index.php?rp=/knowledgebase/33/How-to-create-compute-instance.html) article to create an instance.

**Step 2:** Download and unzip files by clicking [here](https://customer.acecloudhosting.com/dl.php?type=d\&id=12). This folder contains two files, `variable.json`, and script.py.

Please change the following fields in the `variables.json` file:

| Field      | Description                                                                                              |
| ---------- | -------------------------------------------------------------------------------------------------------- |
| Region     | Change the value of the region 'ap-south-mum' to operate and maintain your backups in the Mumbai region. |
| Project ID | Mention your project id here; you can find it on the dashboard panel.                                    |
| Name       | Mention your cloud console username here.                                                                |
| Password   | Mention your cloud console password here.                                                                |
| Name       | Mention the name of your project here; you can find it on the dashboard panel under identity.            |

Upload both `variable.json` and `script.py` on your server.

```
{
    "identity-api":"https://api-us-east-at-1.openstack.acecloudhosting.com:5000",
    "comment": "--+--change the value of region to 'ap-south-mum' to operate and maintain your backups in Mumbai region--+--",
    "region": "us-east-at",
    "comment":"--+--mention your project id here, you can find it on the dashboard panel under identity--+--",
    "project_id":" ",
    "token-data":{ "auth": {
    "identity": {
    "methods": ["password"],
    "password": {
        "user": {
        "comment": "--+--mention your cloud console username here--+--",
        "name": "",
        "domain": { "id": "default" },
        "comment":"--+--mention your cloud console password here--+--",
        "password": " "
        }
    }
    },
    "scope": {
    "project": {
        "domain":{
            "id":"default"
        },
        "comment":"--+--mention the name of your project here, you can find it on the dashboard panel under identity--+--",
        "name": " "
    }
    }
    }
    }
}
```

**Step 3**: Set the execution of the script in cron.

```
crontab -e
```

When you run the above command, a file will open; add the follow line to schedule volume backup at 1:00 every day.

```
0 1 * * * python3 <location of script.py>
```

&#x20;


---

# 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.acecloud.ai/knowledge-base/tutorials/script-for-automated-incremental-backups.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.
