Skip to main content

Is it possible to use a custom certificate issued by a private certificate authority with custom origin behind CloudFront?

Updated 2 min readMarkdown
Is it possible to use a custom certificate issued by a private certificate authority with custom origin behind CloudFront?

One day an engineer in my team came up with this question.

There was no quick answer available, so I started digging and here's what I found.

CloudFront's docs on CNAMEs and HTTPS requirements say:

CloudFront supports all types of certificates issued by a trusted certificate authority.

CloudFront to Custom Origin setup can only work with trusted third-party CAs:

For origins other than Elastic Load Balancing load balancers, you must use a certificate that is signed by a trusted third-party certificate authority (CA), for example, Comodo, DigiCert, or Symantec.

And in more details CloudFront docs explain that they support the same CAs that Mozilla supports:

When CloudFront uses HTTPS to communicate with your origin, CloudFront verifies that the certificate was issued by a trusted certificate authority. CloudFront supports the same certificate authorities that Mozilla does. For the current list, see Mozilla Included CA Certificate List. You can’t use a self-signed certificate for HTTPS communication between CloudFront and your origin.

AWS also emphasizes in the docs that:

Important
If the origin server returns an expired certificate, an invalid certificate, or a self-signed certificate, or if the origin server returns the certificate chain in the wrong order, CloudFront drops the TCP connection, returns HTTP status code 502 (Bad Gateway) to the viewer, and sets the X-Cache header to Error from cloudfront. Also, if the full chain of certificates, including the intermediate certificate, is not present, CloudFront drops the TCP connection.

Summarising the above - No, it is not possible to set up CloudFront with Custom Origin using a certificate issued by a private Certificate Authority or Self Signed Certificate.

But why do I need to know that?

Because large enterprise companies may have internal CAs for internal purposes and they can be trusted on the company devices and you might be instructed to use a certificate issued by such CA by someone that is not aware of the above.

This short article can help you easily provide required documentation for others in case you are asked if that's possible or requested to implement own certificate in such scenario.

About the author

  • I started my professional career in 2012 as Systems Administrator and continued it until 2018 to become DevOps Engineer. I work with AWS since 2016 and I am 5 times certified AWS Specialist.

Viewer TLS and origin TLS are separate trust domains on CloudFront: the distribution certificate faces clients, while the private-CA chain only matters on the Origin Protocol Policy path that talks to your origin. Place the private CA or intermediate into the origin trust store CloudFront will use, keep SNI and the origin hostname aligned with what the leaf presents, and avoid match-viewer unless every origin truly terminates with a chain that CloudFront trusts. Keep Authorization and Cookie out of the public cache key on hashed or long-TTL objects so a TLS or auth change does not explode cardinality.

Ops prove-out after attaching the private-CA trust material: hit a warm public path twice and confirm MISS then HIT with Age climbing under the stable host-path key; force an origin fetch on a cold path and confirm the edge completes the origin handshake without certificate errors in the distribution logs. If origin fetches fail only from some POPs, check whether a second origin or failover target still presents a public-CA leaf while the primary uses the private chain — mixed trust stores look like intermittent edge failures when the real issue is origin TLS config drift.

More from this blog