# Create a MariaDB Cluster from a Backup

The request creates a new MariaDB cluster, which involves restoring a backup of an existing MariaDB cluster and configuring it to function as a new cluster. Ensure you have a backup of your MariaDB cluster containing all the necessary data and configuration files for appropriate functioning.

## Prerequisite

* Only contract administrators, owners, and users with **Access and manage DBaaS** privilege can create and manage MariaDB clusters. Ensure that you have the necessary privilege.

## Request

{% hint style="info" %}
**Note:**

* After creating a database, you can access it via the corresponding LAN using the same username and password specified during creation.
* This is the only opportunity to set the **username** and **password** via the API. The API does not provide a way to change the credentials yet. However, you can change them later using raw SQL.
* The data center must be provided as a `UUID`. The easiest way to retrieve the `UUID` is through the [<mark style="color:blue;">Cloud API</mark>](https://docs.ionos.com/cloud/reference/api-specification-files/api-overview).
* The sample `UUID` in the example is `498ae72f-411f-11eb-9d07-046c59cc737e`.
  {% endhint %}

```bash
curl -X 'POST' \
  'https://mariadb.de-txl.ionos.com/clusters' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
{
  "properties": {
    "mariadbVersion": "10.6",
    "instances": 3,
    "cores": 4,
    "ram": 4,
    "storageSize": 10,
    "connections": [
      {
        "datacenterId": "5a029f4a-72e5-11ec-90d6-0242ac120003",
        "lanId": "2",
        "cidr": "192.168.1.100/24"
      }
    ],
    "displayName": "MariaDB cluster",
    "maintenanceWindow": {
      "time": "16:30:59",
      "dayOfTheWeek": "Monday"
    },
    "credentials": {
      "username": "cluster_admin",
      "password": "my-t0p-secret-password"
    },
    "fromBackup": {
      "backupId": "498ae72f-411f-11eb-9d07-046c59cc737e",
      "recoveryTargetTime": "2020-12-10T13:37:50+01:00"
    }
  }
}'
```

## Response

Your values will differ from those in the sample code. It may contain different IDs, timestamps etc.

The created cluster is returned with `metadata.state` set to `BUSY`, which indicates that the cluster is not yet reachable. This is because the cloud will create a completely new cluster and needs to provision new nodes for all the requested replicas.

**200 Successful operation**

```json
{
  "id": "498ae72f-411f-11eb-9d07-046c59cc737e",
  "metadata": {
    "createdDate": "2020-12-10T13:37:50+01:00",
    "createdBy": "john.doe@example.com",
    "createdByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
    "lastModifiedDate": "2020-12-11T13:37:50+01:00",
    "lastModifiedBy": "jane.doe@example.com",
    "lastModifiedByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
    "state": "AVAILABLE"
  },
  "properties": {
    "displayName": "MariaDB cluster",
    "mariadbVersion": "10.6",
    "dnsName": "ma-yourcluster.mariadb.region.ionos.com",
    "instances": 3,
    "ram": 4,
    "cores": 4,
    "storageSize": 10,
    "connections": [
      {
        "datacenterId": "5a029f4a-72e5-11ec-90d6-0242ac120003",
        "lanId": "2",
        "cidr": "192.168.1.100/24"
      }
    ],
    "maintenanceWindow": {
      "time": "16:30:59",
      "dayOfTheWeek": "Monday"
    }
  }
}
```

After creation, remember to validate the status of your MariaDB cluster. For more information, see [<mark style="color:blue;">Verify the Status of a MariaDB Cluster</mark>](/cloud/databases/mariadb/api-howtos/verify-mariadb-cluster-status.md).


---

# 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.ionos.com/cloud/databases/mariadb/api-howtos/create-mariadb-cluster-from-backup.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.
