Domain Name Service (DNS)¶
Domain Name Services (DNS) assign IP addresses to meaningful domain names (such as www.telekom.de). These plain-text names are much easier to remember than 12-digit numbers. Thanks to DNS resolution, users can access network applications by entering the domain name. As such, the DNS also simplifies work in public clouds. It enables users to integrate cloud resources in their own company networks with ease – they then see the services as part of their internal network. Moreover, using domain names instead of IP addresses also facilitates administrative tasks and makes clouds more user-friendly. The Open Telekom Cloud also offers a Domain Name Service (DNS). DNS is available via the Open Telekom Cloud console and features anti-DDoS protection. In addition to references to external IP addresses, the solution can also be used for services within the Open Telekom Cloud. Pricing of the Domain Name Service is based on scaled prices depending on the number of domains stored. If a domain is created and remains configured for more than 24 hours, it is billed once for the entire month. A usage-based payment is then added to this (domain requests).
Zone¶
There are private and public zones available. A large number of DNS servers are available on the Internet, constituting DNS domain namespaces. Each DNS server has its own domain name resolution responsibilities. Only when a DNS server cannot resolve a domain name itself, it forwards the request to another DNS server. Domain namespaces are managed by segment. That is, a large space is divided into several separately hosted zones. Each public zone is a part of the namespace that is administered by a particular DNS server. For example, a DNS server is configured on the cloud platform to resolve all domain names in the namespace example.com. Public zones are accessible to hosts on the Internet. A private zone is a namespace in which domain names are resolved by private DNS servers It records the route for a domain name to be accessed in one or more VPCs. Private zones are accessible only to hosts in specified VPCs.
List Zones¶
This interface is used to query all DNS Zones and to filter the output with query parameters.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
for zone in conn.dns.zones(zone_type='private'):
print(zone)
Create Zone¶
This interface is used to create a DNS zone with parameters.
import openstack
from otcextensions.sdk.dns.v2.zone import Router
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
zone = conn.dns.create_zone(
name='private-zone',
description='My private Zone',
zone_type='private',
ttl=300,
email='zone-admin@example.com',
router=Router(router_id='vpc_id',
router_region='eu-de'
)
)
print(zone)
'''
attrs = {
"name": "private-zone.",
"description": "My private Zone",
"zone_type": "private",
"email": "zone-admin@example.com",
"router": {
"router_id": "vpc_id",
"router_region": "eu-de"
}
}
zone = conn.dns.create_zone(**attrs)
print(zone)
'''
Get Zone¶
This interface is used to get a DNS zone by ID
or an instance of class
Zone
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
zone = 'zone_id'
zone = conn.dns.get_zone(zone)
print(zone)
Find Zone¶
This interface is used to find a DNS zone by id or name.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
zone = 'private-zone.'
zone = conn.dns.find_zone(zone)
print(zone)
Update Zone¶
This interface is used to update DNS zone parameters by
id or an instance of class
Zone
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
zone = conn.dns.update_zone(
zone='zone_id',
description='My other private Zone',
ttl=400
)
print(zone)
Delete Zone¶
This interface is used to delete a DNS zone by
id or an instance of class
Zone
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
zone = 'zone_id'
zone = conn.dns.delete_zone(zone)
Nameserver¶
List Nameservers¶
This interface is used to query all DNS Nameservers of a zone and to filter the output with query parameters.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
zone = 'zone_id'
for nameserver in conn.dns.nameservers(zone=zone):
print(nameserver)
Recordsets¶
List Recordsets¶
This interface is used to query all Recordsets of a zone and to filter the output with query parameters.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
zone = 'zone_id'
for nameserver in conn.dns.nameservers(zone=zone):
print(nameserver)
Create Recordsets¶
This interface is used to create a DNS Recordset with parameters.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
recordset = conn.dns.create_recordset(
zone='zone_id',
name='recordset.my-zone.',
description='My new recordset',
type='A',
ttl=300,
records=[
'192.168.2.4'
]
)
print(recordset)
Get Recordset¶
This interface is used to get a DNS recordset by ID
or an instance of class
Recordset
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
zone = 'zone_id'
recordset = 'recordset_id'
recordset = conn.dns.get_recordset(zone=zone, recordset=recordset)
print(recordset)
Find Recordset¶
This interface is used to find a DNS recordset by id or name.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
zone = 'zone_id'
name_or_id = 'recordset_name_or_id'
recordset = conn.dns.find_recordset(zone=zone, name_or_id=name_or_id)
print(recordset)
Update Recordset¶
This interface is used to update DNS recordset parameters by
id or an instance of class
Recordset
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
recordset = conn.dns.update_recordset(
zone_id='zone_id',
recordset='recordset_id',
description='This is another description',
ttl=3600,
records=[
'192.168.2.4',
'192.168.2.5'
]
)
print(recordset)
Delete Recordset¶
This interface is used to delete a DNS recordset by
id or an instance of class
Recordset
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
zone = 'zone_id'
recordset = 'recordset_id'
conn.dns.delete_recordset(zone=zone, recordset=recordset, ignore_missing=True)
Floating IP PTR Records¶
List Floating IP PTR Record¶
This interface is used to query all Floating IP PTR records to filter the output with query parameters.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
for fip in conn.dns.floating_ips():
print(fip)
Set Floating IP PTR Record¶
This interface is used to set a DNS floating IP PTR record with parameters.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
fip = conn.dns.set_floating_ip(
floating_ip='floating_ip_id',
ptrdname='test.domain.',
description='My Floating IP PTR record',
ttl=300
)
print(fip)
Get Floating IP PTR Record¶
This interface is used to get a DNS floating IP PTR record by ID
or an instance of class
FloatingIP
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
fip = '<region>:<floating_ip_id>'
# example: fip = 'eu-de:b700387d-5209-45b3-ac45-313ded1077cc'
fip = conn.dns.get_floating_ip(fip)
print(fip)
Update Floating IP PTR Record¶
This interface is used to update DNS floating IP PTR record parameters by
id or an instance of class
FloatingIP
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
floating_ip = conn.dns.update_floating_ip(
floating_ip='floating_ip_id',
ptrdname='update.test.',
description='My updated Floating IP PTR record',
ttl=3600
)
print(floating_ip)
Unset Floating IP PTR Record¶
This interface is used to unset a DNS floating IP PTR record with parameters.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
floating_ip = 'floating_ip_id'
conn.dns.unset_floating_ip(floating_ip=floating_ip)