Note

You are viewing the documentation for an older version of boto (boto2).

Boto3, the next version of Boto, is now stable and recommended for general use. It can be used side-by-side with Boto in the same project, so it is easy to start using Boto3 in your existing projects as well as new projects. Going forward, API updates and all new feature work will be focused on Boto3.

For more information, see the documentation for boto3.

route53

boto.route53.connection

class boto.route53.connection.Route53Connection(aws_access_key_id=None, aws_secret_access_key=None, port=None, proxy=None, proxy_port=None, host='route53.amazonaws.com', debug=0, security_token=None, validate_certs=True, https_connection_factory=None, profile_name=None)
DefaultHost = 'route53.amazonaws.com'

The default Route53 API endpoint to connect to.

POSTHCXMLBody = '<CreateHealthCheckRequest xmlns="%(xmlns)s">\n <CallerReference>%(caller_ref)s</CallerReference>\n %(health_check)s\n </CreateHealthCheckRequest>'
Version = '2013-04-01'

Route53 API version.

XMLNameSpace = 'https://route53.amazonaws.com/doc/2013-04-01/'

XML schema for this Route53 API version.

change_rrsets(hosted_zone_id, xml_body)

Create or change the authoritative DNS information for this Hosted Zone. Returns a Python data structure with information about the set of changes, including the Change ID.

Parameters:
  • hosted_zone_id (str) – The unique identifier for the Hosted Zone
  • xml_body (str) – The list of changes to be made, defined in the XML schema defined by the Route53 service.
create_health_check(health_check, caller_ref=None)

Create a new Health Check

Parameters:
  • health_check (HealthCheck) – HealthCheck object
  • caller_ref (str) – A unique string that identifies the request and that allows failed CreateHealthCheckRequest requests to be retried without the risk of executing the operation twice. If you don’t provide a value for this, boto will generate a Type 4 UUID and use that.
create_hosted_zone(domain_name, caller_ref=None, comment='', private_zone=False, vpc_id=None, vpc_region=None)

Create a new Hosted Zone. Returns a Python data structure with information about the newly created Hosted Zone.

Parameters:
  • domain_name (str) – The name of the domain. This should be a fully-specified domain, and should end with a final period as the last label indication. If you omit the final period, Amazon Route 53 assumes the domain is relative to the root. This is the name you have registered with your DNS registrar. It is also the name you will delegate from your registrar to the Amazon Route 53 delegation servers returned in response to this request.A list of strings with the image IDs wanted.
  • caller_ref (str) – A unique string that identifies the request and that allows failed CreateHostedZone requests to be retried without the risk of executing the operation twice. If you don’t provide a value for this, boto will generate a Type 4 UUID and use that.
  • comment (str) – Any comments you want to include about the hosted zone.
  • private_zone (bool) – Set True if creating a private hosted zone.
  • vpc_id (str) – When creating a private hosted zone, the VPC Id to associate to is required.
  • vpc_region (str) – When creating a private hosted zone, the region of the associated VPC is required.
create_zone(name, private_zone=False, vpc_id=None, vpc_region=None)

Create a new Hosted Zone. Returns a Zone object for the newly created Hosted Zone.

Parameters:
  • name (str) – The name of the domain. This should be a fully-specified domain, and should end with a final period as the last label indication. If you omit the final period, Amazon Route 53 assumes the domain is relative to the root. This is the name you have registered with your DNS registrar. It is also the name you will delegate from your registrar to the Amazon Route 53 delegation servers returned in response to this request.
  • private_zone (bool) – Set True if creating a private hosted zone.
  • vpc_id (str) – When creating a private hosted zone, the VPC Id to associate to is required.
  • vpc_region (str) – When creating a private hosted zone, the region of the associated VPC is required.
delete_health_check(health_check_id)

Delete a health check

Parameters:health_check_id (str) – ID of the health check to delete
delete_hosted_zone(hosted_zone_id)

Delete the hosted zone specified by the given id.

Parameters:hosted_zone_id (str) – The hosted zone’s id
get_all_hosted_zones(start_marker=None, zone_list=None)

Returns a Python data structure with information about all Hosted Zones defined for the AWS account.

Parameters:
  • start_marker (int) – start marker to pass when fetching additional results after a truncated list
  • zone_list (list) – a HostedZones list to prepend to results
get_all_rrsets(hosted_zone_id, type=None, name=None, identifier=None, maxitems=None)

Retrieve the Resource Record Sets defined for this Hosted Zone. Returns the raw XML data returned by the Route53 call.

Parameters:
  • hosted_zone_id (str) – The unique identifier for the Hosted Zone
  • type (str) –

    The type of resource record set to begin the record listing from. Valid choices are:

    • A
    • AAAA
    • CNAME
    • MX
    • NS
    • PTR
    • SOA
    • SPF
    • SRV
    • TXT

    Valid values for weighted resource record sets:

    • A
    • AAAA
    • CNAME
    • TXT

    Valid values for Zone Apex Aliases:

    • A
    • AAAA
  • name (str) – The first name in the lexicographic ordering of domain names to be retrieved
  • identifier (str) – In a hosted zone that includes weighted resource record sets (multiple resource record sets with the same DNS name and type that are differentiated only by SetIdentifier), if results were truncated for a given DNS name and type, the value of SetIdentifier for the next resource record set that has the current DNS name and type
  • maxitems (int) – The maximum number of records
get_change(change_id)

Get information about a proposed set of changes, as submitted by the change_rrsets method. Returns a Python data structure with status information about the changes.

Parameters:change_id (str) – The unique identifier for the set of changes. This ID is returned in the response to the change_rrsets method.
get_checker_ip_ranges()

Return a list of Route53 healthcheck IP ranges

get_hosted_zone(hosted_zone_id)

Get detailed information about a particular Hosted Zone.

Parameters:hosted_zone_id (str) – The unique identifier for the Hosted Zone
get_hosted_zone_by_name(hosted_zone_name)

Get detailed information about a particular Hosted Zone.

Parameters:hosted_zone_name (str) – The fully qualified domain name for the Hosted Zone
get_list_health_checks(maxitems=None, marker=None)

Return a list of health checks

Parameters:
  • maxitems (int) – Maximum number of items to return
  • marker (str) – marker to get next set of items to list
get_zone(name)

Returns a Zone object for the specified Hosted Zone.

Parameters:name – The name of the domain. This should be a fully-specified domain, and should end with a final period as the last label indication.
get_zones()

Returns a list of Zone objects, one for each of the Hosted Zones defined for the AWS account.

Return type:list
Returns:A list of Zone objects.
make_request(action, path, headers=None, data='', params=None)

boto.route53.exception

exception boto.route53.exception.DNSServerError(status, reason, body=None, *args)

boto.route53.healthcheck

From http://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateHealthCheck.html

POST /2013-04-01/healthcheck HTTP/1.1

<?xml version=”1.0” encoding=”UTF-8”?> <CreateHealthCheckRequest xmlns=”https://route53.amazonaws.com/doc/2013-04-01/“>

<CallerReference>unique description</CallerReference> <HealthCheckConfig>

<IPAddress>IP address of the endpoint to check</IPAddress> <Port>port on the endpoint to check</Port> <Type>HTTP | HTTPS | HTTP_STR_MATCH | HTTPS_STR_MATCH | TCP</Type> <ResourcePath>path of the file that

you want Amazon Route 53 to request</ResourcePath>
<FullyQualifiedDomainName>domain name of the
endpoint to check</FullyQualifiedDomainName>
<SearchString>if Type is HTTP_STR_MATCH or HTTPS_STR_MATCH,
the string to search for in the response body from the specified resource</SearchString>

<RequestInterval>10 | 30</RequestInterval> <FailureThreshold>integer between 1 and 10</FailureThreshold>

</HealthCheckConfig>

</CreateHealthCheckRequest>

class boto.route53.healthcheck.HealthCheck(ip_addr, port, hc_type, resource_path, fqdn=None, string_match=None, request_interval=30, failure_threshold=3)

An individual health check

HealthCheck object

Parameters:
  • ip_addr (str) – Optional IP Address
  • port (int) – Port to check
  • hc_type (str) – One of HTTP | HTTPS | HTTP_STR_MATCH | HTTPS_STR_MATCH | TCP
  • resource_path (str) – Path to check
  • fqdn (str) – domain name of the endpoint to check
  • string_match (str) – if hc_type is HTTP_STR_MATCH or HTTPS_STR_MATCH, the string to search for in the response body from the specified resource
  • request_interval (int) – The number of seconds between the time that Amazon Route 53 gets a response from your endpoint and the time that it sends the next health-check request.
  • failure_threshold (int) – The number of consecutive health checks that an endpoint must pass or fail for Amazon Route 53 to change the current status of the endpoint from unhealthy to healthy or vice versa.
POSTXMLBody = '\n <HealthCheckConfig>\n %(ip_addr_part)s\n <Port>%(port)s</Port>\n <Type>%(type)s</Type>\n <ResourcePath>%(resource_path)s</ResourcePath>\n %(fqdn_part)s\n %(string_match_part)s\n %(request_interval)s\n <FailureThreshold>%(failure_threshold)s</FailureThreshold>\n </HealthCheckConfig>\n '
XMLFQDNPart = '<FullyQualifiedDomainName>%(fqdn)s</FullyQualifiedDomainName>'
XMLIpAddrPart = '<IPAddress>%(ip_addr)s</IPAddress>'
XMLRequestIntervalPart = '<RequestInterval>%(request_interval)d</RequestInterval>'
XMLStringMatchPart = '<SearchString>%(string_match)s</SearchString>'
to_xml()
valid_request_intervals = (10, 30)

boto.route53.hostedzone

class boto.route53.hostedzone.HostedZone(id=None, name=None, owner=None, version=None, caller_reference=None)
endElement(name, value, connection)
startElement(name, attrs, connection)

boto.route53.record

class boto.route53.record.Record(name=None, type=None, ttl=600, resource_records=None, alias_hosted_zone_id=None, alias_dns_name=None, identifier=None, weight=None, region=None, alias_evaluate_target_health=None, health_check=None, failover=None)

An individual ResourceRecordSet

AliasBody = '<AliasTarget>\n <HostedZoneId>%(hosted_zone_id)s</HostedZoneId>\n <DNSName>%(dns_name)s</DNSName>\n %(eval_target_health)s\n </AliasTarget>'
EvaluateTargetHealth = '<EvaluateTargetHealth>%s</EvaluateTargetHealth>'
FailoverBody = '\n <SetIdentifier>%(identifier)s</SetIdentifier>\n <Failover>%(failover)s</Failover>\n '
HealthCheckBody = '<HealthCheckId>%s</HealthCheckId>'
RRRBody = '\n <SetIdentifier>%(identifier)s</SetIdentifier>\n <Region>%(region)s</Region>\n '
ResourceRecordBody = '<ResourceRecord>\n <Value>%s</Value>\n </ResourceRecord>'
ResourceRecordsBody = '\n <TTL>%(ttl)s</TTL>\n <ResourceRecords>\n %(records)s\n </ResourceRecords>'
WRRBody = '\n <SetIdentifier>%(identifier)s</SetIdentifier>\n <Weight>%(weight)s</Weight>\n '
XMLBody = '<ResourceRecordSet>\n <Name>%(name)s</Name>\n <Type>%(type)s</Type>\n %(weight)s\n %(body)s\n %(health_check)s\n </ResourceRecordSet>'
add_value(value)

Add a resource record value

endElement(name, value, connection)
set_alias(alias_hosted_zone_id, alias_dns_name, alias_evaluate_target_health=False)

Make this an alias resource record set

startElement(name, attrs, connection)
to_print()
to_xml()

Spit this resource record set out as XML

class boto.route53.record.ResourceRecordSets(connection=None, hosted_zone_id=None, comment=None)

A list of resource records.

Variables:
  • hosted_zone_id – The ID of the hosted zone.
  • comment – A comment that will be stored with the change.
  • changes – A list of changes.
ChangeResourceRecordSetsBody = '<?xml version="1.0" encoding="UTF-8"?>\n <ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/">\n <ChangeBatch>\n <Comment>%(comment)s</Comment>\n <Changes>%(changes)s</Changes>\n </ChangeBatch>\n </ChangeResourceRecordSetsRequest>'
ChangeXML = '<Change>\n <Action>%(action)s</Action>\n %(record)s\n </Change>'
add_change(action, name, type, ttl=600, alias_hosted_zone_id=None, alias_dns_name=None, identifier=None, weight=None, region=None, alias_evaluate_target_health=None, health_check=None, failover=None)

Add a change request to the set.

Parameters:
  • action (str) – The action to perform (‘CREATE’|’DELETE’|’UPSERT’)
  • name (str) – The name of the domain you want to perform the action on.
  • type (str) –

    The DNS record type. Valid values are:

    • A
    • AAAA
    • CNAME
    • MX
    • NS
    • PTR
    • SOA
    • SPF
    • SRV
    • TXT
  • ttl (int) – The resource record cache time to live (TTL), in seconds.
  • alias_dns_name (str) – Alias resource record sets only The value of the hosted zone ID, CanonicalHostedZoneNameId, for the LoadBalancer.
  • alias_hosted_zone_id (str) – Alias resource record sets only Information about the domain to which you are redirecting traffic.
  • identifier (str) – Weighted and latency-based resource record sets only An identifier that differentiates among multiple resource record sets that have the same combination of DNS name and type.
  • weight (int) – Weighted resource record sets only Among resource record sets that have the same combination of DNS name and type, a value that determines what portion of traffic for the current resource record set is routed to the associated location
  • region (str) – Latency-based resource record sets only Among resource record sets that have the same combination of DNS name and type, a value that determines which region this should be associated with for the latency-based routing
  • alias_evaluate_target_health (bool) – Required for alias resource record sets Indicates whether this Resource Record Set should respect the health status of any health checks associated with the ALIAS target record which it is linked to.
  • health_check (str) – Health check to associate with this record
  • failover (str) – Failover resource record sets only Whether this is the primary or secondary resource record set.
add_change_record(action, change)

Add an existing record to a change set with the specified action

commit()

Commit this change

endElement(name, value, connection)

Overwritten to also add the NextRecordName, NextRecordType and NextRecordIdentifier to the base object

to_xml()

Convert this ResourceRecordSet into XML to be saved via the ChangeResourceRecordSetsRequest

boto.route53.status

class boto.route53.status.Status(route53connection, change_dict)
update()

Update the status of this request.

boto.route53.zone

class boto.route53.zone.Zone(route53connection, zone_dict)

A Route53 Zone.

Variables:
add_a(name, value, ttl=None, identifier=None, comment='')

Add a new A record to this Zone. See _new_record for parameter documentation. Returns a Status object.

add_cname(name, value, ttl=None, identifier=None, comment='')

Add a new CNAME record to this Zone. See _new_record for parameter documentation. Returns a Status object.

add_mx(name, records, ttl=None, identifier=None, comment='')

Add a new MX record to this Zone. See _new_record for parameter documentation. Returns a Status object.

add_record(resource_type, name, value, ttl=60, identifier=None, comment='')

Add a new record to this Zone. See _new_record for parameter documentation. Returns a Status object.

delete()

Request that this zone be deleted by Amazon.

delete_a(name, identifier=None, all=False)

Delete an A record matching name and identifier from this Zone. Returns a Status object.

If there is more than one match delete all matching records if all is True, otherwise throws TooManyRecordsException.

delete_cname(name, identifier=None, all=False)

Delete a CNAME record matching name and identifier from this Zone. Returns a Status object.

If there is more than one match delete all matching records if all is True, otherwise throws TooManyRecordsException.

delete_mx(name, identifier=None, all=False)

Delete an MX record matching name and identifier from this Zone. Returns a Status object.

If there is more than one match delete all matching records if all is True, otherwise throws TooManyRecordsException.

delete_record(record, comment='')

Delete one or more records from this Zone. Returns a Status object.

Parameters:
  • record – A ResourceRecord (e.g. returned by find_records) or list, tuple, or set of ResourceRecords.
  • comment (str) – A comment that will be stored with the change.
find_records(name, type, desired=1, all=False, identifier=None)

Search this Zone for records that match given parameters. Returns None if no results, a ResourceRecord if one result, or a ResourceRecordSets if more than one result.

Parameters:
  • name (str) – The name of the records should match this parameter
  • type (str) – The type of the records should match this parameter
  • desired (int) – The number of desired results. If the number of matching records in the Zone exceeds the value of this parameter, throw TooManyRecordsException
  • all (Boolean) – If true return all records that match name, type, and identifier parameters
  • identifier (Tuple) –

    A tuple specifying WRR or LBR attributes. Valid forms are:

    • (str, int): WRR record [e.g. (‘foo’,10)]
    • (str, str): LBR record [e.g. (‘foo’,’us-east-1’)
get_a(name, all=False)

Search this Zone for A records that match name.

Returns a ResourceRecord.

If there is more than one match return all as a ResourceRecordSets if all is True, otherwise throws TooManyRecordsException.

get_cname(name, all=False)

Search this Zone for CNAME records that match name.

Returns a ResourceRecord.

If there is more than one match return all as a ResourceRecordSets if all is True, otherwise throws TooManyRecordsException.

get_mx(name, all=False)

Search this Zone for MX records that match name.

Returns a ResourceRecord.

If there is more than one match return all as a ResourceRecordSets if all is True, otherwise throws TooManyRecordsException.

get_nameservers()

Get the list of nameservers for this zone.

get_records()

Return a ResourceRecordsSets for all of the records in this zone.

update_a(name, value, ttl=None, identifier=None, comment='')

Update the given A record in this Zone to a new value, ttl, and identifier. Returns a Status object.

Will throw TooManyRecordsException is name, value does not match a single record.

update_cname(name, value, ttl=None, identifier=None, comment='')

Update the given CNAME record in this Zone to a new value, ttl, and identifier. Returns a Status object.

Will throw TooManyRecordsException is name, value does not match a single record.

update_mx(name, value, ttl=None, identifier=None, comment='')

Update the given MX record in this Zone to a new value, ttl, and identifier. Returns a Status object.

Will throw TooManyRecordsException is name, value does not match a single record.

update_record(old_record, new_value, new_ttl=None, new_identifier=None, comment='')

Update an existing record in this Zone. Returns a Status object.

Parameters:old_record (ResourceRecord) – A ResourceRecord (e.g. returned by find_records)

See _new_record for additional parameter documentation.