跳至内容

如何使用 ACM 对 CloudFront 分配的“InvalidViewerCertificate”域名错误进行故障排除?

2 分钟阅读
0

我想使用 AWS Certificate Manager (ACM) 对我在创建或更新 Amazon CloudFront 分配时收到的“InvalidViewerCertificate”错误进行故障排除。

解决方法

确认您的证书符合所有要求

您收到以下错误消息:

“The specified SSL certificate doesn't exist, isn't in us-east-1 region, isn't valid, or doesn't include a valid certificate chain.”

要解决此问题,请执行以下操作:

此外,请为证书使用以下配置:

  • 在美国东部(弗吉尼亚州北部)区域导入证书。
  • 使用 4096 位或更小的证书密钥。
  • 不要保护密码。
  • 对证书进行 PEM 编码。

使用包含 CNAME 的证书

您收到以下错误消息:

“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.”

当证书上的主题备用名称 (SAN) 不包含您在 CloudFront 分配中指定的 CNAME 时,就会出现此错误。

要解决此问题,请申请公有证书。您也可以联系您的证书颁发机构 (CA),获取包含分配中的 CNAME 的更新证书。

使用五个或更少的证书

您收到以下错误消息:

“The certificate that is attached to your distribution has too many certificates in the certificate chain.”

当您超过链中五个证书的最大数量时,就会出现此错误。要解决此问题,请使用包含五个或更少证书的新证书链。

如果您当前的 CA 不支持五个或更少的证书,请申请公有证书

获取更新的证书链

您收到以下错误消息之一:

“The certificate that is attached to your distribution has one or more expired certificates in the certificate chain.Make sure that each certificate in the chain is valid for the current date by reviewing the Not Valid After field.”

-或-

“The certificate that is attached to your distribution has one or more certificates in the certificate chain that aren't valid yet.Make sure that each certificate in the chain is valid for the current date by reviewing the Not Valid Before field.”

如果您的证书已过期,则必须从 CA 获取更新的证书链。

完成以下步骤:

  1. 从您的 CA 下载正确的链文件。
  2. 将证书和链重新导入 ACMAWS Identity and Access Management (IAM)
  3. 重试您的请求以创建或更新您的 CloudFront 分配。

如果您的证书尚未生效,则无法将其导入。选中“Not Valid Before”(之前未生效)证书字段,然后重试您的请求。

如果您无法重试请求,请申请公有证书

使用可信的 CA

您收到以下错误消息:

“The certificate that is attached to your distribution was not issued by a trusted Certificate Authority.”

要解决此问题,请从 CloudFront 的可信 CA 处获取允许您使用 CNAME 记录的证书。如果您当前的 CA 不支持这种情况,请申请公有证书

**注意:**您可以使用自签名证书仅验证现有的 CNAME 记录,不能验证新的 CNAME 记录。

检查 SAN 字段中的格式

您收到以下错误消息:

“The certificate that is attached to your distribution has a value in the SAN field that is not correctly formatted.”

CloudFront 要求每个条目必须是包含完全限定域名 (FQDN) 的 DNS 名称或 IP 地址。通配符条目有效,但您无法添加级别高于或低于通配符的 CNAME

如果您当前的 CA 不支持这种情况,请申请公有证书

将 CNAME 添加到 API 调用中

您收到以下错误消息:

“The certificate that you specified doesn't cover the alternate domain name (CNAME) that you're trying to add.”

当您尝试关联到分配的 CNAME 未包含在证书的 SAN 中时,就会出现此错误。要解决此问题,您必须在 CreateDistributionUpdateDistribution API 调用中提供 CNAME。

重试 API 调用

您收到以下错误消息:

“CloudFront encountered an internal error.Please try again.”

如果您在进行 CreateDistributionUpdateDistribution API 调用时收到上述错误消息,请重试这些调用。如果问题持续了很长时间,请查看 AWS Health Dashboard 中是否存在相关问题。

相关信息

为什么我不能为我的 CloudFront 分配选择自定义 SSL/TLS 证书?

AWS 官方已更新 6 个月前