<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Romil Movaliya</title>
    <description>The latest articles on DEV Community by Romil Movaliya (@romil_movaliya).</description>
    <link>https://dev.to/romil_movaliya</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2965307%2Fbd8c90f3-a202-405b-9768-04f7c317c7e3.jpg</url>
      <title>DEV Community: Romil Movaliya</title>
      <link>https://dev.to/romil_movaliya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/romil_movaliya"/>
    <language>en</language>
    <item>
      <title>Optimizing Costs and Enhancing the Performance of a Food Delivery App by Using AWS CloudFront with AWS S3.</title>
      <dc:creator>Romil Movaliya</dc:creator>
      <pubDate>Wed, 26 Mar 2025 17:17:45 +0000</pubDate>
      <link>https://dev.to/aws-builders/optimizing-costs-and-enhancing-the-performance-of-a-food-delivery-app-by-using-aws-cloudfront-with-1j3j</link>
      <guid>https://dev.to/aws-builders/optimizing-costs-and-enhancing-the-performance-of-a-food-delivery-app-by-using-aws-cloudfront-with-1j3j</guid>
      <description>&lt;p&gt;As we know, when we are hosting a static site on GitHub Pages or any other platform at that time serving images efficiently is critical for performance and cost optimization. If you are working on a Food Delivery Application that includes multiple high-resolution images and hosting them directly on GitHub Pages or any other platform can lead to slower load times and unnecessary bandwidth consumption. To optimize performance and reduce costs, we can offload images to Amazon S3 and distribute them via AWS CDN service called CloudFront. It is a Content Delivery Network (CDN) that caches images closer to users across the worldwide.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7coxcjl2fjdhbyn0kaqz.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7coxcjl2fjdhbyn0kaqz.gif" alt="Architecture Animation" width="853" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In this blog, we will dive deep into how to set up Amazon S3 and CloudFront to optimize image hosting for your food delivery app. We’ll also explore some important key terminologies.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Primary Terminologies
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Reactjs:&lt;/strong&gt; Frontend library for making single-page applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Github/Vercel:&lt;/strong&gt; It is a Platform Where we are hosting our static site.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS S3:&lt;/strong&gt; It is simple storage service that provide Highly scalable and durable storage solution.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS CloudFront:&lt;/strong&gt; It is Global Content Delivery Network (CDN) service that caches the data closure to user.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Key Improvements in Food Delivery Apps:
&lt;/h3&gt;

&lt;p&gt;✅ &lt;strong&gt;Faster Page Loads&lt;/strong&gt; – Reduce the latency for users across different regions by caching images and assets.&lt;br&gt;
✅ &lt;strong&gt;Lower Data Transfer Costs&lt;/strong&gt; – Avoid high charges for outbound data transfer of S3.&lt;br&gt;
✅ &lt;strong&gt;Better User Experience&lt;/strong&gt; – During peak traffic hours, it provides high availability and responsiveness.&lt;br&gt;
✅ &lt;strong&gt;Scalability&lt;/strong&gt; – It will efficiently Handles spikes in traffic with caching capabilities of CloudFront.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛠️ Now, let's go through the steps to implement this setup:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Creating S3 storage and Uploading Images to S3
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmtwk0osacdp7w08f9110.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmtwk0osacdp7w08f9110.png" alt="Figure 1.1" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First of all, login to AWS Console → Go to Amazon S3.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa5w1tphj2pwfs9vvhuo2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa5w1tphj2pwfs9vvhuo2.png" alt="Figure 1.2" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click Create bucket and enter a unique bucket name (e.g., noodletown-bucket).&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Bucket name should be unique globally. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcp4ypxkzkz2urhks5wkr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcp4ypxkzkz2urhks5wkr.png" alt="Figure 1.3" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Disable &lt;code&gt;Block Public Access&lt;/code&gt; (since we want to serve images publicly).&lt;/li&gt;
&lt;li&gt;Enabling the bucket version helps with accidental deletion protection, data recovery, and more (optional).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8g1ml7hdp6sni9od3zd7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8g1ml7hdp6sni9od3zd7.png" alt="Figure 1.4" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on &lt;strong&gt;Create bucket&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhmwtesse54kcgbbzwe0t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhmwtesse54kcgbbzwe0t.png" alt="Figure 1.5" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once the bucket is created, open your S3 bucket and click &lt;code&gt;Upload&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fod084tjc8k9yk6fbfzpi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fod084tjc8k9yk6fbfzpi.png" alt="Figure 1.6" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select all images from your local folder (src/assets/Images/).&lt;/li&gt;
&lt;li&gt;In my case, I am adding my entire directory which contains multiple multiple subdirectories.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Upload&lt;/strong&gt; to store them in S3.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F52p6sk3t3m9czgimd53p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F52p6sk3t3m9czgimd53p.png" alt="Figure 1.7" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: One thing you should keep in mind is that you must disable &lt;code&gt;block public access&lt;/code&gt;, as we will edit our bucket policy once we get the policy from CloudFront.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;🏆 &lt;strong&gt;Congratulations&lt;/strong&gt; on completing the &lt;strong&gt;first phase&lt;/strong&gt;, where we create a bucket and upload assets.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Set Up AWS CloudFront for Faster Image Delivery
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fglkiq74ddvy4bk2zvmli.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fglkiq74ddvy4bk2zvmli.png" alt="Figure 2.1" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The first step is to go to AWS CloudFront and click &lt;strong&gt;Create Distribution&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpkjqzwx1eldh5m6zvnto.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpkjqzwx1eldh5m6zvnto.png" alt="Figure 2.2" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Under Origin Settings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Origin Domain: Select your S3 bucket (noodletown-bucket).&lt;/li&gt;
&lt;li&gt;Origin Path: &lt;strong&gt;Leave empty.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F70da18a8w1lvmhmctvfq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F70da18a8w1lvmhmctvfq.png" alt="Figure 2.3" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Origin Access: Select the Origin access control settings.&lt;/p&gt;

&lt;p&gt;In Origin Access Control, create a new OAC and then click on the Create button. (If it is already present, select it directly.)&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you’re stuck on the term &lt;strong&gt;Origin Access Control&lt;/strong&gt;, don't panic. I'm explaining it here just break the sentence into words:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Origin:&lt;/strong&gt; It refers to the source server where our images are stored.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Access Control:&lt;/strong&gt; It refers to the permissions and rules that determine who or what can access the resources stored in S3.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Origin Access Control:&lt;/strong&gt; Now, it refers to the set of rules or permissions that define how access is granted to the origin.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyky47h2wx8r4g9cylt55.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyky47h2wx8r4g9cylt55.png" alt="Figure 2.4" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Default Cache Behavior Settings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Viewer Protocol Policy: Redirect HTTP to HTTPS.&lt;/li&gt;
&lt;li&gt;Allowed HTTP Methods: GET, HEAD.&lt;/li&gt;
&lt;li&gt;Object Caching: Use recommended settings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc7qyiczv12jdbwjxrkwa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc7qyiczv12jdbwjxrkwa.png" alt="Figure 2.5" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Here, we don't need any WAF protection, so select Do not enable security protections.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🏆 &lt;strong&gt;Congratulations&lt;/strong&gt; on completing the &lt;strong&gt;second phase&lt;/strong&gt;, where we create and configure AWS CloudFront.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F26c8jqoma5yfx3ridv6h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F26c8jqoma5yfx3ridv6h.png" alt="Figure 2.6" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now click on Copy Policy and paste this into S3.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwy4ilfnz0zlayfdreh4j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwy4ilfnz0zlayfdreh4j.png" alt="Figure 2.7" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In S3, go to the Permissions tab, click on Edit, paste those permissions there, and click Save.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnu2a3q4oyci6sww4f8ap.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnu2a3q4oyci6sww4f8ap.png" alt="Figure 2.8" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Then, copy the Distribution Domain Name from &lt;strong&gt;CloudFront's Distributions&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmap8y0m9dxz3fosxy8ma.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmap8y0m9dxz3fosxy8ma.png" alt="Figure 2.9" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Then, add the domain name in the browser and also append the path of the assets from the bucket.
&lt;/li&gt;
&lt;li&gt;It should look like this: &lt;strong&gt;domain name + path of the assets&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 3: Use CloudFront URLs in React App
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffrnyt5fh3e6golta4u1i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffrnyt5fh3e6golta4u1i.png" alt="Figure 3.1" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, come into our IDE (VS Code) and create one .env file then Add &lt;code&gt;Distribution domain name&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3zvfcrwkxq8b208whnt7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3zvfcrwkxq8b208whnt7.png" alt="Figure 3.2" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once added successfully, change your image path to use the &lt;strong&gt;Environment Variable&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnv9kiqpvzzv9aeyyb8oq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnv9kiqpvzzv9aeyyb8oq.png" alt="Figure 3.3" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next, push your code to GitHub and deploy it to production.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc3rrxpjmw1002hu383be.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc3rrxpjmw1002hu383be.png" alt="Figure 3.4" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Then check if everything works well!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🏆 &lt;strong&gt;Congratulations&lt;/strong&gt; on completing the &lt;strong&gt;third phase&lt;/strong&gt;, where we use our CloudFront URL in our React application.&lt;/p&gt;

&lt;p&gt;💡You might have one question:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What if we want to directly access the assets without manually adding the S3 path after the CDN link?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Yes, we also have a solution for that.&lt;/li&gt;
&lt;li&gt;If we directly access, it will show like the image below.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fevn7am2pijpdvjys9v44.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fevn7am2pijpdvjys9v44.png" alt="Figure 3.5" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;But if you assign a path in the &lt;code&gt;Default Root Object&lt;/code&gt;, it will work properly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxdl36gwjk2x2x202fjvh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxdl36gwjk2x2x202fjvh.png" alt="Figure 3.6" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Stopping and Removing all Services
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Now it's time to shut down all the services after completing our practical.&lt;/li&gt;
&lt;li&gt;First, we are stopping our CloudFront service.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0az31o8oz2hmipi0i20v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0az31o8oz2hmipi0i20v.png" alt="Figure 4.1" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The first step is to &lt;strong&gt;disable the distribution&lt;/strong&gt;, and after 10-15 minutes, we will be able to delete the distribution.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F68fydtk3h6e2iuispt2c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F68fydtk3h6e2iuispt2c.png" alt="Figure 4.2" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ql6fbb8ankspp267sxt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ql6fbb8ankspp267sxt.png" alt="Figure 4.3" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now it is deleted successfully.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwtazzxs989xg0ldkptrz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwtazzxs989xg0ldkptrz.png" alt="Figure 4.4" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Then clear our S3 bucket and delete it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx63stzqg0a34a0vwten0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx63stzqg0a34a0vwten0.png" alt="Figure 4.5" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What other things can we add in our food delivery application for cost optimization?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;In a food delivery application, each time a bill recipe is generated and stored in our storage, it could incur charges because we mostly check the bill after a month or a few months later. For that reason, we need a solution that will help us reduce our costs. Here in this case, we use AWS cloud storage lifecycle, which will reduce our bill.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Amazon S3 Lifecycle Policy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Amazon S3 lifecycle policy enables you to delete or move objects based on their age.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After 30 days, the object is moved from Amazon S3 Standard to Amazon S3 Standard-IA. Then, after 60 days, it will move into Amazon S3 Glacier. After 365 days, it will be automatically deleted.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The same scenario applies to our food delivery application. We have too many bills generated by the system. Here, we are directly applying our S3 lifecycle policy, so it will move after 30 days from S3 Standard to S3 Standard-IA, and then after 60 days, it will move to Amazon S3 Glacier. It will take some time for retrieval of our bill, but it is the most suitable option for reducing the cost.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fajlqkq6b56ez2qvr21j7.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fajlqkq6b56ez2qvr21j7.gif" alt="lifecycle policy animation" width="853" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AWS S3 storage has different classes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;S3 Standard&lt;/code&gt; - it is suitable for general purpose, but cost is higher, benefit is quickly access the data.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;S3 Standard-IA&lt;/code&gt; - it is suitable for Infrequent data access in milliseconds, cost is lower as compare to s3 standard. It also incur per GB retrieved charges.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;S3 Intelligent-Tiering&lt;/code&gt; - Automated cost saving strategy for data with their changing access state patterns.
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;S3 One Zone-IA&lt;/code&gt; - Here all the things is same as per S3 Standard-IA but the key difference is only one availability zone is there. It also incur per GB retrieved charges.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;S3 Glacier Instant Retrieval&lt;/code&gt; - For those data who is required for few times in year, The key benefit is minimal storage duration charge is 90 days. It also incur per GB retrieved charges.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;S3 Glacier Flexible Retrieval&lt;/code&gt; - it is very low cost solution for rarely access data.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;S3 Glacier Deep Archive&lt;/code&gt; - it is very lowest cost solution for very rarely access data.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;One thing that is common in each Amazon S3 class. That is, It has 11'9 durability.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  AWS Free Tier Cost Estimation for S3 + CloudFront Setup
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Free Tier Usage (Monthly)&lt;/th&gt;
&lt;th&gt;Expected Cost&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;S3 Storage&lt;/td&gt;
&lt;td&gt;5GB&lt;/td&gt;
&lt;td&gt;$0.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;S3 Requests&lt;/td&gt;
&lt;td&gt;20,000 GET, 2,000 PUT&lt;/td&gt;
&lt;td&gt;$0.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CloudFront Data Transfer&lt;/td&gt;
&lt;td&gt;1TB&lt;/td&gt;
&lt;td&gt;$0.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CloudFront Requests&lt;/td&gt;
&lt;td&gt;10 million&lt;/td&gt;
&lt;td&gt;$0.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TOTAL COST (within free tier)&lt;/td&gt;
&lt;td&gt;$0.00&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  When Do You Start Paying?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;If images exceed 5GB in S3 → ~$0.023 per extra GB.&lt;/li&gt;
&lt;li&gt;If monthly GET requests exceed 20,000 → ~$0.0004 per 1,000 extra requests.&lt;/li&gt;
&lt;li&gt;If CloudFront traffic exceeds 1TB → ~$0.08 per extra GB.&lt;/li&gt;
&lt;li&gt;For a small app with a moderate number of users, the free tier is sufficient for months before incurring any cost. 🚀&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Note&lt;/code&gt;: One thing to keep in mind is that there are no inbound charges, it only charges for outbound data transfer. &lt;br&gt;&lt;br&gt;
         &lt;code&gt;Inbound data transfer&lt;/code&gt; : data is being uploaded into AWS services, such as uploading files to s3. &lt;br&gt;&lt;br&gt;
         &lt;code&gt;Outbound data transfer&lt;/code&gt; : data is being served to users or transferred out of AWS.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;By integrating AWS S3 with a cloudfront, you can increase the performance and scalability of your food distribution app by adjusting costs. Host images on S3 and serve them through Cloudfront ensure rapid load time, low bandwidth cost and a spontaneous user experience, also in high traffic periods. With simple steps to Set-up, this approach provides an efficient, cost -effective solution for stable property management. In addition, by taking advantage of AWS free level, you can start with minimal costs, so this solution can be perfect for a small medium-sized app.&lt;/p&gt;




&lt;h2&gt;
  
  
  FAQs
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;1.   Can I Use AWS Route 53 with a GitHub Pages + AWS S3 + CloudFront Setup?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Yes, AWS Route 53 can be used if you want a custom domain (eg, &lt;a href="http://www.yourfoodapp.com" rel="noopener noreferrer"&gt;www.yourfoodapp.com&lt;/a&gt;) instead of Standard Github Side URL (Youusname.github.io).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;2. If I want to integrate AWS route 53 service in my project. What would be it's estimated total cost?&lt;/strong&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you need a custom domain for your project it will cost you at least $6-$7 for 3 months?&lt;br&gt;
cost calculated based on your requirements, for example:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Route 53 Hosted Zone : This estimated cost of the feature is $0.50/month and is not included in free tier.
2.Route 53 Queries : This will be included in the free tier but upto 1M queries only and the estimated cost ranges from  $0.00 to $0.40.&lt;/li&gt;
&lt;li&gt;Domain Registration : This estimated cost of the feature is $12–$15/year and is not included in free tier.&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;3. what would happen if I do not enable the version of my AWS s3 service?&lt;/strong&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If versioning is not enabled in S3, deleted or overwritten files cannot be recovered. You lose the ability to revert to previous versions. It's advisable to enable versioning for better data protection and recovery. &lt;/p&gt;

&lt;p&gt;What are the significant differences between different classes of the S3 glacier?&lt;br&gt;
How are S3 glacier classes different from each other?&lt;br&gt;
There are in total 3 classes of s3 glacier.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;S3 Glacier Instant Retrieval &lt;/li&gt;
&lt;li&gt;S3 Glacier Flexible Retrieval&lt;/li&gt;
&lt;li&gt;S3 Glacier Deep Archive
The s3 Glacier Retrieval class has 99.9% availability, while the other two have 99.99% availability.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>awscloudfront</category>
      <category>s3</category>
      <category>aws</category>
      <category>amazons3</category>
    </item>
  </channel>
</rss>
