<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>dns on Alperen Doc</title><link>https://blog.ulutasalperen.com/docs/aws/dns/</link><description>Recent content in dns on Alperen Doc</description><generator>Hugo</generator><language>en</language><atom:link href="https://blog.ulutasalperen.com/docs/aws/dns/index.xml" rel="self" type="application/rss+xml"/><item><title>route-53-hosted-zones</title><link>https://blog.ulutasalperen.com/docs/aws/dns/route-53-hosted-zones/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/aws/dns/route-53-hosted-zones/</guid><description>&lt;h1 id="route-53-hosted-zones"&gt;Route 53 Hosted Zones&lt;a class="anchor" href="#route-53-hosted-zones"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;So far in this course, every time we&amp;rsquo;ve needed to communicate with an AWS resource we set up, we&amp;rsquo;ve identified it in one of two ways:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;A &lt;strong&gt;raw &lt;a href="https://en.wikipedia.org/wiki/IPv4"&gt;IPv4&lt;/a&gt; address&lt;/strong&gt;, like we used to load the web app, or to &lt;a href="https://en.wikipedia.org/wiki/Secure_Shell"&gt;SSH&lt;/a&gt; into &lt;a href="https://aws.amazon.com/ec2/"&gt;EC2&lt;/a&gt; instances.&lt;/li&gt;&#10;&lt;li&gt;An &lt;strong&gt;AWS-provided domain name&lt;/strong&gt;, like &lt;code&gt;patientping-db.random_id.us-east-1.rds.amazonaws.com&lt;/code&gt; for an &lt;a href="https://aws.amazon.com/rds/"&gt;RDS&lt;/a&gt; instance.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;But usually for a &lt;em&gt;real&lt;/em&gt; company, we need to bring &lt;em&gt;our own domain name&lt;/em&gt; and point it to AWS resources.&lt;/p&gt;</description></item><item><title>aws-a-records</title><link>https://blog.ulutasalperen.com/docs/aws/dns/aws-a-records/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/aws/dns/aws-a-records/</guid><description>&lt;h1 id="a-records"&gt;A Records&lt;a class="anchor" href="#a-records"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;DNS records tell the world where your domain points to. The most fundamental type of record is the &lt;strong&gt;A record&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;An A record (i.e., &lt;a href="https://www.cloudflare.com/learning/dns/dns-records/dns-a-record/"&gt;Address record&lt;/a&gt;) maps a domain name to an IP address. It&amp;rsquo;s the most common type of DNS record.&lt;/p&gt;&#10;&lt;p&gt;When someone looks up &lt;code&gt;www.ulutasalperen.com&lt;/code&gt;, their &lt;a href="https://www.cloudflare.com/learning/dns/dns-server-types/"&gt;DNS resolver&lt;/a&gt; will ultimately find an A record with the IP address of that site&amp;rsquo;s server.&lt;/p&gt;&#10;&lt;p&gt;Try it yourself with the &lt;a href="https://en.wikipedia.org/wiki/Dig_%5c%28command%5c%29"&gt;&lt;code&gt;dig&lt;/code&gt;&lt;/a&gt; command line tool: &lt;code&gt;dig www.ulutasalperen.dev&lt;/code&gt;. It&amp;rsquo;s useful for troubleshooting, and using it can teach you a lot about DNS.&lt;/p&gt;</description></item><item><title>dns-ttl-and-caching</title><link>https://blog.ulutasalperen.com/docs/aws/dns/dns-ttl-and-caching/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/aws/dns/dns-ttl-and-caching/</guid><description>&lt;h1 id="dns-ttl-and-caching"&gt;DNS TTL and Caching&lt;a class="anchor" href="#dns-ttl-and-caching"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;When you update a DNS record, the change doesn&amp;rsquo;t appear everywhere immediately. DNS is &lt;a href="https://en.wikipedia.org/wiki/Eventual_consistency"&gt;eventually consistent&lt;/a&gt; and &lt;em&gt;heavily&lt;/em&gt; cached.&lt;/p&gt;&#10;&lt;p&gt;&amp;ldquo;Eventually consistent&amp;rdquo; means changes are applied, but not everywhere at once. It takes time to propagate.&lt;/p&gt;&#10;&lt;p&gt;When creating DNS records, you&amp;rsquo;ll notice a field called &lt;a href="https://www.cloudflare.com/learning/cdn/glossary/time-to-live-ttl/"&gt;TTL&lt;/a&gt; (Time To Live). This tells resolvers how often to re-check a record. If our records change often, clients need a lower TTL.&lt;/p&gt;&#10;&lt;p&gt;The trade-off is always the same: lower TTL means faster updates but more queries (and more cost). Higher TTL means slower updates but fewer queries.&lt;/p&gt;</description></item><item><title>aws-verifying-dns</title><link>https://blog.ulutasalperen.com/docs/aws/dns/aws-verifying-dns/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/aws/dns/aws-verifying-dns/</guid><description>&lt;h1 id="verifying-dns"&gt;Verifying DNS&lt;a class="anchor" href="#verifying-dns"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;We have a &lt;code&gt;www.patientping.internal&lt;/code&gt; domain name, but it&amp;rsquo;s &lt;em&gt;only accessible within our VPC&lt;/em&gt;.&lt;/p&gt;&#10;&lt;p&gt;In other words, this command won&amp;rsquo;t produce a meaningful IP address locally:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dig www.patientping.internal +short&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;but if you run that command from the &lt;code&gt;patientping-web-v2&lt;/code&gt; EC2 instance (that&amp;rsquo;s inside the VPC), you should be able to resolve the domain name!&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ssh patientping&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dig www.patientping.internal +short&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# 10.0.10.50&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="example"&gt;Example&lt;a class="anchor" href="#example"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;strong&gt;Verify that &lt;code&gt;www.patientping.internal&lt;/code&gt; resolves from inside &lt;code&gt;patientping-web-v2&lt;/code&gt; over SSH.&lt;/strong&gt;&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;SSH into your app server:&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ssh patientping&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start="2"&gt;&#10;&lt;li&gt;Install &lt;code&gt;dig&lt;/code&gt; (if not already installed):&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo dnf install bind-utils&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start="3"&gt;&#10;&lt;li&gt;Run DNS lookup from the server:&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;dig www.patientping.internal +short&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start="4"&gt;&#10;&lt;li&gt;Confirm the command returns &lt;code&gt;10.0.10.50&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;Exit the server:&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;exit&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>aws-cname-records</title><link>https://blog.ulutasalperen.com/docs/aws/dns/aws-cname-records/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://blog.ulutasalperen.com/docs/aws/dns/aws-cname-records/</guid><description>&lt;h1 id="cname-records"&gt;CNAME Records&lt;a class="anchor" href="#cname-records"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;What if you want &lt;code&gt;dev.ulutasalperen.com&lt;/code&gt; to point to the same server as &lt;code&gt;blog.ulutas.com&lt;/code&gt;? You could create another A record pointing to the same IP address, but there&amp;rsquo;s a better way: &lt;strong&gt;CNAME records&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;A &lt;strong&gt;&lt;a href="https://www.cloudflare.com/learning/dns/dns-records/dns-cname-record/"&gt;CNAME record&lt;/a&gt;&lt;/strong&gt; (Canonical Name) maps one domain name to another domain name. It&amp;rsquo;s &lt;em&gt;kind of&lt;/em&gt; like a DNS-level redirect (or more accurately, an alias).&lt;/p&gt;&#10;&lt;p&gt;When someone looks up &lt;code&gt;dev.ulutasalperen.com&lt;/code&gt;, the CNAME says: &amp;ldquo;Check &lt;code&gt;blog.ulutasalperen.com&lt;/code&gt; instead.&amp;rdquo; That domain&amp;rsquo;s A record then provides the IP address.&lt;/p&gt;</description></item></channel></rss>