'AWS Amplify app as Cloudfront distribution origin

I have created an AWS Amplify app and I'd like to use the default generated url of the app which is something like this: https://shared.xxxxx.amplifyapp.com/ ("shared" being the branch name) as an origin in a Cloudfront distribution that I'd created separately.

The Cloudfront distribution has alternative domain names linked to it which are accessible but when I create a behavior in this distribution and point it to the Amplify origin mentioned before, and navigate to the path (alternative domain/behavior_path) the response is:

403 ERROR The request could not be satisfied

I would like to know if/how I can set up an Amplify app as an origin of a Cloudfront distribution.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source