Search code examples
dynamicamazon-ec2amazon-cloudfront

How CloudFront works with Dynamic Application in EC2 PHP?


How CloudFront works with Dynamic Application? Does it need to setup different domains? One for dynamic, one for static? or configurate in the CloudFront so it can work with all the dynamic functions (ex. submit a feedback)?

Thanks!


Solution

  • You should use CloudFront to deliver your static content like images, stylesheets and scripts or even static HTML sites. The dynamic part of your application takes place on your EC2 instance.

    The easiest way to do this, is to setup a subdomain like static.example.com with the corresponding CNAME entry which points to the CloudFront distribution domain. Also don't forget to tell the matching CNAMES to your CloudFront distribution. For more information look at this: Amazon CloudFront - Using Alternate Domain Names (CNAMEs).