Search code examples
amazon-web-servicesamazon-cloudfrontaws-cliserverless-aws-alias

Error when trying to AWS command line associate alias


I'm trying to associate an aws alias to a distribution, I currently have 2 distributions:

disbtA with an alternate domain www.example.com.

disbtB no alternate domain setup lets give it an id of 123

aws cloudfront associate-alias --target-distribution-id 123 --alias www.example.com

I get the error:

An error occurred (IllegalUpdate) when calling the AssociateAlias operation: Invalid or missing alias DNS TXT records.

They are both on the same account.


Solution

  • I missing this step:

    Create a DNS TXT record that associates the alternate domain name with the distribution domain name of the target distribution. Create your TXT record with an underscore (_) in front of the alternate domain name. The following shows an example TXT record in DNS:

    _www.example.com TXT d111111abcdef8.cloudfront.net

    CloudFront uses this TXT record to validate your ownership of the alternate domain name.