AuroraDNS DNS driver documentation¶
PCextreme B.V. is a Dutch cloud provider. It provides a public cloud offering under the name AuroraCompute. All cloud services are under the family name Aurora.
AuroraDNS is a highly available DNS service which also provides health checking.
Records can be attached to a health check. When this health check becomes unhealthy this record will no longer be served.
This provides the possibility to create loadbalancing over multiple servers without the requirement of a central loadbalancer in the network. It is also provider agnostic, health checks can point to any IP/Host on the internet.
Instantiating a driver¶
When you instantiate a driver, you need to pass a your key
and secret
to the driver constructor. These can be obtained in the control panel of
AuroraDNS.
For example:
from libcloud.dns.types import Provider
from libcloud.dns.providers import get_driver
cls = get_driver(Provider.AURORADNS)
driver = cls('myapikey', 'mysecret')
Disabling and enabling records¶
Records in can be disabled and enabled. By default all new records are enabled, but this property can be set during creation and can be updated.
For example:
from libcloud.dns.types import Provider
from libcloud.dns.providers import get_driver
cls = get_driver(Provider.AURORADNS)
driver = cls('myapikey', 'mysecret')
In this example we create a record, but disable it. This means it will not be served.
Afterwards we enable the record and this make the DNS server serve this specific record.
Health Checks¶
AuroraDNS has support for Health Checks which will disable all records attached to that health check should it fail. With this you can create DNS based loadbalancing over multiple records.
In the example below we create a health check and afterwards attach a newly created record to this health check.
For example:
from libcloud.dns.types import Provider, RecordType
from libcloud.dns.providers import get_driver
from libcloud.dns.drivers.auroradns import AuroraDNSHealthCheckType
cls = get_driver(Provider.AURORADNS)
driver = cls('myapikey', 'mysecret')
zone = driver.get_zone('auroradns.eu')
health_check = driver.ex_create_healthcheck(zone=zone,
type=AuroraDNSHealthCheckType.HTTP,
hostname='web01.auroradns.eu',
path='/',
port=80,
interval=10,
threshold=5)
record = zone.create_record(name='www', type=RecordType.AAAA,
data='2a00:f10:452::1',
extra={'health_check_id': health_check.id})
API Docs¶
-
class
libcloud.dns.drivers.auroradns.
AuroraDNSDriver
(key, secret=None, secure=True, host=None, port=None, **kwargs)[source]¶ Parameters: - key (
str
) – API key or username to used (required) - secret (
str
) – Secret password to be used (required) - secure (
bool
) – Whether to use HTTPS or HTTP. Note: Some providers only support HTTPS, and it is on by default. - host (
str
) – Override hostname used for connections. - port (
int
) – Override port used for connections.
Returns: None
-
connectionCls
¶ alias of
AuroraDNSConnection
-
create_record
(name, zone, type, data, extra=None)[source]¶ Create a new record.
Parameters: - name (
str
) – Record name without the domain name (e.g. www). Note: If you want to create a record for a base domain name, you should specify empty string (‘’) for this argument. - zone (
Zone
) – Zone where the requested record is created. - type (
RecordType
) – DNS record type (A, AAAA, …). - data (
str
) – Data for the record (depends on the record type). - extra (
dict
) – Extra attributes (driver specific). (optional)
Return type: Record
- name (
-
create_zone
(domain, type='master', ttl=None, extra=None)[source]¶ Create a new zone.
Parameters: - domain (
str
) – Zone domain name (e.g. example.com) - type (
str
) – Zone type (master / slave). - ttl (
int
) – TTL for new records. (optional) - extra (
dict
) – Extra attributes (driver specific). (optional)
Return type: Zone
- domain (
-
delete_record
(record)[source]¶ Delete a record.
Parameters: record ( Record
) – Record to delete.Return type: bool
-
delete_zone
(zone)[source]¶ Delete a zone.
Note: This will delete all the records belonging to this zone.
Parameters: zone ( Zone
) – Zone to delete.Return type: bool
-
ex_create_healthcheck
(zone, type, hostname, port, path, interval, threshold, ipaddress=None, enabled=True, extra=None)[source]¶ Create a new Health Check in a zone
Parameters: - zone (
Zone
) – Zone in which the health check should be created - type (
AuroraDNSHealthCheckType
) – The type of health check to be created - hostname (
str
) – The hostname of the target to monitor - port (
int
) – The port of the target to monitor. E.g. 80 for HTTP - path (
str
) – The path of the target to monitor. Only used by HTTP at this moment. Usually this is simple /. - interval (
int
) – The interval of checks. 10, 30 or 60 seconds. - threshold (
int
) – The threshold of failures before the healthcheck is marked as failed. - ipaddress (
str
) – (optional) The IP Address of the target to monitor. You can pass a empty string if this is not required. - enabled (
bool
) – (optional) If this healthcheck is enabled to run - extra (
dict
) – (optional) Extra attributes (driver specific).
Returns: - zone (
-
ex_delete_healthcheck
(healthcheck)[source]¶ Remove an existing Health Check
Parameters: zone ( AuroraDNSHealthCheck
) – The healthcheck which has to be removed
-
ex_get_healthcheck
(zone, health_check_id)[source]¶ Get a single Health Check from a zone
Parameters: - zone (
Zone
) – Zone in which the health check is - health_check_id (
str
) – ID of the required health check
Returns: - zone (
-
ex_list_healthchecks
(zone)[source]¶ List all Health Checks in a zone.
Parameters: zone ( Zone
) – Zone to list health checks for.Returns: list
ofAuroraDNSHealthCheck
-
ex_update_healthcheck
(healthcheck, type=None, hostname=None, ipaddress=None, port=None, path=None, interval=None, threshold=None, enabled=None, extra=None)[source]¶ Update an existing Health Check
Parameters: - zone (
AuroraDNSHealthCheck
) – The healthcheck which has to be updated - type (
AuroraDNSHealthCheckType
) – (optional) The type of health check to be created - hostname (
str
) – (optional) The hostname of the target to monitor - ipaddress (
str
) – (optional) The IP Address of the target to monitor. You can pass a empty string if this is not required. - port (
int
) – (optional) The port of the target to monitor. E.g. 80 for HTTP - path (
str
) – (optional) The path of the target to monitor. Only used by HTTP at this moment. Usually just ‘/’. - interval (
int
) – (optional) The interval of checks. 10, 30 or 60 seconds. - threshold (
int
) – (optional) The threshold of failures before the healthcheck is marked as failed. - enabled (
bool
) – (optional) If this healthcheck is enabled to run - extra (
dict
) – (optional) Extra attributes (driver specific).
Returns: - zone (
-
export_zone_to_bind_format
(zone)¶ Export Zone object to the BIND compatible format.
Parameters: zone ( Zone
) – Zone to export.Returns: Zone data in BIND compatible format. Return type: str
-
export_zone_to_bind_zone_file
(zone, file_path)¶ Export Zone object to the BIND compatible format and write result to a file.
Parameters: - zone (
Zone
) – Zone to export. - file_path (
str
) – File path where the output will be saved.
- zone (
-
get_record
(zone_id, record_id)[source]¶ Return a Record instance.
Parameters: - zone_id (
str
) – ID of the required zone - record_id (
str
) – ID of the required record
Return type: Record
- zone_id (
-
get_zone
(zone_id)[source]¶ Return a Zone instance.
Parameters: zone_id ( str
) – ID of the required zoneReturn type: Zone
-
iterate_records
(zone)[source]¶ Return a generator to iterate over records for the provided zone.
Parameters: zone ( Zone
) – Zone to list records for.Return type: generator
ofRecord
-
iterate_zones
()[source]¶ Return a generator to iterate over available zones.
Return type: generator
ofZone
-
list_record_types
()[source]¶ Return a list of RecordType objects supported by the provider.
Returns: list
ofRecordType
-
list_records
(zone)¶ Return a list of records for the provided zone.
Parameters: zone ( Zone
) – Zone to list records for.Returns: list
ofRecord
-
list_zones
()¶ Return a list of zones.
Returns: list
ofZone
-
update_record
(record, name, type, data, extra=None)[source]¶ Update an existing record.
Parameters: - record (
Record
) – Record to update. - name (
str
) – Record name without the domain name (e.g. www). Note: If you want to create a record for a base domain name, you should specify empty string (‘’) for this argument. - type (
RecordType
) – DNS record type (A, AAAA, …). - data (
str
) – Data for the record (depends on the record type). - extra (
dict
) – (optional) Extra attributes (driver specific).
Return type: Record
- record (
-
update_zone
(zone, domain, type='master', ttl=None, extra=None)¶ Update an existing zone.
Parameters: - zone (
Zone
) – Zone to update. - domain (
str
) – Zone domain name (e.g. example.com) - type (
str
) – Zone type (master / slave). - ttl (
int
) – TTL for new records. (optional) - extra (
dict
) – Extra attributes (driver specific). (optional)
Return type: Zone
- zone (
- key (
-
class
libcloud.dns.drivers.auroradns.
AuroraDNSHealthCheck
(id, type, hostname, ipaddress, port, interval, path, threshold, health, enabled, zone, driver, extra=None)[source]¶ AuroraDNS Healthcheck resource.
Parameters: - id (
str
) – Healthcheck id - hostname (
str
) – Hostname or FQDN of the target - ipaddress (
str
) – IPv4 or IPv6 address of the target - port (
int
) – The port on the target to monitor - interval (
int
) – The interval of the health check - path (
str
) – The path to monitor on the target - threshold (
int
) – The threshold of before marking a check as failed - health (
bool
) – The current health of the health check - enabled (
bool
) – If the health check is currently enabled - zone (
Zone
) – Zone instance. - driver (
DNSDriver
) – DNSDriver instance. - extra (
dict
) – (optional) Extra attributes (driver specific).
- id (