<?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: Dave Sugden</title>
    <description>The latest articles on DEV Community by Dave Sugden (@davelms).</description>
    <link>https://dev.to/davelms</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%2F332854%2Fdc91abab-36e8-4054-9b11-8a30f3dcac66.jpeg</url>
      <title>DEV Community: Dave Sugden</title>
      <link>https://dev.to/davelms</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/davelms"/>
    <language>en</language>
    <item>
      <title>Setting up a custom domain in CloudFront</title>
      <dc:creator>Dave Sugden</dc:creator>
      <pubDate>Sat, 15 Feb 2020 22:13:45 +0000</pubDate>
      <link>https://dev.to/davelms/using-a-custom-domain-in-cloudfront-with-an-ssl-certificate-and-route-53-2789</link>
      <guid>https://dev.to/davelms/using-a-custom-domain-in-cloudfront-with-an-ssl-certificate-and-route-53-2789</guid>
      <description>&lt;p&gt;A beginner-level tutorial to demonstrate how to set up a custom domain in CloudFront, with a managed SSL Certificate and DNS via Route 53.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;This post is part of a wider series documenting my journey in migrating a traditional LAMP website over to a Single Page Application running on the Amazon Web Services platform. Here, I will focus on configuring a custom domain for my CloudFront distribution.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;CloudFront&lt;/strong&gt; is Amazon’s low-latency Content Delivery Network (CDN). Using a CDN speeds up the distribution of content to visitors by serving content from edge locations that are closest to the user.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--X9XPQU3I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0ipsqoh569wcs5bw6sly.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X9XPQU3I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0ipsqoh569wcs5bw6sly.png" alt="Delivering content from Amazon S3 using CloudFront edge locations"&gt;&lt;/a&gt;&lt;/p&gt;
Delivering content from Amazon S3 using CloudFront edge locations



&lt;p&gt;At the time of writing, Amazon has 216 Points of Presence (205 Edge Locations and 11 Regional Edge Caches) in 84 cities across 42 countries.&lt;/p&gt;




&lt;p&gt;When you set up your CloudFront distribution, straight out of the box with the default settings you will have your own &lt;strong&gt;cloudfront.net&lt;/strong&gt; domain.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qsdsLSTq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/vg78uhblyysabbgqd40a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qsdsLSTq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/vg78uhblyysabbgqd40a.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(that is assuming you have already configured CloudFront in front of an S3 bucket that holds your static web content, but if not check out this guide on &lt;a href="https://medium.com/@davelms/serving-static-content-from-s3-using-cloudfront-and-origin-access-identity-c8ca667b3d71"&gt;serving static content from S3 using CloudFront&lt;/a&gt; and come back)&lt;/em&gt;&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/davelms" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hEN7DMi7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--GcEEided--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/332854/dc91abab-36e8-4054-9b11-8a30f3dcac66.jpeg" alt="davelms image"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/davelms/serving-static-content-from-s3-using-cloudfront-and-origin-access-identity-1o8a" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Serving static content from S3 using CloudFront and Origin Access Identity&lt;/h2&gt;
      &lt;h3&gt;Dave Sugden ・ Feb  9 ・ 5 min read&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#aws&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#cloudfront&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#s3&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;But what if you want to serve your content from &lt;strong&gt;my-custom-domain.com&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;To use a custom domain requires a combination of &lt;strong&gt;Route 53&lt;/strong&gt; — Amazon’s highly available and scalable cloud DNS web service — and some additional configuration CloudFront. It doesn’t take too long to set up.&lt;/p&gt;

&lt;p&gt;Before we start, I assume that you have your domain managed in Route 53; it doesn’t matter if you don’t, but this guide assumes you do.&lt;/p&gt;




&lt;p&gt;There is an initial step to obtain an SSL Certificate within &lt;strong&gt;Certificate Manager&lt;/strong&gt;. This allows you to serve your content over https and is a service provided by Amazon for free, and they’ll also take care of its renewal.&lt;/p&gt;

&lt;p&gt;Within the Certificate Manager service, &lt;strong&gt;make sure you change your region to North Virginia&lt;/strong&gt;; I cannot emphasize this one enough as it’s caught me out many a time. Then &lt;strong&gt;Request a Certificate&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The form is pretty self explanatory and you’ll need to provide a means to prove you own the domain — if you’re using Route 53, and we assume you are, then selecting the option that Amazon automatically manages the validation is the simplest approach. The process usually takes a few minutes.&lt;/p&gt;




&lt;p&gt;Now head over to CloudFront and set up your custom domain. This can be done at the time of creating the distribution, but don’t worry if you forgot — you can go back and edit all these settings later. &lt;/p&gt;

&lt;p&gt;The first setting is to list all your &lt;strong&gt;Alternative Domain Names&lt;/strong&gt; in the CloudFront distribution settings.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IN28J6o9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1p3eb3o4ombl9wsirfvx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IN28J6o9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1p3eb3o4ombl9wsirfvx.png" alt="Add all your domain names to CloudFront distribution settings"&gt;&lt;/a&gt;&lt;/p&gt;
Add all your domain names to CloudFront distribution settings



&lt;p&gt;The second setting is to reference the SSL Certificate you created. Check the &lt;strong&gt;Custom SSL Certificate (example.com)&lt;/strong&gt; option and pick your SSL Certificate from the list. Warning; your Alternate Domain Names must match those you specified in the SSL Certificate provisioning request — so if you don’t see your certificate in the list, that is probably the reason.&lt;/p&gt;

&lt;p&gt;With these settings done, the final step is to configure the DNS in Route 53.&lt;/p&gt;




&lt;p&gt;In your domain hosted zone in Route 53, select to &lt;strong&gt;Create Record Set&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We will be creating as an &lt;strong&gt;A record&lt;/strong&gt; for IPv4 and we’ll select the &lt;strong&gt;Alias&lt;/strong&gt; option.&lt;/p&gt;

&lt;p&gt;In the &lt;strong&gt;Alias Target&lt;/strong&gt;, you will find your CloudFront distribution — select and save. Warning; your Alternate Domain Names you configured in CloudFront must match the record set name — so if you don’t see your CloudFront distribution in the target drop down list, that is probably the reason.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6xaNzoe7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fbiq9t2vh9dd4yrs93fo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6xaNzoe7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fbiq9t2vh9dd4yrs93fo.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Repeat to create an &lt;strong&gt;AAA record&lt;/strong&gt; for IPv6.&lt;/p&gt;

&lt;p&gt;And that’s it. Success. You will find that you;&lt;/p&gt;

&lt;p&gt;✔️ are now able to view your website using &lt;strong&gt;my-custom-domain.com&lt;/strong&gt;, with all the added benefits of CloudFront providing edge locations around the world to reduce latency for your visitors.&lt;br&gt;
✔️ have an SSL Certificate that is managed by Amazon and will be automatically renewed for you (at the time of writing, it’s &lt;strong&gt;free&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VcpnaCgF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/u1qhzoipbwlmohtm5qy4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VcpnaCgF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/u1qhzoipbwlmohtm5qy4.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Variations&lt;/strong&gt;. If you don’t use Route 53, the final step will be to add a CNAME entry in your DNS settings and set the value to your CloudFront domain.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloudfront</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Serving static content from S3 using CloudFront and Origin Access Identity</title>
      <dc:creator>Dave Sugden</dc:creator>
      <pubDate>Sun, 09 Feb 2020 19:35:09 +0000</pubDate>
      <link>https://dev.to/davelms/serving-static-content-from-s3-using-cloudfront-and-origin-access-identity-1o8a</link>
      <guid>https://dev.to/davelms/serving-static-content-from-s3-using-cloudfront-and-origin-access-identity-1o8a</guid>
      <description>&lt;p&gt;This tutorial demonstrates how to restrict access to an S3 bucket so that your html, css, and images, are only accessible through CloudFront.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;This post is part of a wider series documenting my journey in migrating a traditional LAMP website over to a Single Page Application running on the Amazon Web Services platform. Here, I will focus on the static content and setting up CloudFront as my CDN.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Using Amazon Simple Storage Service (&lt;strong&gt;Amazon S3&lt;/strong&gt;) is a cheap and effective way to host static websites and other web content.&lt;/p&gt;

&lt;p&gt;You can do so directly from the S3 console by enabling the Static website hosting feature and you’ll get a website of the form &lt;strong&gt;http://my-bucket-name.s3-website-eu-west-1.amazonaws.com&lt;/strong&gt;. You can also create an A-record in Route 53 to use your own custom domain.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N4ppmGKQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0spzc5iuzygafl4b0m6q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N4ppmGKQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0spzc5iuzygafl4b0m6q.png" alt="Basic set up — hosting a static website in S3"&gt;&lt;/a&gt;&lt;/p&gt;
Basic set up — hosting a static website in S3



&lt;p&gt;Some solutions may stop here. For some, this is &lt;em&gt;good enough&lt;/em&gt;. (but this is not the purpose of our article; it would be incredibly short if it was).&lt;/p&gt;




&lt;p&gt;More likely the solution will evolve toward serving content from edge cache locations using &lt;strong&gt;CloudFront&lt;/strong&gt; — Amazon’s low-latency Content Delivery Network (CDN). Using a CDN both speeds up the distribution of content to visitors and will also reduce the overall cost for a busy site.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gwPm8_DL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5aicichnvl9tzg50jwe3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gwPm8_DL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5aicichnvl9tzg50jwe3.png" alt="Introducing CloudFront as our Content Delivery Network"&gt;&lt;/a&gt;&lt;/p&gt;
Introducing CloudFront as our Content Delivery Network



&lt;p&gt;Even with the CDN our visitors can still access the S3 static website directly, and the Solution Architect will now be asked &lt;strong&gt;“how do we restrict access to the S3 bucket so that our html, css, and images, are &lt;em&gt;only&lt;/em&gt; accessible through CloudFront?”&lt;/strong&gt; (&lt;em&gt;this question&lt;/em&gt; is the purpose of this tutorial).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MwCzf4_b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/h77gesq8igjdutnq1auy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MwCzf4_b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/h77gesq8igjdutnq1auy.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The answer is to use &lt;strong&gt;Origin Access Identity&lt;/strong&gt; (OAI).&lt;/p&gt;

&lt;p&gt;We can restrict public access to objects in the S3 bucket — as of today, this is the default setting when creating a new bucket — and we grant permission to the OAI to distribute the content through CloudFront to our visitors from around the world.  We no longer need to configure S3 to host a static website.&lt;/p&gt;

&lt;p&gt;The steps we follow to achieve this solution are;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create the S3 bucket with default settings and upload an index.html file (index.html will not be accessible directly from S3).&lt;/li&gt;
&lt;li&gt;Create a CloudFront distribution with the S3 bucket as its origin (index.html still cannot be accessed).&lt;/li&gt;
&lt;li&gt;Set up the OAI, and configure a policy that permits CloudFront to serve the index.html file (now it all works).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Steps 2 and 3 would normally be applied at the same time, but I’ll demonstrate separately to show the individual steps and how the OAI is the bit of magic sugar in the solution.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;. Create the bucket in S3 that will hold the static content and use all the default settings. The bucket and its objects are &lt;em&gt;not accessible&lt;/em&gt; to the public.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_q1lMSVj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wz4o664wz5fwu26v3dov.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_q1lMSVj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wz4o664wz5fwu26v3dov.png" alt="S3 Bucket holding our static website content"&gt;&lt;/a&gt;&lt;/p&gt;
S3 Bucket holding our static website content



&lt;p&gt;When we attempt to reach the index.html file in a browser, we get an Access Denied error as expected.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Gx5HiQ78--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ndwlqywxp15k9d9wudaq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Gx5HiQ78--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ndwlqywxp15k9d9wudaq.png" alt="Hitting index.html on S3 endpoint receives an Access Denied error"&gt;&lt;/a&gt;&lt;/p&gt;
Hitting index.html on S3 endpoint receives an Access Denied error






&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;. In CloudFront, create a Web distribution and select the S3 bucket as the origin. At this stage, leave everything else as the default settings, scroll to the bottom and create the distribution. You’ll have to wait until it’s deployed and as this can take 10 minutes, go grab a coffee...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zFFdeMcO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/r3u6qf4xft1pq3zkqw9c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zFFdeMcO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/r3u6qf4xft1pq3zkqw9c.png" alt="Our CloudFront distribution for our S3 origin"&gt;&lt;/a&gt;&lt;/p&gt;
Our CloudFront distribution for our S3 origin



&lt;p&gt;Once its status has changed to “Deployed”, it’s ready. At this stage, the index.html page is not accessible on the CloudFront domain.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YfihobXW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/w1wzbr0zp4r900qfupcw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YfihobXW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/w1wzbr0zp4r900qfupcw.png" alt="Hitting index.html on CloudFront endpoint receives an Access Denied error"&gt;&lt;/a&gt;&lt;/p&gt;
Hitting index.html on CloudFront endpoint receives an Access Denied error






&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;. Create the Origin Access Identity and configure the policy in S3 that grants the OAI permission to access objects.&lt;/p&gt;

&lt;p&gt;Since we’re doing this in two stages, we have to edit our existing Origin to access the OAI option; however, usually you would do this at the same time as creating your Web distribution and it’s on the initial list of options.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R79xJjqj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/v5f3w0juxrisesab29w1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R79xJjqj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/v5f3w0juxrisesab29w1.png" alt="Select our origin and click Edit"&gt;&lt;/a&gt;&lt;/p&gt;
Select our origin and click Edit



&lt;p&gt;On the next page, select &lt;strong&gt;Restrict Bucket Access&lt;/strong&gt;, allow Amazon to &lt;strong&gt;Create a New Identity&lt;/strong&gt;, and choose &lt;strong&gt;Yes, Update Bucket Policy&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fCaZx-mg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/onjmnxoxztflj7lbviz5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fCaZx-mg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/onjmnxoxztflj7lbviz5.png" alt="Select the options and save"&gt;&lt;/a&gt;&lt;/p&gt;
Select the options and save



&lt;p&gt;Wait for the status to change to “Deployed” again, and then refresh the page and the index.html page will now be displayed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qsdsLSTq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/vg78uhblyysabbgqd40a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qsdsLSTq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/vg78uhblyysabbgqd40a.png" alt="Our static content is now served correctly via CloudFront"&gt;&lt;/a&gt;&lt;/p&gt;
Our static content is now served correctly via CloudFront



&lt;p&gt;All set. Success. &lt;/p&gt;

&lt;p&gt;✔️ CloudFront edge locations are serving our static content in S3. &lt;br&gt;
✔️ And no one can hit the content in S3 directly.&lt;/p&gt;

&lt;p&gt;Check the direct S3 endpoint again just to be sure that remains blocked, and view the Bucket Policy in S3 that was added automatically to learn more.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;What we didn’t cover today&lt;/strong&gt;. Most solutions are also likely to require;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a custom domain that is configured in Route 53 and CloudFront; &lt;/li&gt;
&lt;li&gt;an SSL certificate from Amazon Certificate Manager so that content can be served over https; &lt;/li&gt;
&lt;li&gt;and have cache expiry limits set on the objects. &lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="https://medium.com/@davelms/using-a-custom-domain-in-cloudfront-with-an-ssl-certificate-and-route-53-253a72f51056" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lGeM0Kkg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/fit/c/96/96/0%2Ag6e7vddVgpVJvQRf" alt="Dave Sugden"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://medium.com/@davelms/using-a-custom-domain-in-cloudfront-with-an-ssl-certificate-and-route-53-253a72f51056" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;AWS - custom domain + CloudFront + SSL + Route 53 | Medium&lt;/h2&gt;
      &lt;h3&gt;Dave Sugden ・ &lt;time&gt;May 3, 2020&lt;/time&gt; ・ 4 min read
      &lt;div class="ltag__link__servicename"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KBvj_QRD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/medium_icon-90d5232a5da2369849f285fa499c8005e750a788fdbf34f5844d5f2201aae736.svg" alt="Medium Logo"&gt;
        Medium
      &lt;/div&gt;
    &lt;/h3&gt;
&lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;In addition, if you have built a Single Page Application (SPA), like Angular or ReactJS, then you may need to configure CORS. &lt;/p&gt;

&lt;p&gt;Finally, we didn’t cover off creating signed URLs, which is useful if you are distributing paid-for content and want to limit access to your edge location caches.&lt;/p&gt;

&lt;p&gt;These will be subject of further posts in this series.&lt;/p&gt;





</description>
      <category>aws</category>
      <category>cloudfront</category>
      <category>s3</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
