CLIENT AREACall Us 1-800-383-5193


Call Us 1-800-383-5193


Call Us 1-800-383-5193

Need help?

Our experts have had an average response time of 11.7 minutes in August 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

How to setup AWS CloudFront and how it delivers content

by | Mar 21, 2021

Wondering how to setup AWS CloudFront? We can help you.

CloudFront retrieves data from the Amazon S3 bucket and distributes it to multiple datacenter locations. The data delivers through edge locations.

When we request data, the nearest edge location routes, resulting in the lowest latency, low network traffic, fast access to data, etc.

At Bobcares we assist our customers with several AWS queries as part of our AWS Support Services for AWS users, and online service providers.

Today, let us discuss how to setup AWS CloudFront


How AWS CloudFront Delivers the Content

Moving ahead, let us see how AWS does content delivery.

Step1: The user accesses a website and requests an object to download. For example, an image.
Step2: DNS routes this request to the nearest CloudFront edge location to serve the user request.
Step3: There, CloudFront checks its cache for the requested files. If found, returns it to the user otherwise does the following:

  • Initially, it compares the request with the specifications and forwards it to the applicable origin server for the corresponding file type.
  • The origin servers send the files back to the CloudFront edge location.
  • As soon as the first byte arrives from the origin, CloudFront forwards it to the user and adds the files to the cache in the edge location for the next time.

Step4: The object is now in an edge cache for 24 hours or so in file headers.

  • CloudFront forwards the next request for the object to the user’s origin to check the edge location version is updated or not.
  • If the edge location version is updated, then CloudFront delivers it to the user.
  • If the edge location version is not updated, then origin sends the latest version to CloudFront. CloudFront delivers the object to the user and stores the latest version in the cache at that edge location.


Features of CloudFront

  • Fast: The broad network results in lowering latency, high data transfer rates, and low network traffic.
  • Simple: It is easy to use.
  • Can use with other AWS Services: We can easily integrate it with other AWS services, like Amazon S3, Amazon EC2.
  • Cost-effective: We pay only for the content that we deliver through the network.
  • Elastic: We need not worry about maintenance
  • Reliable: Its edge locations will automatically re-route the end-users to the next nearest location if required.
  • Global: It uses a global network of edge locations located in most of the regions.


How to Setup AWS CloudFront

Now let us see how our Support Techs setup AWS CloudFront using the following steps.

Step1: Sign in to the AWS management console using
Step2: Upload Amazon S3 and choose every permission public.
Step3: Create a CloudFront Web Distribution using the following steps:

  1. Open CloudFront console via
  2. Click the Get Started button in the web section of ‘Select a delivery method for our content page’.
  3. Create Distribution page opens. Choose the Amazon S3 bucket in the Origin Domain Name and leave the rest as default.
  4. Then we can see a default Cache Behavior Settings page. Keep the values as default and move to the next page.
  5. A Distribution settings page opens. Fill in the requirements and click the Create Distribution button.
  6. The Status column changes from In Progress to Deployed. Enable the distribution.

Wait for around 15 minutes for the domain name to be available in the Distributions list.

  • Test the Links

Once done, CloudFront knows the location of the Amazon S3 server and the user knows the domain name associated with the distribution.

However, we can create a link to Amazon S3 bucket content with that domain name and have CloudFront serve it. This saves a lot of time.

Following are the steps to link an object:

Step1: Copy the following HTML code to a new file and write the domain-name that CloudFront assigned to the distribution in the place of the domain name. Write a file name of the Amazon S3 bucket in the place of object-name.

<head>CloudFront Testing link</head>
<p>My Cludfront.</p>
<p><img src = “http://domain-name/object-name” alt = “test image”/>

Step2: Save the text in a file with .html extension.
Step3: Then open the web page in a browser to see if it is working correctly. If not, then crosscheck the settings.


How to resolve HTTP 504 (Gateway Timeout) errors from CloudFront

Recently we had a customer who came across the error:

Amazon CloudFront distribution is returning an HTTP 504 (Gateway Timeout) error.

In order to troubleshoot HTTP 504 errors, we check the configurations on our firewall, security groups, and the origin server.

If we use a custom origin and can connect directly to the origin, but are getting 504 errors from CloudFront, then we increase the distribution’s origin response timeout.

By default, CloudFront allows the origin connection to open for 30 seconds. However, if we take more than 30 seconds to process and return a response, CloudFront returns an HTTP 504 error.

To optimize performance, the connection time between CloudFront and the origin should be kept as short as possible.

Our Support Techs recommend keeping the origin response timeout value as low as possible.

In order to do that, follow the given steps:

  1. Open the CloudFront console and then select the distribution.
  2. Choose the Origins and Origin Groups tab and then select the origin.
  3. Then select, Edit.
  4. Update the Origin Response Timeout value.
  5. Choose Yes and then Edit.

If we use persistent connections between CloudFront and the origin, we make sure that the origin keep-alive timeout value is equal to or greater than the origin response timeout.

[Need assistance with the setup? We are available 24*7]



In short, CloudFront retrieves data from the Amazon S3 bucket and distributes it to multiple datacenter locations. Today, we saw how our Support Techs setup AWS CloudFront.


Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.


var google_conversion_label = "owonCMyG5nEQ0aD71QM";


Submit a Comment

Your email address will not be published. Required fields are marked *