Amazon CloudFront
Developer Guide (API Version 2016-09-29)

Generating Custom Error Responses

If the objects that you're serving through CloudFront are unavailable for some reason, your web server typically returns an HTTP status code to CloudFront. For example, if a viewer specifies an invalid URL, your web server returns a 404 status code to CloudFront, and CloudFront returns that status code to the viewer. The viewer displays a brief and sparsely formatted default message similar to this:

Not Found: The requested URL /myfilename.html was not found on this server.

But you can display a custom error message instead, if you like. You also have several options for managing how CloudFront responds when there's an error.