{"id":177,"date":"2026-02-06T19:37:17","date_gmt":"2026-02-06T19:37:17","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/a_mermur\/?p=177"},"modified":"2026-02-06T19:37:17","modified_gmt":"2026-02-06T19:37:17","slug":"set-up-a-cloudfront-cdn-for-an-s3-bucket","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/a_mermur\/2026\/02\/06\/set-up-a-cloudfront-cdn-for-an-s3-bucket\/","title":{"rendered":"Set Up a CloudFront CDN for an S3 Bucket"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\"><\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p>In this project, I learned how to improve website performance and content delivery using <strong>Amazon CloudFront<\/strong> with an <strong>Amazon S3 bucket<\/strong>. The goal was to create a Content Delivery Network (CDN) that distributes files globally, improves loading speed, and adds extra security for static website content.<\/p>\n\n\n\n<p>I followed a YouTube tutorial and practiced building the setup inside AWS.<\/p>\n\n\n\n<p>\ud83d\udcfa Tutorial Used:<br>\ud83d\udc49 <a href=\"https:\/\/www.youtube.com\/watch?v=kbI7kRWAU-w\">https:\/\/www.youtube.com\/watch?v=kbI7kRWAU-w<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">What is CloudFront?<\/h2>\n\n\n\n<p>Amazon CloudFront is a CDN service that distributes content such as images, videos, and websites through multiple global edge locations. This helps reduce latency and improves loading speed for users around the world.<\/p>\n\n\n\n<p>CloudFront integrates easily with AWS services like S3, EC2, and Route 53 while providing features like caching, SSL encryption, and DDoS protection. (<a href=\"https:\/\/www.geeksforgeeks.org\/devops\/aws-cloudfront-setup-and-configuration\/?utm_source=chatgpt.com\">GeeksforGeeks<\/a>)<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">What is Amazon S3?<\/h2>\n\n\n\n<p>Amazon S3 (Simple Storage Service) is a cloud storage service that allows you to store and serve files such as HTML pages, images, and scripts. It is commonly used to host static websites and store application assets.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Project Goal<\/h2>\n\n\n\n<p>The objective of this project was to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create an S3 bucket<\/li>\n\n\n\n<li>Upload website files or static content<\/li>\n\n\n\n<li>Create a CloudFront distribution<\/li>\n\n\n\n<li>Connect CloudFront to the S3 bucket<\/li>\n\n\n\n<li>Test content delivery through the CDN<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1 \u2013 Create an S3 Bucket<\/h2>\n\n\n\n<p>First, I created an S3 bucket to store my website files.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Steps:<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open the AWS Management Console<\/li>\n\n\n\n<li>Search for <strong>S3<\/strong><\/li>\n\n\n\n<li>Click <strong>Create Bucket<\/strong><\/li>\n\n\n\n<li>Enter a unique bucket name<\/li>\n\n\n\n<li>Select a region<\/li>\n\n\n\n<li>Create the bucket<\/li>\n\n\n\n<li>Upload files such as HTML, CSS, or images<\/li>\n<\/ol>\n\n\n\n<p>After uploading, the files are stored and ready to be distributed through CloudFront. (<a href=\"https:\/\/www.geeksforgeeks.org\/devops\/aws-cloudfront-setup-and-configuration\/?utm_source=chatgpt.com\">GeeksforGeeks<\/a>)<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2 \u2013 Create a CloudFront Distribution<\/h2>\n\n\n\n<p>After setting up the S3 bucket, I created a CloudFront distribution.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Steps:<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to AWS Services \u2192 CloudFront<\/li>\n\n\n\n<li>Click <strong>Create Distribution<\/strong><\/li>\n\n\n\n<li>Select the S3 bucket as the origin<\/li>\n\n\n\n<li>Keep default settings or customize if needed<\/li>\n\n\n\n<li>Create the distribution<\/li>\n<\/ol>\n\n\n\n<p>CloudFront then generates a domain name that can be used to access the content globally. (<a href=\"https:\/\/www.geeksforgeeks.org\/devops\/aws-cloudfront-setup-and-configuration\/?utm_source=chatgpt.com\">GeeksforGeeks<\/a>)<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3 \u2013 Configure Permissions<\/h2>\n\n\n\n<p>To allow CloudFront to access files securely:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Make objects publicly accessible <strong>or<\/strong><\/li>\n\n\n\n<li>Restrict bucket access and allow CloudFront to serve files only<\/li>\n<\/ul>\n\n\n\n<p>This step improves security and prevents direct access to S3 content.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4 \u2013 Test the CDN<\/h2>\n\n\n\n<p>After the distribution is created:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Copy the CloudFront domain URL<\/li>\n\n\n\n<li>Paste it into the browser<\/li>\n\n\n\n<li>Verify the website or files load correctly<\/li>\n<\/ol>\n\n\n\n<p>Testing ensures that CloudFront is properly caching and distributing the content.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Optional Improvements<\/h2>\n\n\n\n<p>During the setup, I learned that CloudFront can also support:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Custom domain names<\/li>\n\n\n\n<li>SSL certificates for HTTPS<\/li>\n\n\n\n<li>Default index pages<\/li>\n\n\n\n<li>DNS configuration with Route 53<\/li>\n<\/ul>\n\n\n\n<p>These features allow you to build a professional and secure hosting setup.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Challenges I Faced<\/h2>\n\n\n\n<p>Some of the common challenges included:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Understanding S3 permissions<\/li>\n\n\n\n<li>Waiting for CloudFront deployment (takes time)<\/li>\n\n\n\n<li>Making sure files were publicly accessible or properly restricted<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">What I Learned<\/h2>\n\n\n\n<p>From this project, I gained experience with:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>AWS cloud infrastructure<\/li>\n\n\n\n<li>Content Delivery Networks<\/li>\n\n\n\n<li>Static website hosting<\/li>\n\n\n\n<li>Security configuration<\/li>\n\n\n\n<li>Performance optimization<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Why This Matters<\/h2>\n\n\n\n<p>Using CloudFront with S3 is important because it:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Improves website loading speed<\/li>\n\n\n\n<li>Reduces server load<\/li>\n\n\n\n<li>Increases availability<\/li>\n\n\n\n<li>Enhances security<\/li>\n\n\n\n<li>Provides scalable hosting solutions<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Setting up CloudFront with an S3 bucket is a powerful way to deliver content efficiently across the globe. This project helped me understand how CDN technology works and how cloud services can improve website performance and reliability.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In this project, I learned how to improve website performance and content delivery using Amazon CloudFront with an Amazon S3 bucket. The goal was to create a Content Delivery Network (CDN) that distributes files globally, improves loading speed, and adds extra security for static website content. I followed a YouTube tutorial and practiced building &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/theroyalscode.com\/students\/a_mermur\/2026\/02\/06\/set-up-a-cloudfront-cdn-for-an-s3-bucket\/\"> <span class=\"screen-reader-text\">Set Up a CloudFront CDN for an S3 Bucket<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-177","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/posts\/177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/comments?post=177"}],"version-history":[{"count":1,"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/posts\/177\/revisions"}],"predecessor-version":[{"id":178,"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/posts\/177\/revisions\/178"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/media?parent=177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/categories?post=177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_mermur\/wp-json\/wp\/v2\/tags?post=177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}