title: How do I replace a Policy Record with a simple A record that points to a CloudFront Distribution without traffic interruption?
body: <p>My first question would be, what's the best way to do this? It looks to me like the only way to do it without interrupting traffic would be through the AWS CLI, but if there's an easier way I'm all ears! If the CLI is the way to do it, I'm running into issues with the following command:</p>
  <pre><code>aws route53 change-resource-record-sets --hosted-zone-id XXXXXXXXXXXX --change-batch file://update-record.json
  </code></pre>
  <p>The <code>update-record.json</code> contains the following:</p>
  <pre><code>{
    &quot;Comment&quot;: &quot;Swaps the Policy Record for a simple routing policy&quot;,
    &quot;Changes&quot;: [
      {
        &quot;Action&quot;: &quot;UPSERT&quot;,
        &quot;ResourceRecordSet&quot;: {
          &quot;Name&quot;: &quot;www.example.com&quot;,
          &quot;Type&quot;: &quot;A&quot;,
          &quot;AliasTarget&quot;: {
            &quot;HostedZoneId&quot;: &quot;XXXXXXXXXXXX&quot;,
            &quot;DNSName&quot;: &quot;xxxxxxxxxxxxx.cloudfront.net&quot;,
            &quot;EvaluateTargetHealth&quot;: false
          }
        }
      }
    ]
  }
  </code></pre>
  <p>The error I'm getting is:</p>
  <pre><code>An error occurred (InvalidChangeBatch) when calling the ChangeResourceRecordSets operation: [Tried to create an alias that targets xxxxxxxxxxxxx.cloudfront.net., type A in zone XXXXXXXXXXXX, but the alias target name does not lie within the target zone, Tried to create an alias that targets xxxxxxxxxxxxx.cloudfront.net., type A in zone XXXXXXXXXXXX, but that target was not found]
  </code></pre>
  <p>The Hosted Zone ID for the record in the account is accurate, as is the distribution DNS name. The record name, <a href="http://www.example.com" rel="nofollow noreferrer">www.example.com</a>, also exists in the account. The distribution has an alternate domain name (CNAME) of <a href="http://www.example.com" rel="nofollow noreferrer">www.example.com</a>.</p>
  <p>I've also tried doing the change as a delete and create, rather than an <code>upsert</code>:</p>
  <pre><code>{
    &quot;Comment&quot;: &quot;Swaps the Policy Record for a simple routing policy&quot;,
    &quot;Changes&quot;: [
      {
        &quot;Action&quot;: &quot;DELETE&quot;,
        &quot;ResourceRecordSet&quot;: {
          &quot;Name&quot;: &quot;www.example.com.&quot;,
          &quot;Type&quot;: &quot;A&quot;,
          &quot;TrafficPolicyInstanceId&quot;: &quot;xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&quot;
        }
      },
      {
        &quot;Action&quot;: &quot;CREATE&quot;,
        &quot;ResourceRecordSet&quot;: {
          &quot;Name&quot;: &quot;www.example.com.&quot;,
          &quot;Type&quot;: &quot;A&quot;,
          &quot;AliasTarget&quot;: {
            &quot;HostedZoneId&quot;: &quot;XXXXXXXXXXXX&quot;,
            &quot;DNSName&quot;: &quot;xxxxxxxxxxxxx.cloudfront.net&quot;,
            &quot;EvaluateTargetHealth&quot;: false
          }
        }
      }
    ]
  }
  </code></pre>
  <p>Doing this in two steps yields the same error message.</p>