# CloudFront 指定 CNAME 的時候出現錯誤 今天在設定公司的 CloudFront 備用 CNAME 在設定完要儲存的時候出現這錯誤 ``` One or more of the CNAMEs you provided are already associated with a different resource. ``` 在參考一些資料以後 使用了 `AWS CloudShell` 來做查詢 原始指令為 ```aws $ aws cloudfront list-conflicting-aliases --distribution-id YourDistributiontID --alias YourCNAME ``` 修改成 ```aws $ aws cloudfront list-conflicting-aliases --distribution-id E1BXXXXXXQZ82W --alias 123.domain.com ``` 得到這結果 ``` { "ConflictingAliasesList": { "MaxItems": 100, "Quantity": 1, "Items": [ { "Alias": "123.domain.com", "DistributionId": "******NXO4MF6", "AccountId": "******876857" } ] } } ``` 得知原來是因為這 domain 之前設在別的 AWS 帳號的 Route53 而且已經有被使用在 CloudFront 上 然後 CNAME 還跟我隨便取的一樣 XD 依照上面查詢到的 `AccountId` 與 `DistributionId` 去找到該筆資料 把以前設定的這個設定刪除掉以後 新的設定就可以正常儲存了 參考資料 https://aws.amazon.com/tw/premiumsupport/knowledge-center/resolve-cnamealreadyexists-error/ ###### tags: `AWS`