{"id":1214,"date":"2021-08-02T11:47:27","date_gmt":"2021-08-02T11:47:27","guid":{"rendered":"https:\/\/www.velaninfo.com\/rs\/?post_type=techtips&#038;p=1214"},"modified":"2021-10-04T11:05:10","modified_gmt":"2021-10-04T11:05:10","slug":"cloudfront-serve-static-website","status":"publish","type":"techtips","link":"https:\/\/www.velaninfo.com\/rs\/techtips\/cloudfront-serve-static-website\/","title":{"rendered":"How to Use CloudFront to Serve a Static Website?"},"content":{"rendered":"<p>The following steps below are to set up an Amazon CloudFront distribution with the S3 endpoint type as the origin. As the origin, use a REST API endpoint with OAI.<\/p>\n<p>1. access restrictions. We utilize the Amazon S3 console to establish a bucket and upload the website files.<\/p>\n<ol start=\"2\">\n<li>Next, we&#8217;ll set up an<a href=\"https:\/\/www.velaninfo.com\/rs\/tech-tips\/aws\/\"><strong> Amazon CloudFront web<\/strong><\/a> distribution.<\/li>\n<\/ol>\n<p>In addition, we enter the following for the use case:<\/p>\n<p>a) The bucket we built has an origin domain name.<\/p>\n<p>b) Bucket Access Restrictions: Yes.<\/p>\n<p>c) Create a New Identity for Origin Access.<\/p>\n<p>d) Note: This is the default value. Alternatively, we might give the OAI a unique label.<\/p>\n<p>e) Grant Bucket Read Permissions: Yes, the Bucket Policy should be updated.<\/p>\n<p>3. To configure SSL, pick Default CloudFront Certificate from the SSL Certificate drop-down menu. Alternatively, you can use a Custom SSL Certificate.<\/p>\n<p>To request a new certificate, we can choose Request or Import a Certificate using ACM.<\/p>\n<p>If we have any Alternate domain names (CNAMEs) for the distribution, they should all be compatible with the SSL certificate we choose.<\/p>\n<ol start=\"4\">\n<li>Finally, we choose to Create Distribution.<\/li>\n<li>The DNS records for the website&#8217;s CNAME must be updated to link to the CloudFront distribution&#8217;s domain name.<\/li>\n<li>After that, we&#8217;ll wait for the DNS updates to take effect.<\/li>\n<\/ol>\n<p>As the origin, use a website endpoint with anonymous access. This grants public read access to the bucket on the website.<\/p>\n<ol>\n<li>We utilize the Amazon S3 console to create a bucket and enable static website hosting.<\/li>\n<li>We copy the bucket&#8217;s Endpoint sans the http:\/\/ from the Static website hosting dialogue box.<\/li>\n<li>Finally, we build a bucket policy that grants public read access to the bucket we created.<\/li>\n<li>Finally, we&#8217;ll set up a CloudFront web distribution.<\/li>\n<li>We set up SSL in the same way we did in the previous step, using either the Default CloudFront Certificate or a Custom SSL Certificate.<\/li>\n<li>Finally, we choose Create Distribution.<\/li>\n<li>Change the domain&#8217;s DNS records to point the CNAME of the website to the CloudFront distribution&#8217;s domain name.<\/li>\n<li>Finally, we wait for the adjustments to take effect.<\/li>\n<\/ol>\n<p>Use a website endpoint as the origin, with a Referrer header limiting access.<\/p>\n<ol>\n<li>We utilize the Amazon S3 console to create a bucket and enable static website hosting.<\/li>\n<li>From the Static website hosting dialogue box, we copy the bucket&#8217;s Endpoint without the leading http:\/\/.<\/li>\n<li>Next, we&#8217;ll set up a CloudFront web distribution.<\/li>\n<\/ol>\n<p>We enter a random or secret value to restrict access to the origin.<\/p>\n<ol start=\"4\">\n<li>We set up SSL in the same way as before, using either the Default CloudFront Certificate or a Custom SSL Certificate.<\/li>\n<\/ol>\n<p>5. Finally, we choose Create Distribution.<\/p>\n<ol start=\"6\">\n<li>Next, we&#8217;ll use the Amazon S3 console to access the website&#8217;s bucket.<\/li>\n<\/ol>\n<p>After that, we implement a bucket policy that lets us to use s3: GetObject. This is subject to the condition that the request contains the custom.<\/p>\n<p>On the other hand, any request that does not include the custom Referrer header would be denied access.<\/p>\n<p>To do so, we employ a bucket policy with an explicit deny statement.<\/p>\n<ol start=\"7\">\n<li>We then alter the domain&#8217;s DNS records to link the CNAME of the website to the CloudFront distribution&#8217;s domain name.<\/li>\n<li>Finally, we must wait for the DNS adjustments to take effect.<\/li>\n<\/ol>\n<p>At <strong>Velan<\/strong>, our server support engineers can help to set up Amazon CloudFront to Serve a Static Website. If you are interested in our service, please fill the Quick connect form to <a href=\"https:\/\/www.velaninfo.com\/contact\"><strong>get in touch with us<\/strong><\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The following steps below are to set up an Amazon CloudFront distribution with the S3 endpoint type as the origin. As the origin, use a REST API endpoint with OAI. 1. access restrictions. We utilize the Amazon S3 console to establish a bucket and upload the website files. Next, we&#8217;ll set up an Amazon CloudFront&#8230;<a class=\"continue-reading text-uppercase\" href=\"https:\/\/www.velaninfo.com\/rs\/techtips\/cloudfront-serve-static-website\/\"> Continue Reading <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.velaninfo.com\/rs\/wp-content\/themes\/velaninfo\/images\/reading_arw.png\" alt=\"Continue Reading\" width=\"16\" height=\"12\"\/><\/a><\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"tags":[],"class_list":["post-1214","techtips","type-techtips","status-publish","hentry","Categories_tech_tip-aws","Categories_tech_tip-cloud","Categories_tech_tip-cloudfront"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v19.5 (Yoast SEO v27.8) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Use Amazon CloudFront to Serve a Static Website | Velan<\/title>\n<meta name=\"description\" content=\"Amazon CloudFront is a fast content delivery network (CDN) service. CloudFront allows businesses to deploy content with low latency.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.velaninfo.com\/rs\/techtips\/cloudfront-serve-static-website\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Use CloudFront to Serve a Static Website?\" \/>\n<meta property=\"og:description\" content=\"Amazon CloudFront is a fast content delivery network (CDN) service. CloudFront allows businesses to deploy content with low latency.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.velaninfo.com\/rs\/techtips\/cloudfront-serve-static-website\/\" \/>\n<meta property=\"og:site_name\" content=\"Velan\" \/>\n<meta property=\"article:modified_time\" content=\"2021-10-04T11:05:10+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/techtips\\\/cloudfront-serve-static-website\\\/\",\"url\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/techtips\\\/cloudfront-serve-static-website\\\/\",\"name\":\"How to Use Amazon CloudFront to Serve a Static Website | Velan\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/#website\"},\"datePublished\":\"2021-08-02T11:47:27+00:00\",\"dateModified\":\"2021-10-04T11:05:10+00:00\",\"description\":\"Amazon CloudFront is a fast content delivery network (CDN) service. CloudFront allows businesses to deploy content with low latency.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/techtips\\\/cloudfront-serve-static-website\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/techtips\\\/cloudfront-serve-static-website\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/techtips\\\/cloudfront-serve-static-website\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tech Tips\",\"item\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/techtips\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Use CloudFront to Serve a Static Website?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/#website\",\"url\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/\",\"name\":\"Velan\",\"description\":\"Velaninfo Services India Pvt Ltd\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.velaninfo.com\\\/rs\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Use Amazon CloudFront to Serve a Static Website | Velan","description":"Amazon CloudFront is a fast content delivery network (CDN) service. CloudFront allows businesses to deploy content with low latency.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.velaninfo.com\/rs\/techtips\/cloudfront-serve-static-website\/","og_locale":"en_US","og_type":"article","og_title":"How to Use CloudFront to Serve a Static Website?","og_description":"Amazon CloudFront is a fast content delivery network (CDN) service. CloudFront allows businesses to deploy content with low latency.","og_url":"https:\/\/www.velaninfo.com\/rs\/techtips\/cloudfront-serve-static-website\/","og_site_name":"Velan","article_modified_time":"2021-10-04T11:05:10+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.velaninfo.com\/rs\/techtips\/cloudfront-serve-static-website\/","url":"https:\/\/www.velaninfo.com\/rs\/techtips\/cloudfront-serve-static-website\/","name":"How to Use Amazon CloudFront to Serve a Static Website | Velan","isPartOf":{"@id":"https:\/\/www.velaninfo.com\/rs\/#website"},"datePublished":"2021-08-02T11:47:27+00:00","dateModified":"2021-10-04T11:05:10+00:00","description":"Amazon CloudFront is a fast content delivery network (CDN) service. CloudFront allows businesses to deploy content with low latency.","breadcrumb":{"@id":"https:\/\/www.velaninfo.com\/rs\/techtips\/cloudfront-serve-static-website\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.velaninfo.com\/rs\/techtips\/cloudfront-serve-static-website\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.velaninfo.com\/rs\/techtips\/cloudfront-serve-static-website\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.velaninfo.com\/rs\/"},{"@type":"ListItem","position":2,"name":"Tech Tips","item":"https:\/\/www.velaninfo.com\/rs\/techtips\/"},{"@type":"ListItem","position":3,"name":"How to Use CloudFront to Serve a Static Website?"}]},{"@type":"WebSite","@id":"https:\/\/www.velaninfo.com\/rs\/#website","url":"https:\/\/www.velaninfo.com\/rs\/","name":"Velan","description":"Velaninfo Services India Pvt Ltd","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.velaninfo.com\/rs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.velaninfo.com\/rs\/wp-json\/wp\/v2\/techtips\/1214","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.velaninfo.com\/rs\/wp-json\/wp\/v2\/techtips"}],"about":[{"href":"https:\/\/www.velaninfo.com\/rs\/wp-json\/wp\/v2\/types\/techtips"}],"author":[{"embeddable":true,"href":"https:\/\/www.velaninfo.com\/rs\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.velaninfo.com\/rs\/wp-json\/wp\/v2\/comments?post=1214"}],"version-history":[{"count":6,"href":"https:\/\/www.velaninfo.com\/rs\/wp-json\/wp\/v2\/techtips\/1214\/revisions"}],"predecessor-version":[{"id":1458,"href":"https:\/\/www.velaninfo.com\/rs\/wp-json\/wp\/v2\/techtips\/1214\/revisions\/1458"}],"wp:attachment":[{"href":"https:\/\/www.velaninfo.com\/rs\/wp-json\/wp\/v2\/media?parent=1214"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.velaninfo.com\/rs\/wp-json\/wp\/v2\/tags?post=1214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}