Smarter AWS Route53 Helper

class smarter.apps.infrastructure.providers.aws.helpers.route53.AWSRoute53(aws_access_key_id=None, aws_secret_access_key=None, aws_region=None, aws_profile=None, shared_resource_identifier=None, environment=None, environment_domain=None, root_domain=None, debug_mode=False, init_info=None)[source]

Bases: AWSBase

The AWS Route53 helper: hosted zones and their record sets.

Names are compared without their trailing dot, which Route53 adds.

change_record_set(zone_id, action, record_set)[source]

Change one record set.

Parameters:
  • zone_id (str) – The hosted zone’s id.

  • action (str) – CREATE, UPSERT or DELETE.

  • record_set (dict[str, Any]) – The ResourceRecordSet. To delete one, it must match the existing one.

Return type:

None

create_hosted_zone(domain_name)[source]

Create a public hosted zone.

Return type:

dict[str, Any]

Returns:

The response of create_hosted_zone: the HostedZone, and its DelegationSet.

delete_hosted_zone(zone_id)[source]

Delete a hosted zone, and its record sets.

Route53 manages a zone’s NS and SOA records, which are deleted with the zone.

Return type:

None

get_hosted_zone(domain_name)[source]

Return the hosted zone of a domain.

Parameters:

domain_name (str) – The domain, with or without a trailing dot.

Return type:

dict[str, Any] | None

Returns:

The hosted zone, as list_hosted_zones describes it, or None.

get_hosted_zone_by_id(zone_id)[source]

Return a hosted zone, and its delegation set, by its id.

Example return value:

{
    "HostedZone": {"Id": "/hostedzone/Z148QEXAMPLE8V", "Name": "example.com."},
    "DelegationSet": {"NameServers": ["ns-2048.awsdns-64.com", "ns-2049.awsdns-65.net"]}
}
Parameters:

zone_id (str) – The hosted zone’s id, with or without the /hostedzone/ prefix.

Return type:

dict[str, Any] | None

Returns:

The hosted zone, or None if it does not exist.

list_hosted_zones()[source]

Return every hosted zone of the account.

Return type:

list[dict[str, Any]]

list_record_sets(zone_id)[source]

Return every record set of a hosted zone.

Return type:

list[dict[str, Any]]

property route53

The boto3 Route53 client.