Provision a Tessell Database Service

What is a Tessell Database Service?

Tessell Database Service is a fully managed cloud database service that offers support for a variety of database engines such as Oracle, MySQL, PostgreSQL, SQL Server, MongoDB, and Milvus on your choice of cloud including AWS and Azure. It simplifies the process of setting up, managing, securing, and scaling databases in the cloud. With Tessell, you can enjoy features like high performance, data browsing and consumption, granular level control for governance, usage-based billing, and unparalleled security. It provides a multi-cloud architecture that is both high-performing and secure, while also being user-friendly. It offers scalable and cost-effective database solutions with customisations for provisioning databases, backups, snapshots, SLAs, Schedules, etc.

Prerequisite APIs

  1. Get Access Token
  2. Returns details about the Tessell Subscriptions
  3. Get a list of all software images. Using the name filter, a software image can be found using name.
  4. Get a list of Compute Profiles.
  5. Get a list of VPCs
  6. View a list of available Compute Resources that can be used for newer provisioning
  7. Get a list of Availability Machine SLAs
  8. Get a list of available Parameter Profiles

Provisioning API

Provision a DB service

Provision a Simple MySQL DB Service

Here is a simple request in Python to provision a MySQL Server


Python Code For MySQL DB Service

import requests

url = "https://api.{your_tenant_server}/services"

data = '''
{
  "name": "my-service-90f0fac8",
  "description": "",
  "subscription": "default",
  "edition": "COMMUNITY",
  "engineType": "MYSQL",
  "topology": "single_instance",
  "softwareImage": "MySQL 8.0",
  "softwareImageVersion": "MySQL 8.0.34 (RHEL)",
  "autoMinorVersionUpdate": true,
  "enableDeletionProtection": false,
  "enableStopProtection": false,
  "infrastructure": {
    "cloud": "aws",
    "region": "ap-south-1",
    "availabilityZone": "ap-south-1a",
    "vpc": "example_vpc",
    "computeType": "tesl_2_a",
    "enableEncryption": true,
    "encryptionKey": "default-encryption-key",
    "additionalStorage": 0
  },
  "serviceConnectivity": {
    "servicePort": "3306",
    "enablePublicAccess": true,
    "allowedIpAddresses": [
      "49.924.357.563"
    ],
    "enableSSL": false
  },
  "creds": {
    "masterUser": "master",
    "masterPassword": "Tessell123"
  },
  "maintenanceWindow": {
    "day": "Sunday",
    "time": "02:00",
    "duration": 30
  },
  "snapshotConfiguration": {
    "sla": "DWMY",
    "schedule": {
      "backupStartTime": {
        "hour": 19,
        "minute": 30
      },
      "dailySchedule": {
        "backupsPerDay": 1
      },
      "weeklySchedule": {
        "days": [
          "Sunday"
        ]
      },
      "monthlySchedule": {
        "commonSchedule": {
          "dates": [
            1
          ],
          "lastDayOfMonth": false
        }
      },
      "yearlySchedule": {
        "commonSchedule": {
          "dates": [
            15
          ],
          "months": [
            "January"
          ],
          "lastDayOfMonth": false
        }
      }
    }
  },
  "engineConfiguration": {
    "mysqlConfig": {
      "parameterProfileId": "1482dbc2-0897-402a-bb0a-f878b241878a"
    }
  },
  "databases": [
    {
      "databaseName": "db1",
      "databaseConfiguration": {
        "mysqlConfig": {
          "parameterProfileId": "1482dbc2-0897-402a-bb0a-f878b241878a"
        }
      }
    }
  ],
  "tags": []
}
'''

headers = {
	"Content-Type": "application/json",
	"Authorization": "eyJhbGciOiJSUzUxMiJ9.eyJwcnZsZyI6IlBBWU1FTlRTO1NFQ1VSSVRZO1NFUlZFUlM7U0NSSVBUX0xJQlJBUlk7UFJPVklTSU9OSU5HO1NVQlNDUklQVElPTlM7SU5URUdSQVRJT05TO01ZX1NFUlZJQ0VTO0NPTVBVVEU7VElDS0VUUztVVElMSVpBVElPTjtBVkFJTEFCSUxJVFlfTUFDSElORVM7QkVOQ0hNQVJLUztBRE1JTjtEQl9HT1ZFUk5BTkNFO0lBTTtCSUxMSU5HO05FVFdPUktTO0RBVEFGTElYIiwic3ViIjoic29udS52ZXJtYUB0ZXNzZWxsLmNvbSIsInNjb3BlIjoiYWNjZXNzIiwiaXNzIjoidGVzc2VsbCIsImV4cCI6MTcwOTE4NDg1NywiaWF0IjoxNzA5MDk4NDYwLCJlbWFpbCI6InNvbnUudmVybWFAdGVzc2VsbC5jb20iLCJ0aWQiOiIwODY5ZjZkYS1jYTcyLTQyMmYtOWIzYy0wMTNmNzBjOWNmZTUifQ.IpRy2YP8PF4nVNRccVkPHBOtYh4bG8kAxoVdc93quO3iI9GcproG4xEJ5d9_LKXXuXdcP_za2JLqb2Ia_69QRi6q88RzXBr1l49eKSTR5TrT_lR2IzryOrMX3ACMkxesi-1beaRD9I4YmIcOcxE9lFb-9L-ppcyylOEJht9wt1z5qtuUdiRNUVpr43D-VOAHXgusqAy1LdUdH-jrEjnc9qjTZEaJapMqeivKTeGVU2axeDkdpzKD93pggBtLHMzK6L01tIxH4iElwouKnoUPttJ5-nJdPMae8sK0cCq1LLY8hMQzSkANqc42r570FrxkPmXqo89S4WRsLfa_xuVe8A",
	"tenant-id": "0869f6da-ca72-422f-9b3c-013f70c9cfe5"
}

requests.packages.urllib3.disable_warnings()
response = requests.request("POST", url, data=data, headers=headers, verify=False)

print(response.status_code)
print(response.text)

Let's look into this in detail

  1. Headers

    1. tenant-id: You will get tenant-id while getting onboarded to Tessell.

    2. Authorization: Guide to generate Authorization token

  2. Request body:

    1. "name": "your-service-name",
        "description": "description",
        "subscription": "default", // point b
        "edition": "COMMUNITY", // point c
        "engineType": "MYSQL", // point c
        "topology": "single_instance", // point d
        "softwareImage": "MySQL 8.0", // point b
        "softwareImageVersion": "MySQL 8.0.34 (RHEL)", // point b
        "autoMinorVersionUpdate": true, // true or false
        "enableDeletionProtection": false, // true or false
        "enableStopProtection": false, // true or false
      
      1. Subscription: You can get details of available subscriptions using API mentioned here: Returns details about the Tessell Subscriptions
      2. You can get Database software related information from here: Get a list of all software images. Using the name filter, a software image can be found using name.
      3. topology can be either single_instance or high_availability
    2. infrastructure

      "infrastructure": {
          "cloud": "aws",
          "region": "ap-south-1",
          "availabilityZone": "ap-south-1a",
          "vpc": "example_vpc",
          "computeType": "tesl_2_a",
          "enableEncryption": true, // either true or false
          "encryptionKey": "default-encryption-key",
          "additionalStorage": 0
        }
      
      1. cloud can be aws or azure
      2. region, computeType : Get a list of Compute Profiles.
      3. vpc: Get a list of VPCs
      4. availabilityZone, encryptionKey: View a list of Available Compute Resources
    3. Service Connectivity

      1. "serviceConnectivity": {
            "servicePort": "3306",
            "enablePublicAccess": true,
            "allowedIpAddresses": [
              "49.834.563.972"
            ],
            "enableSSL": false
          }
        
    4. Credentials

      1. "creds": {
            "masterUser": "myuser",
            "masterPassword": "MyPassword123"
          },
        
      2. Choose your own credentials
    5. Maintenance Window

      1. "maintenanceWindow": {
            "day": "Sunday",
            "time": "02:00",
            "duration": 30
          },
        
      2. day: Day from the week, i.e. Sunday, Monday, Tuesday, Wednesday…
      3. time: In the hh:mm format between 00:00 to 23:59.
      4. duration: Minute required for maintenance window, should be in the multiple of 30, minimum is 30.
    6. Snapshot Configuration

      1. "snapshotConfiguration": {
            "sla": "DWMY",
            "schedule": {
              "backupStartTime": {
                "hour": 19,
                "minute": 30
              },
              "dailySchedule": {
                "backupsPerDay": 1
              },
              "weeklySchedule": {
                "days": [
                  "Sunday"
                ]
              },
              "monthlySchedule": {
                "commonSchedule": {
                  "dates": [
                    1
                  ],
                  "lastDayOfMonth": false
                }
              },
              "yearlySchedule": {
                "commonSchedule": {
                  "dates": [
                    15
                  ],
                  "months": [
                    "January"
                  ],
                  "lastDayOfMonth": false
                }
              }
            }
          }
        
      2. sla: Get a list of Availability Machine SLAs
      3. schedule: schedule should be configured according to the chosen sla
      4. note: if sla is not provided, then by default 2-days-pits SLA is chosen, and if schedule is not provided then by default backupTime 1:00 AM is considered. If sla and schedule does not match, then error is thrown.
    7. Engine Configuration

      1. "engineConfiguration": {
            "mysqlConfig": {
              "parameterProfileId": "abcdfe-0897-402a-bb0a-fghshgshs"
            }
          }
        
      2. parameterProfileId: You can get a list of available parameter profiles from Get a list of Available Parameter Profiles api and select parameter profile id based on the engine.
    8. Databases

      1. "databases": [
            {
              "databaseName": "db1",
              "databaseConfiguration": {
                "mysqlConfig": {
                  "parameterProfileId": "abcdfe-0897-402a-bb0a-fghshgshs"
                }
              }
            }
          ]
        
      2. databaseName: user defined
      3. parameterProfileId: You can get a list of available parameter profiles from Get a list of Available Parameter Profiles api and select parameter profile id based on the engine.