How to set up a CloudFront distribution for EC2

What is dynamic content?

Dynamic content is web content that changes based on the preferences, settings, or actions of the user. The aim of dynamic content is typically to add a degree of personalization to the user experience. Many types of content can be served dynamically, such as written text, videos, or audio.

Examples of dynamic content include location or system-based data on a user’s first visit. Upon account creation or subsequent visits, more specific dynamic content might include relevant products and ads based on user history, personalized content, and faster access to favorite actions.

It is possible to provide dynamic content from your CDN, enabling rapid delivery to users worldwide. If you are interested in learning more about dynamic content delivery with Amazon CloudFront, visit our guide on the topic.

AWS TechTips 10-minute demo

What are the benefits of setting up an Amazon CloudFront distribution with Amazon EC2?

Faster content delivery speeds
Using a CloudFront distribution with Amazon Elastic Compute Cloud (Amazon EC2) is common practice for applications storing static content in-bucket. With the CloudFront cache and edge capabilities, users will receive content faster than if it were fetched from the origin server.

Easier integration with other AWS services
CloudFront works seamlessly with Amazon EC2 to accelerate the delivery of your dynamic content. You can also use your other AWS services with CloudFront, such as AWS Certificate Manager (ACM), AWS Web Application Firewall (AWS WAF), and your Amazon Simple Storage Service (Amazon S3) buckets.

No transfer costs between AWS services
If you use AWS origins, such as Amazon S3, Amazon EC2, or Elastic Load Balancing, you won’t pay for any data transferred between these services and CloudFront. Read more about CloudFront Plans & Pricing.

Additional security
With CloudFront, your content is stored in multiple locations worldwide. This increases data resilience while also protecting your origin from various potential cyber-attacks, such as distributed denial-of-service (DDoS). Learn more about how CloudFront can help with security, availability, and edge computing.

How to accelerate your dynamic content loading speed with Amazon CloudFront and Amazon EC2 as an origin

Check out the AWS tech tips demo to help you set up a CloudFront distribution with your EC2 origin. You can learn through step-by-step process of getting started in the AWS Console. You’ll see how to configure your origin and begin testing your CloudFront distribution in just 10 minutes.

In this tutorial, we'll cover how to configure CloudFront to serve dynamic content. You can also learn how to serve content that cannot be cached within CloudFront.

Serving dynamic content with CloudFront is a very common use case for lowering latency and accelerating delivery times. This is achieved by leveraging the CloudFront edge locations and the AWS global network. Your origin for this distribution will be an Elastic Load Balancing application load balancer with EC2 instances.

Discover more Amazon CloudFront resources

Visit the resources page
Ready to build?
Get started for free with Amazon CloudFront
Have more questions?
Contact us