LoginSignup
0
0

More than 3 years have passed since last update.

ViewerCertificateException

Last updated at Posted at 2020-03-11

1.JPG

エラーメッセージ

com.amazonaws.services.cloudfront.model.InvalidViewerCertificateException: To add an alternate domain name (CNAME) to a CloudFront distribution, you must attach a trusted certificate that validates your authorization to use the domain name

問題

対象のドメインの証明書をCertificateManagerで発行。
しかし、CloudFront Distributionsで認識されない。
( Edit画面、SSL Certificate にて、Custom SSL Certificate が選択不能 )

結論

4回くらいリロードしたら治った()

経緯

1.S3で静的サイトを構築。
2.xdomainで独自ドメインを取得。

ドメイン作成後60日間はRoute53に移管できない事を知らずに取得。
(その他ドメイン移管条件はググって下さい)
応急処置として、AWSのName Serverをxdomeinのレジストラに登録。

3.CloudFront の OriginDomain にS3 の静的サイトを設定。
4.CertificateManager で 上記ドメインの証明書発行。

この時、証明書発行の認証方法として「DNS」か「email」を選ぶ。
この時は「DNS」を選択。

5.CloudFront Distribution Setting にて、(4)の行為が反映されていない

2.JPG

SSL Certificate にて、Custom SSl Certificateを選択できない(証明書の存在を認識していない)

6.ドメインの証明書再発行

証明書発行の認証方法として「email」を選択。

7.再発と解決

またもや(5)と同じ現象。

1.CloudFront のホーム画面の Edit を押す。
2.Edit Distribution から CloudFront のホーム画面に戻る。

上記1と2を4回繰り返した結果、(5)で Custom SSl Certificate を選択できるようになっていた。。。。
3.JPG

おまけ

今回、ドメインはxdomainで取得した。
下記参考書曰く、
AWS内でドメインを取得すれば、自動で証明書が発行される。
その場合、(5)のSSL Certificate は Default(略)でOK。

参考

Youtube

  1. CertificateManagerでドメインの証明書発行
  2. 上記ドメインをCloudFrontのALtanateDomainNamesに設定。

Kindle

  • Amazon Web Services パターン別構築・運用ガイド 改訂第2版
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0