Relational Database Service (RDS)

The Relational Database Service offers a demand-oriented use of databases in the Open Telekom Cloud. The RDS includes twelve flavors for implementing databases for a wide range of requirements. The current versions of mySQL, PostgreSQL and MS SQL are available as relational database software. The RDS offers an automatic backup function and point-in-time recovery for the previous 35 days. Numerous management tools analyze the performance of the database. Database operation can be optimized on the basis of resource utilization over time and the evaluation speed. The RDS supports high availability, even across different availability zones, and a mirrored standby database can be added to the primary database. Up to five read replicas can be added to a database cluster. The RDS is also available directly via an Elastic IP. Databases can be expanded to up 4 GB during ongoing operation. It is also possible to upgrade a single-instance database to an active/standby database. Billing is based on the hourly price of the selected virtual machines (VMs), while additional storage space for backups and images is billed in accordance with the method used for the respective storage variant.

Instance

The minimum management unit of RDS is the DB instance. A DB instance is an isolated database environment in the cloud. A DB instance can contain multiple user-created databases, and you can access it by using the same tools and applications that you use with a stand-alone DB instance. You can create and modify DB instances using the management console or APIs. RDS does not have limits on the number of running DB instances. Each DB instance has a DB instance identifier.

RDS supports the following DB engines:

  • MySQL

  • PostgreSQL

  • Microsoft SQL Server

List Instances

This interface is used to query all RDS instances and to filter the output with query parameters.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

for instance in conn.rds.instances():
    print(instance)

Create Instance

This interface is used to create a RDS instance with parameters.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')


attrs = {
    "name": "rds_name",
    "port": 3306,
    "ha": {
        "mode": "Ha",
        "replication_mode": "async"
    },
    "region": "eu-de",
    "datastore": {
        "type": "MySQL",
        "version": "8.0"
    },
    "volume": {
        "type": "ULTRAHIGH",
        "size": 40
    },
    "password": "admin_password",
    "private_ips": [],
    "public_ips": [],
    "db_user_name": "root",
    "availability_zone": "eu-de-01,eu-de-02",
    "vpc_id": "vpc_id",
    "subnet_id": "network_id_of_the_subnet",
    "security_group_id": "secgrp_id",
    "flavor_ref": "rds.mysql.c2.medium.ha",
    "switch_strategy": "reliability",
    "backup_strategy": {
        "start_time": "23:00-00:00",
        "keep_days": 10
    },
    "charge_info": {
        "charge_mode": "postPaid"
    }
}

instance = conn.rds.create_instance(**attrs)
print(instance)

Get Instance

This interface is used to get a RDS instance by ID or an instance of class Instance.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

instance = 'instance_id'
instance = conn.rds.get_instance(instance)
print(instance)

Find Instance

This interface is used to find an RDS instance by name or id.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

instance = 'instance_name_or_id'
instance = conn.rds.find_instance(instance)
print(instance)

Backup

When you create a DB instance, an automated backup policy is enabled by default. After the DB instance is created, you can modify the policy. RDS will automatically create full backups for DB instances based on your settings. Manual backups are user-initiated full backups of DB instances. They are retained until you delete them manually.

List Backups of an RDS Instance

This interface is used to query all backups of an RDS instance and to filter the output with query parameters.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

for backup in conn.rds.backups(instance='instance_id'):
    print(backup)

Create Backup

This interface is used to create a backup of an RDS instance with parameters.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

backup = conn.rds.create_backup(instance='instance_id',
                                name='my_backup',
                                description='This is new')
print(backup)

Wait for Backup

This interface is used to wait for a backup of an RDS instance to be completed.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

backup = conn.rds.create_backup(instance='instance_id',
                                name='my_backup',
                                description='This is new')
conn.rds.wait_for_backup(backup=backup, status='COMPLETED',
                         interval=2, wait=300)
print(backup)

Find Backup

This interface is used to find an RDS instance backup by name or id.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

instance = 'instance_name_or_id'
instance = conn.rds.find_instance(instance)
print(instance)

Get Instance Backup Policy

This interface is used to get the backup policy of a RDS instance by ID.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

instance = 'instance_id'
policy = conn.rds.get_instance_backup_policy(instance)
print(policy)

Set Instance Backup Policy (ToDo)

This interface is used to get the backup policy of a RDS instance by ID.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

instance = 'instance_id'
policy = conn.rds.get_instance_backup_policy(instance)
print(policy)

Get Instance Restore Time

This interface is used to get the restore time of a RDS instance by ID.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

instance = 'instance_id'
time = conn.rds.get_instance_restore_time(instance)
print(time)

Restore Instance

This interface is used to restore a RDS instance from existing backup.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

job_id = conn.rds.restore_instance(instance='instance_id',
                                   backup='backup_id',
                                   restore_time=None)
print(job_id)

Configurations (Parameter Template)

List Configurations

This interface is used to query all RDS configurations and to filter the output with query parameters.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

for config in conn.rds.configurations():
    print(config)

Create Configuration

This interface is used to create a RDS configuration template with parameters.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

datastore = {
    'type': 'mysql',
    'version': '8.0'
}
values = {
    'max_connections': '10'
}
config = conn.rds.create_configuration(name='configuration_name_or_id',
                                       description='my config',
                                       datastore=datastore,
                                       values=values)
print(config)

Get Configuration

This interface is used to get a RDS configuration template by ID.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

configuration = 'configuration_id'
configuration = conn.rds.get_configuration(configuration)
print(configuration)

Find Configuration

This interface is used to find a RDS configuration template by name or id.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

name_or_id = 'configuration_name_or_id'
configuration = conn.rds.find_configuration(name_or_id=name_or_id)
print(configuration)

Update Configuration

This interface is used to update a DNS configuration by using name or an instance of class Configuration and provide new attributes.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')


values = {
    'max_connections': '11'
}
name_or_id = 'configuration_name_or_id'
configuration = conn.rds.find_configuration(name_or_id=name_or_id)
configuration = conn.rds.create_configuration(config=configuration,
                                              name='configuration_update',
                                              description='my new config',
                                              values=values)
print(configuration)

Apply Configuration

This interface is used to apply a RDS configuration to existing RDS instances.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

configuration = '43f3a58705aa43bf9cfa4f06df80552epr01'
instance_list = [
    'instance_id1',
    'instance_id2'
]
response = conn.rds.apply_configuration(configuration=configuration,
                                        instances=instance_list)
print(response)

Datastores

List Datastore Types

This interface is used to query all RDS Datastore Types and to filter the output with query parameters.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

for ds in conn.rds.datastore_types():
    print(ds.name)

List Datastores

This interface is used to query all RDS Datastores of a RDS database and to filter the output with query parameters.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

db_type = 'MySQL'   # or PostgreSQL, or SQLServer
for ds in conn.rds.datastores(db_type):
    print(ds)

Flavors

List Flavors

This interface is used to query all flavors of a given RDS datastore and datastore version.

import openstack


openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')

datastore_name = 'ds_name'
version_name = 'version_name'
for flavor in conn.rds.flavors(datastore_name=datastore_name,
                               version_name=version_name):
    print(flavor)