Menu
Amazon Route 53
API Reference (API Version 2013-04-01)

ChangeResourceRecordSets

Service: Amazon Route 53

Create, change, update, or delete authoritative DNS information on all Amazon Route 53 servers. Send a POST request to:

/2013-04-01/hostedzone/Amazon Route 53 hosted Zone ID/rrset resource.

The request body must include a document with a ChangeResourceRecordSetsRequest element. The request body contains a list of change items, known as a change batch. Change batches are considered transactional changes. When using the Amazon Route 53 API to change resource record sets, Amazon Route 53 either makes all or none of the changes in a change batch request. This ensures that Amazon Route 53 never partially implements the intended changes to the resource record sets in a hosted zone.

For example, a change batch request that deletes the CNAME record for www.example.com and creates an alias resource record set for www.example.com. Amazon Route 53 deletes the first resource record set and creates the second resource record set in a single operation. If either the DELETE or the CREATE action fails, then both changes (plus any other changes in the batch) fail, and the original CNAME record continues to exist.

Important

Due to the nature of transactional changes, you cannot delete the same resource record set more than once in a single change batch. If you attempt to delete the same change batch more than once, Amazon Route 53 returns an InvalidChangeBatch error.

Note

To create resource record sets for complex routing configurations, use either the traffic flow visual editor in the Amazon Route 53 console or the API actions for traffic policies and traffic policy instances. Save the configuration as a traffic policy, then associate the traffic policy with one or more domain names (such as example.com) or subdomain names (such as www.example.com), in the same hosted zone or in multiple hosted zones. You can roll back the updates if the new configuration isn't performing as expected. For more information, see Using Traffic Flow to Route DNS Traffic in the Amazon Route 53 Developer Guide.

Use ChangeResourceRecordsSetsRequest to perform the following actions:

  • CREATE: Creates a resource record set that has the specified values.

  • DELETE: Deletes an existing resource record set that has the specified values for Name, Type, Set Identifier (for code latency, weighted, geolocation, and failover resource record sets), and TTL (except alias resource record sets, for which the TTL is determined by the AWS resource you're routing queries to).

  • UPSERT: If a resource record set does not already exist, AWS creates it. If a resource set does exist, Amazon Route 53 updates it with the values in the request. Amazon Route 53 can update an existing resource record set only when all of the following values match: Name, Type, and Set Identifier (for weighted, latency, geolocation, and failover resource record sets).

In response to a ChangeResourceRecordSets request, the DNS data is changed on all Amazon Route 53 DNS servers. Initially, the status of a change is PENDING, meaning the change has not yet propagated to all the authoritative Amazon Route 53 DNS servers. When the change is propagated to all hosts, the change returns a status of INSYNC.

After sending a change request, confirm your change has propagated to all Amazon Route 53 DNS servers. Changes generally propagate to all Amazon Route 53 name servers in a few minutes. In rare circumstances, propagation can take up to 30 minutes. For more information, see GetChange.

For information about the limits on a ChangeResourceRecordSets request, see Limits in the Amazon Route 53 Developer Guide.

Request Syntax

POST /2013-04-01/hostedzone/Id/rrset/ HTTP/1.1
<?xml version="1.0" encoding="UTF-8"?>
<ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
   <ChangeBatch>
      <Changes>
         <Change>
            <Action>string</Action>
            <ResourceRecordSet>
               <AliasTarget>
                  <DNSName>string</DNSName>
                  <EvaluateTargetHealth>boolean</EvaluateTargetHealth>
                  <HostedZoneId>string</HostedZoneId>
               </AliasTarget>
               <Failover>string</Failover>
               <GeoLocation>
                  <ContinentCode>string</ContinentCode>
                  <CountryCode>string</CountryCode>
                  <SubdivisionCode>string</SubdivisionCode>
               </GeoLocation>
               <HealthCheckId>string</HealthCheckId>
               <Name>string</Name>
               <Region>string</Region>
               <ResourceRecords>
                  <ResourceRecord>
                     <Value>string</Value>
                  </ResourceRecord></ResourceRecords>
               <SetIdentifier>string</SetIdentifier>
               <TrafficPolicyInstanceId>string</TrafficPolicyInstanceId>
               <TTL>long</TTL>
               <Type>string</Type>
               <Weight>long</Weight>
            </ResourceRecordSet>
         </Change></Changes>
      <Comment>string</Comment>
   </ChangeBatch>
</ChangeResourceRecordSetsRequest>

URI Request Parameters

The request requires the following URI parameters.

Id

The ID of the hosted zone that contains the resource record sets that you want to change.

Length Constraints: Maximum length of 32.

Request Body

The request requires the following data in XML format.

ChangeResourceRecordSetsRequest

Root level tag for the ChangeResourceRecordSetsRequest parameters.

Required: Yes

ChangeBatch

A complex type that contains an optional comment and the Changes element.

Type: ChangeBatch object

Required: Yes

Response Syntax

HTTP/1.1 200
<?xml version="1.0" encoding="UTF-8"?>
<ChangeResourceRecordSetsResponse>
   <ChangeInfo>
      <Comment>string</Comment>
      <Id>string</Id>
      <Status>string</Status>
      <SubmittedAt>timestamp</SubmittedAt>
   </ChangeInfo>
</ChangeResourceRecordSetsResponse>

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in XML format by the service.

ChangeResourceRecordSetsResponse

Root level tag for the ChangeResourceRecordSetsResponse parameters.

Required: Yes

ChangeInfo

A complex type that contains information about changes made to your hosted zone.

This element contains an ID that you use when performing a GetChange action to get detailed information about the change.

Type: ChangeInfo object

Errors

For information about the errors that are common to all actions, see Common Errors.

InvalidChangeBatch

This exception contains a list of messages that might contain one or more error messages. Each error message indicates one error in the change batch.

HTTP Status Code: 400

InvalidInput

The input is not valid.

HTTP Status Code: 400

NoSuchHealthCheck

No health check exists with the ID that you specified in the DeleteHealthCheck request.

HTTP Status Code: 404

NoSuchHostedZone

No hosted zone exists with the ID that you specified.

HTTP Status Code: 404

PriorRequestNotComplete

If Amazon Route 53 can't process a request before the next request arrives, it will reject subsequent requests for the same hosted zone and return an HTTP 400 error (Bad request). If Amazon Route 53 returns this error repeatedly for the same request, we recommend that you wait, in intervals of increasing duration, before you try the request again.

HTTP Status Code: 400