<?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: Rubén Below</title>
    <description>The latest articles on DEV Community by Rubén Below (@rbelow).</description>
    <link>https://dev.to/rbelow</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%2F347505%2F4a3a7928-7eff-4aa8-b57a-6b7f7ac0f1e0.jpeg</url>
      <title>DEV Community: Rubén Below</title>
      <link>https://dev.to/rbelow</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rbelow"/>
    <language>en</language>
    <item>
      <title>How to Contribute to the Gatsby Repository</title>
      <dc:creator>Rubén Below</dc:creator>
      <pubDate>Wed, 18 Mar 2020 18:29:09 +0000</pubDate>
      <link>https://dev.to/rbelow/how-to-contribute-to-the-gatsby-repository-4em4</link>
      <guid>https://dev.to/rbelow/how-to-contribute-to-the-gatsby-repository-4em4</guid>
      <description>&lt;h4&gt;
  
  
  Learn how to contribute code to the open source project Gatsby
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;In Gatsby all projects are packages including Gatsby, plugins, and themes:&lt;/strong&gt; It's a &lt;a href="https://en.wikipedia.org/wiki/Monorepo"&gt;monorepo&lt;/a&gt; managed with &lt;a href="https://lerna.js.org/"&gt;Lerna&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;At the end of this tutorial, &lt;strong&gt;you'll have a working local setup&lt;/strong&gt; where you can test your changes to a Gatsby package.&lt;/p&gt;

&lt;p&gt;Gatsby is one of the favorite static site generators right now. With more than 42.000 GitHub stars it's a major contributor to the &lt;a href="https://jamstack.org/"&gt;Jamstack concept&lt;/a&gt;. I would even say, one of their flagships.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://github.com/gatsbyjs/gatsby"&gt;source code lives on Github&lt;/a&gt; and everybody is welcome to contribute to the project.&lt;/p&gt;

&lt;p&gt;If you encounter some problem while following this tutorial. Take a look at the troubleshooting section, at the end of this post.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Let's start.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Set Up the Gatsby Project
&lt;/h2&gt;

&lt;p&gt;Go to the Gatsby GitHub project and &lt;a href="https://help.github.com/en/github/getting-started-with-github/fork-a-repo"&gt;fork it&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The Gatsby project itself, all his packages, and the contributors documentation use Yarn as the package manager (&lt;a href="https://classic.yarnpkg.com/en/docs/install/"&gt;find out how to install Yarn&lt;/a&gt;).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Clone the forked repo to your local machine.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# clone the fork&lt;/span&gt;
git clone &lt;span class="nt"&gt;--depth&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 https://github.com/&amp;lt;your-username&amp;gt;/gatsby.git

&lt;span class="c"&gt;# go to gatsby&lt;/span&gt;
&lt;span class="nb"&gt;cd &lt;/span&gt;gatsby/

&lt;span class="c"&gt;# install and build the projects&lt;/span&gt;
yarn run bootstrap

&lt;span class="c"&gt;# check if everything works&lt;/span&gt;
yarn &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Configure the Git upstream.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# check your current remote configuration&lt;/span&gt;
git remote &lt;span class="nt"&gt;-v&lt;/span&gt;

&lt;span class="c"&gt;# configure the original gatsby repo as your remote upstream&lt;/span&gt;
git remote add upstream https://github.com/gatsbyjs/gatsby.git

&lt;span class="c"&gt;# check if the configuration has updated&lt;/span&gt;
git remote &lt;span class="nt"&gt;-v&lt;/span&gt;

&lt;span class="c"&gt;# download objects and refs from the upstream&lt;/span&gt;
git fetch upstream

&lt;span class="c"&gt;# integrate the upstream master into your local branch&lt;/span&gt;
git merge upstream/master
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Create a branch.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# create the branch where you're going to work&lt;/span&gt;
git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; &amp;lt;feature-or-bugfix&amp;gt;/&amp;lt;feature-or-bugfix-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Create a symlink to a Gatsby package.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# change to the package directory (in this case a gatsby plugin)&lt;/span&gt;
&lt;span class="nb"&gt;cd &lt;/span&gt;packages/gatsby-transformer-remark/

&lt;span class="c"&gt;# create the global symlink to the package&lt;/span&gt;
yarn &lt;span class="nb"&gt;link&lt;/span&gt;

&lt;span class="c"&gt;# start watching the package files for changes&lt;/span&gt;
yarn watch
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Add &lt;code&gt;console.warn(`HELLO_GATSBY_DEVELOPMENT`)&lt;/code&gt; to &lt;code&gt;gatsby-transformer-remark&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// in packages/gatsby-transformer-remark/src/on-node-create.js:16&lt;/span&gt;

&lt;span class="c1"&gt;// code...&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createNode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;createParentChildLink&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Add the next line before the if:&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;warn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`HELLO_GATSBY_DEVELOPMENT`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// We only care about markdown content.&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;internal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mediaType&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s2"&gt;`text/markdown`&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
  &lt;span class="nx"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;internal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mediaType&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s2"&gt;`text/x-markdown`&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// more code...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Set Up a Gatsby Site
&lt;/h2&gt;

&lt;p&gt;Now you're going to set up a Gatsby site as an end-user would do. This will help you to test the changes you're doing to the Gatsby project.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Gatsby CLI generated sites and the Gatsby end-user documentation use npm.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Open a new terminal and create a Gatsby test site.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# install gatsby-cli&lt;/span&gt;
npm i &lt;span class="nt"&gt;-g&lt;/span&gt; gatsby-cli

&lt;span class="c"&gt;# go back to your workspace directory&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ../../../

&lt;span class="c"&gt;# create a new gatsby site&lt;/span&gt;
gatsby new gatsby-test-site

&lt;span class="c"&gt;# change directory into site folder&lt;/span&gt;
&lt;span class="nb"&gt;cd &lt;/span&gt;gatsby-test-site/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Link the Gatsby plugin inside &lt;code&gt;gatsby-test-site&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# link the local package (the package will not appear in your package.json)&lt;/span&gt;
npm &lt;span class="nb"&gt;link &lt;/span&gt;gatsby-transformer-remark
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Add configuration to &lt;code&gt;gatsby-config.js&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// In your gatsby-config.js&lt;/span&gt;
&lt;span class="nx"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`gatsby-transformer-remark`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// CommonMark mode (default: true)&lt;/span&gt;
      &lt;span class="na"&gt;commonmark&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="c1"&gt;// Footnotes mode (default: true)&lt;/span&gt;
      &lt;span class="na"&gt;footnotes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="c1"&gt;// Pedantic mode (default: true)&lt;/span&gt;
      &lt;span class="na"&gt;pedantic&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="c1"&gt;// GitHub Flavored Markdown mode (default: true)&lt;/span&gt;
      &lt;span class="na"&gt;gfm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="c1"&gt;// Plugins configs&lt;/span&gt;
      &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Start the &lt;code&gt;gatsby-test-site&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;gatsby develop
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You should see the &lt;code&gt;HELLO_GATSBY_DEVELOPMENT&lt;/code&gt; in the terminal.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Congratulations! You have a working Gatsby environment. And you can start contributing to the open source project right now.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Find first-time friendly issues on the &lt;a href="https://github.com/gatsbyjs/gatsby/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22"&gt;Gatsby project issues tab&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You got questions or want to start a conversation? Contact me on &lt;a href="https://twitter.com/rbelow_"&gt;Twitter&lt;/a&gt; or &lt;a href="https://github.com/rbelow"&gt;GitHub&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;By the way: don't forget to test and lint the package you're changing.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# from the root of the gatsby repo&lt;/span&gt;
yarn jest gatsby-transformer-remark

yarn lint
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Happy coding!&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;h3&gt;
  
  
  gatsby develop throws errors
&lt;/h3&gt;

&lt;p&gt;When executing &lt;code&gt;gatsby develop&lt;/code&gt; on your &lt;code&gt;gatsby-test-site&lt;/code&gt; throws errors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clean up the Gatsby cache with &lt;code&gt;gatsby clean&lt;/code&gt;. If the problem persists remove &lt;code&gt;node_modules&lt;/code&gt;, and &lt;code&gt;package-lock.json&lt;/code&gt; and do &lt;code&gt;npm i&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To make it easier for the future add a script to your &lt;code&gt;package.json&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"clean:npm"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"rm -rf ./node_modules/ &amp;amp;&amp;amp; rm ./package-lock.json"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Error: ENOSPC: System limit for number of file watchers reached
&lt;/h3&gt;

&lt;p&gt;If you get a &lt;code&gt;System limit for number of file watchers reached&lt;/code&gt; error, while watching files on a Linux distribution:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers"&gt;Increase the file watch limit of your OS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Kudos for learning with this tutorial.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Follow me on &lt;a href="https://github.com/rbelow"&gt;GitHub&lt;/a&gt; or &lt;a href="https://twitter.com/rbelow_"&gt;Twitter&lt;/a&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If for some casual the indications did not work for you; &lt;a href="//mailto:hello@rubenbelow.com?subject=Infringing%20Point"&gt;drop me a line with the infringing points&lt;/a&gt;. I'll update the post correspondingly.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Software Versions
&lt;/h2&gt;

&lt;p&gt;These are the software versions used for this tutorial:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gatsby: 2.19.32&lt;/li&gt;
&lt;li&gt;Gatsby CLI: 2.8.27&lt;/li&gt;
&lt;li&gt;gatsby-transformer-remark: 2.6.55&lt;/li&gt;
&lt;li&gt;Node.js: 12.16.1&lt;/li&gt;
&lt;li&gt;npm: 6.13.4&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.gatsbyjs.org/contributing/setting-up-your-local-dev-environment/#add-tests"&gt;Setting up Your Local Dev Environment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.gatsbyjs.org/docs/debugging-the-build-process/#chrome-devtools-for-node"&gt;Debugging the Build Process&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.gatsbyjs.org/docs/adding-markdown-pages/"&gt;Adding Markdown Pages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=D0SwX1MSuas"&gt;gatsby-dev-cli Usage Example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/configuring-a-remote-for-a-fork"&gt;Configuring a Remote for a Fork&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/syncing-a-fork"&gt;Syncing a Fork&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  More Posts
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://rubenbelow.com/posts/third-party-apex-domain-aws-s3-static-website-routing/"&gt;Routing an External Registered Apex Domain to an AWS S3 Bucket&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://rubenbelow.com/posts/welcome/"&gt;Welcome&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>gatsby</category>
      <category>opensource</category>
      <category>jamstack</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Routing an External Registered Apex Domain to an AWS S3 Bucket</title>
      <dc:creator>Rubén Below</dc:creator>
      <pubDate>Thu, 12 Mar 2020 19:40:02 +0000</pubDate>
      <link>https://dev.to/rbelow/routing-an-external-registered-apex-domain-to-an-aws-s3-bucket-e2o</link>
      <guid>https://dev.to/rbelow/routing-an-external-registered-apex-domain-to-an-aws-s3-bucket-e2o</guid>
      <description>&lt;p&gt;Your website will be accessible with HTTP. To access it with HTTPS do these three extra steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-public.html" rel="noopener noreferrer"&gt;Create a certificate&lt;/a&gt; with the AWS Certificate Manager for your domain&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-serve-static-website/" rel="noopener noreferrer"&gt;Create an AWS CloudFront distribution&lt;/a&gt; for your "root" S3 bucket. Associate the certificate to it&lt;/li&gt;
&lt;li&gt;Point the &lt;code&gt;ALIAS&lt;/code&gt; record of your apex domain to the new CloudFront distribution&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How to Point a Naked Domain - Not Registered with Route 53 - to an AWS S3 Hosted Static Website
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;So people can access your website through &lt;code&gt;example.com&lt;/code&gt; instead of &lt;code&gt;www.example.com&lt;/code&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In this post, we're going to connect an &lt;a href="https://www.quora.com/What-is-an-apex-domain" rel="noopener noreferrer"&gt;apex domain&lt;/a&gt; with an AWS S3 hosted website. The naked domain is bought in a domain name registrar other than AWS Route 53. In this case &lt;a href="https://www.ovh.com/" rel="noopener noreferrer"&gt;OVH&lt;/a&gt;. &lt;strong&gt;For other registrars the steps are similar.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Apex domains, generally, cannot make use of &lt;code&gt;CNAME&lt;/code&gt; records. Allowed are &lt;code&gt;A&lt;/code&gt; or &lt;code&gt;AAAA&lt;/code&gt; records, pointing to static IPs. This makes it harder to use our naked domain for our website: &lt;code&gt;example.com&lt;/code&gt;. This is because of the dynamic nature of AWS S3 instances. They expose a subdomain endpoint, so they can route the internal traffic with freedom.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Let's start.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Copy your current zone file
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.ovh.com/auth/" rel="noopener noreferrer"&gt;Log in to your OVH account&lt;/a&gt;, go to: &lt;em&gt;Domains &amp;gt; DNS zone&lt;/em&gt;, and reduce the &lt;code&gt;TTL&lt;/code&gt; (Time to Live). The authoritative name servers cache will expire faster now. This is good because we're going to change the &lt;code&gt;NS&lt;/code&gt; (Name Server) records.&lt;/p&gt;

&lt;p&gt;Now click on: &lt;em&gt;DNS zone &amp;gt; Change in text format&lt;/em&gt;, and copy your RRs (Resource Records).&lt;/p&gt;

&lt;p&gt;It should look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$TTL 3600
@   IN SOA dns18.ovh.net. tech.ovh.net. (2019112215 86400 3600 3600000 300)
                          IN NS     dns18.ovh.net.
                          IN NS     ns18.ovh.net.
                          IN MX     100 mx3.mail.ovh.net.
                          IN MX     1 mx1.mail.ovh.net.
                          IN MX     5 mx2.mail.ovh.net.
                          IN A      ???
                          IN AAAA   ???
                          IN TXT    "1|www.rubenbelow.com"
                      600 IN TXT    "v=spf1 include:mx.ovh.com ~all"
_autodiscover._tcp        IN SRV    0 0 443 mailconfig.ovh.net.
_imaps._tcp               IN SRV    0 0 993 ssl0.ovh.net.
_submission._tcp          IN SRV    0 0 465 ssl0.ovh.net.
autoconfig                IN CNAME  mailconfig.ovh.net.
autodiscover              IN CNAME  mailconfig.ovh.net.
ftp                       IN CNAME  rubenbelow.com.
imap                      IN CNAME  ssl0.ovh.net.
mail                      IN CNAME  ssl0.ovh.net.
pop3                      IN CNAME  ssl0.ovh.net.
smtp                      IN CNAME  ssl0.ovh.net.
www                       IN CNAME  ???
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Some values are replaced with: ???&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In the next step, we're going to import our entries in AWS Route 53. Before, let us delete some entries.&lt;/p&gt;

&lt;p&gt;Records to delete:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;IN NS     dns18.ovh.net.
IN NS     ns18.ovh.net.
...
IN A      ???
IN AAAA   ???
...
www                       IN CNAME  ???
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Create an AWS Route 53 Hosted Zone
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://console.aws.amazon.com/route53/home#hosted-zones:" rel="noopener noreferrer"&gt;Log in to your AWS console&lt;/a&gt;, go to Route 53, and click on: &lt;em&gt;Create Hosted Zone&lt;/em&gt;. As: &lt;em&gt;Domain Name&lt;/em&gt;, use the name of your apex domain: &lt;code&gt;example.com&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Modify your DNS file SOA record
&lt;/h3&gt;

&lt;p&gt;Before starting with the next step we need to change the &lt;code&gt;SOA&lt;/code&gt; (Start of Authority) record to match the new one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Change:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@   IN SOA dns18.ovh.net. tech.ovh.net. (2019112215 86400 3600 3600000 300)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;To the &lt;code&gt;SOA&lt;/code&gt; record in your new Hosted Zone.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The entry should now be like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@   IN SOA ns-289.awsdns-36.com. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Import your DNS file into Route 53
&lt;/h3&gt;

&lt;p&gt;Now that we have a fresh hosted zone we'll import the &lt;code&gt;RR&lt;/code&gt; records we exported from OVH.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do not import the previously deleted &lt;code&gt;NS&lt;/code&gt;, &lt;code&gt;A&lt;/code&gt;, and &lt;code&gt;AAAA&lt;/code&gt; records!&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click on your new Hosted Zone: &lt;code&gt;example.com&lt;/code&gt; (you'll see a list of RRs)&lt;/li&gt;
&lt;li&gt;Click on: &lt;em&gt;Import Zone File&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Paste your previously exported &lt;code&gt;DNS&lt;/code&gt; records&lt;/li&gt;
&lt;li&gt;Import your &lt;code&gt;DNS&lt;/code&gt; records&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you get: &lt;em&gt;"Error parsing zone file: One resource cannot have multiple distinct TTL values"&lt;/em&gt;. Delete the mismatching &lt;code&gt;TTL&lt;/code&gt; from the zone file.&lt;/p&gt;

&lt;p&gt;From:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;600 IN TXT    "v=spf1 include:mx.ovh.com ~all"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;IN TXT    "v=spf1 include:mx.ovh.com ~all"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Add an ALIAS record
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;So far, so good.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now we add an &lt;code&gt;A&lt;/code&gt; &lt;code&gt;ALIAS&lt;/code&gt; record for the naked domain; &lt;code&gt;example.com&lt;/code&gt; pointing to our AWS S3 bucket.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fgz70u7v6p981zwc5u7wc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fgz70u7v6p981zwc5u7wc.png" alt="AWS Route 53 A record with ALIAS"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;It should be like this but with an S3 bucket URL instead of a CloudFront URL&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do the same now with an &lt;code&gt;AAAA&lt;/code&gt; record.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Add a CNAME record
&lt;/h3&gt;

&lt;p&gt;Add a &lt;code&gt;CNAME&lt;/code&gt; record for your &lt;code&gt;www&lt;/code&gt; subdomain pointing to your apex domain: &lt;code&gt;example.com&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwcknw28n3ljoqc4yelxj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwcknw28n3ljoqc4yelxj.png" alt="AWS Route 53 CNAME record pointing to apex domain"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;It should be like this&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Get your new NS entries
&lt;/h3&gt;

&lt;p&gt;Get the values of your &lt;code&gt;NS&lt;/code&gt; entry. We're going to use them at OVH in the next step.&lt;/p&gt;

&lt;p&gt;They should be like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ns-289.awsdns-36.com.
ns-1715.awsdns-22.co.uk.
ns-1241.awsdns-27.org.
ns-740.awsdns-28.net.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Add your new AWS NS values to your domains registrar
&lt;/h3&gt;

&lt;p&gt;In your OVH account go to: &lt;em&gt;DNS servers&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Delete the old OVH &lt;code&gt;NS&lt;/code&gt; records&lt;/li&gt;
&lt;li&gt;Add your new AWS &lt;code&gt;NS&lt;/code&gt; records&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;Good to go.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Troubleshooting
&lt;/h3&gt;

&lt;p&gt;The changes will take some time to propagate (sometimes up to 24h). We can check the state of the DNS (Domain Name Server) update on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.zonemaster.net/domain_check" rel="noopener noreferrer"&gt;Zonemaster&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mxtoolbox.com/dnscheck.aspx" rel="noopener noreferrer"&gt;MXToolBox&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dnschecker.org/" rel="noopener noreferrer"&gt;DNS Checker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the DNS update is done but you cannot access &lt;code&gt;example.com&lt;/code&gt; through your computer, it could be that your ISP (Internet Service Provider) still did not update their RR cache. In this case, you should be able to &lt;a href="https://www.hidemyass.com/en-eu/proxy" rel="noopener noreferrer"&gt;access your website through a VPN&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;Thanks for learning with this tutorial.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Follow me on &lt;a href="https://github.com/rbelow" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If for some casual the indications did not work for you; don't mind to &lt;a href="//mailto:hello@rubenbelow.com?subject=Infringing%20Point"&gt;drop me a line with the infringing points&lt;/a&gt;. I'll update the post correspondingly.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/de_de/Route53/latest/DeveloperGuide/MigratingDNS.html" rel="noopener noreferrer"&gt;Migrating DNS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/de_de/Route53/latest/DeveloperGuide/migrate-dns-domain-in-use.html" rel="noopener noreferrer"&gt;Migrate DNS Domain in Use&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/34478249/how-to-resolve-error-in-aws-route-53-import-zone-file-error-multiple-distinc" rel="noopener noreferrer"&gt;How to Resolve Error in AWS Route 53 Import Zone File&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  More Posts
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://rubenbelow.com/posts/welcome/" rel="noopener noreferrer"&gt;Welcome&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>dns</category>
      <category>apexdomain</category>
      <category>aws</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
