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.
IPv6¶
AuroraDNS fully supports IPv6:
DNS queries over IPv6
AAAA records
Health checks over IPv6
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¶
- 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
- 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
- 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 createdtype (
AuroraDNSHealthCheckType
) – The type of health check to be createdhostname (
str
) – The hostname of the target to monitorport (
int
) – The port of the target to monitor. E.g. 80 for HTTPpath (
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 runextra (
dict
) – (optional) Extra attributes (driver specific).
- Returns
- 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 ishealth_check_id (
str
) – ID of the required health check
- Returns
- 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 updatedtype (
AuroraDNSHealthCheckType
) – (optional) The type of health check to be createdhostname (
str
) – (optional) The hostname of the target to monitoripaddress (
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 HTTPpath (
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 runextra (
dict
) – (optional) Extra attributes (driver specific).
- Returns
- 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.
- get_record(zone_id, record_id)[source]¶
Return a Record instance.
- Parameters
zone_id (
str
) – ID of the required zonerecord_id (
str
) – ID of the required record
- Return type
Record
- get_zone(zone_id)[source]¶
Return a Zone instance.
- Parameters
zone_id (
str
) – ID of the required zone- Return 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
- 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
- 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 idhostname (
str
) – Hostname or FQDN of the targetipaddress (
str
) – IPv4 or IPv6 address of the targetport (
int
) – The port on the target to monitorinterval (
int
) – The interval of the health checkpath (
str
) – The path to monitor on the targetthreshold (
int
) – The threshold of before marking a check as failedhealth (
bool
) – The current health of the health checkenabled (
bool
) – If the health check is currently enabledzone (
Zone
) – Zone instance.driver (
DNSDriver
) – DNSDriver instance.extra (
dict
) – (optional) Extra attributes (driver specific).