AWS:自定义 SSL 证书选项在 CloudFront 中被禁用,但我使用 AWS Certificate Manager 创建了一个 SSL 证书

AWS: Custom SSL certificate option is disabled in CloudFront, but I created a SSL certificate using AWS Certificate Manager

我正在为我的亚马逊 S3 静态网站创建 SSL 证书。我使用证书管理器为我的域创建了一个 SSL 证书,它的状态是 'Issued'。我正在创建 CloudFront 分配,但自定义 SSL 证书选项被禁用。

我需要一些时间(一天或更长时间)才能看到我的自定义 SSL 证书吗?还是我做错了什么?

将与应用程序负载均衡器 (ELB/2.0) 一起使用的证书需要在与均衡器相同的区域中的 ACM 中创建。

始终需要在 us-east-1 中创建将与 CloudFront 一起使用的证书。

To use an ACM Certificate with Amazon CloudFront, you must request or import the certificate in the US East (N. Virginia) region. ACM Certificates in this region that are associated with a CloudFront distribution are distributed to all the geographic locations configured for that distribution.

http://docs.aws.amazon.com/acm/latest/userguide/acm-regions.html

原因是 CloudFront 不遵循 AWS 中的区域边界模型。 CloudFront 边缘位置遍布全球,但在 us-east-1 之外进行配置和管理——将其视为 CloudFront 的主区域。一旦分布达到 Deployed 状态,它在操作上不依赖于 us-east-1,但在配置期间,一切都源自该区域,因此这是 CloudFront 可以访问的唯一 ACM 区域。

替换证书时,请确保清除 'Custom SSL Certificate (example.com)' 文本框中现有证书的名称。如果不清除,则其他证书不可选。

我得到了这个确切的行为,但是在 us-east-1 正确导入了证书并发现问题是我的证书的密钥大小(4096 位)。

AWS CloudFront 只接受最多 2048 位的密钥,如下所述:https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cnames-and-https-requirements.html#https-requirements-size-of-public-key

Size of the Public Key

The length of the public key for a certificate depends on where you're storing it.

Importing a certificate into AWS Certificate Manager (ACM): public key length must be 1024 or 2048 bits. The limit for a certificate that you use with CloudFront is 2048 bits, even though ACM supports larger keys.

Uploading a certificate to the AWS Identity and Access Management (IAM) certificate store: maximum size of the public key is 2048 bits.

We recommend using 2048 bits.

在尝试创建 cloudFront 发行版时有过同样的经历。我最初在 us-west-2 区域创建了证书,但复选框显示为灰色。解决它的方法是在 us-east-1 区域创建证书。复选框立即变为可选状态。