{"id":653,"date":"2018-08-23T11:06:19","date_gmt":"2018-08-23T19:06:19","guid":{"rendered":"https:\/\/cloudinsidr.com\/content\/?p=653"},"modified":"2019-07-23T03:07:21","modified_gmt":"2019-07-23T10:07:21","slug":"quick-and-dirty-dns-configuration-using-aws-route-53-or-any-other-service","status":"publish","type":"post","link":"https:\/\/www.cloudinsidr.com\/content\/quick-and-dirty-dns-configuration-using-aws-route-53-or-any-other-service\/","title":{"rendered":"A quick guide to a solid DNS configuration using AWS Route 53 (and how to configure DNS using any other DNS service)"},"content":{"rendered":"<p>The most difficult thing about configuring the DNS settings for a\u00a0domain\u00a0is designing\u00a0a plan of action:\u00a0making up one&#8217;s\u00a0mind about what kind of services you envision and how you want to route the traffic.\u00a0Here&#8217;s a primer on how to configure DNS using Route 53 or any other service.<\/p>\n<p><!--more--><\/p>\n<h2>Step 1. Sign in to the AWS Management Console in your web browser<\/h2>\n<p>In your web browser, sign in to the AWS Management Console.<\/p>\n<p>IMPORTANT: Always use MFA (multi-factor authentication) for your\u00a0IAM credentials. Always use IAM credentials instead of your\u00a0AWS\u00a0root account access (except where required otherwise). An\u00a0IAM login\u00a0uses\u00a0a different URL that might include your AWS account number or an alias of your own choosing (you can set it up this link in the AWS Management Console while signed in with your root account credentials).<\/p>\n<h2>Step 2.\u00a0Navigate to Route 53 and view records sets<\/h2>\n<p>From the Services menu, navigate to Route 53. In the Route 53 dashboard, switch to the view of your Hosted Zones. Add a new hosted zone for the domain name you want to configure.<\/p>\n<p>If the hosted zone for the domain name you want to edit already exists,\u00a0select it\u00a0and click on the button Go to Records Sets at the top of the page (alternatively, you can\u00a0click on the count of existing records sets in the right-hand pane).<\/p>\n<h2>Step 3. Register your name servers with the registrar of your domain name<\/h2>\n<p>When a new Hosted Zone is created, Route 53 automatically generates the obligatory SOA entry as well as an NS record with four name servers supplied\u00a0by AWS. Make sure that these four name servers are registered as authoritative name servers for your domain with the registrar of your domain (this is the company whose service you used to register your domain name).<\/p>\n<h2>Step 4. Create or\u00a0edit records<\/h2>\n<p>The records you need depend on the services you run.<\/p>\n<p>These are the DNS records needed to run a web server:<\/p>\n<ul>\n<li>an A record pointing from the domain name to the (external, public) IPv4 address of your web server (the EIP);<\/li>\n<li>a CNAME record (typically www) pointing from the host name to the A record,<\/li>\n<li>an optional IPv6 record corresponding to the A record.<\/li>\n<\/ul>\n<p>To run a mail server,\u00a0create a record of the type &#8220;MX \u2014 Mail exchange&#8221; and enter the host name of your mail server (on this or on another domain) with the default priority of 0 in the form:<\/p>\n<pre>0 smtp.somefancymailserver.tld.<\/pre>\n<p>However, you will also need a reverse DNS record, which only Amazon can set up for you. For more details, see this post:\u00a0<a href=\"https:\/\/www.cloudinsidr.com\/content\/set-mail-server-aws-ec2-using-open-source-software\/\" target=\"_blank\" rel=\"noopener noreferrer\">How to set up a mail server on AWS EC2 using open source software<\/a>.<\/p>\n<h3>Decide how to handle the IPv4 scarcity<\/h3>\n<p>Make sure that the IP address(es) in your A record\u00a0have been assigned to the host that is running\u00a0your web server. Users of AWS EC2 have to choose how to handle the IPv4 scarcity and the resulting AWS restrictions.<\/p>\n<p>There are several strategies to deal with IPv4 on AWS:<\/p>\n<ul>\n<li>use an EIP address (not an automatically assigned public address). The upside: ease of use as the address persists across reboots (there is no charge for the first EIP on each running instance). The downsides: high cost and an IPv4 limit per account.<\/li>\n<li>use ELB (Amazon&#8217;s Elastic Load Balancer) and you won&#8217;t need an EIP.<\/li>\n<li>use a dynamic DNS provider to update your DNS configuration each time the IP address changes. (You can set the TTL as low as 5 seconds, by the way.) The downside: DNS and browser caching will cause delays. This method is not recommended for production servers, especially facing the Internet.<\/li>\n<li>use a script to update Route 53 each time the IPv4 of an instance changes.\n<ul>\n<li>Create an instance role with permissions to update Route 53. This role can be limited to only one host name, but must be applied each time a new instance is launched.<\/li>\n<li>Save a script somewhere in <strong>\/home\/ec2-user<\/strong> with roughly <a href=\"https:\/\/gist.github.com\/TonyFNZ\/ba22dcb7d74260c88bbf1d17741c4c56\" target=\"_blank\" rel=\"noopener noreferrer\">this content<\/a>\u00a0and save it as\u00a0dnsupdate.sh<em class=\"s570a4-15 bDsWbe\">.<\/em><\/li>\n<li>Set your script up to run on every instance upon startup (crontab -e):\n<ul>\n<li><strong>@reboot \/home\/ec2-user\/dnsupdate.sh &gt;dnsupdate.log 2&gt;&amp;1<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>use IPv6 only (not a good idea when serving the public).<\/li>\n<li>put your instance behind a proxy such as HA proxy or NGINX and have it forward traffic to your instance&#8217;s private IP or internal DNS hostname (both of which won&#8217;t change on reboot).<\/li>\n<\/ul>\n<h3>Wait for changes to propagate<\/h3>\n<p>You may need to wait a few minutes for the changes to propagate (depending on the previously defined TTL). Tip: when you anticipate the need to make adjustments to your DNS configuration, you may want to reduce the TTL in advance.<\/p>\n<p>TIP:\u00a0Make sure that the ports that your service uses (typically 80 for http and 443 for https) are not being blocked by any firewalls or the AWS Security Group.<\/p>\n<h2>Step 5. Verify your DNS configuration (and modify settings if required)<\/h2>\n<p>Verify that the settings are correct by\u00a0using a diagnostic service such as <a href=\"http:\/\/intodns.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">intodns.com<\/a>. Enter your domain name and run the test.<\/p>\n<p>(Should you receive an error as a result\u00a0of a missing MX record, you can safely ignore it as it does not affect your ability to run a web server; it is only needed\u00a0if you also happen to\u00a0require\u00a0a mail exchanger such as Postfix.<\/p>\n<h2>Step 6. Configure your web server software for the IP address and the hostname<\/h2>\n<p>Make sure that your web server software knows that it should listen on the network interface that corresponds to the public IP address that will be receiving incoming traffic on open ports. Make sure that the web server feels responsible for serving documents for\u00a0its host name. Here is a post on <a href=\"https:\/\/cloudinsidr.com\/content\/lemp-how-to-set-up-nginx-with-mariadbmysql-and-php-7-x-on-centos-7-rhelfedora\/\" target=\"_blank\" rel=\"noopener noreferrer\">how to set up NGINX<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The most difficult thing about configuring the DNS settings for a\u00a0domain\u00a0is designing\u00a0a plan of action:\u00a0making up one&#8217;s\u00a0mind about what kind of services you envision and how you want to route the traffic.\u00a0Here&#8217;s a primer on how to configure DNS using Route 53 or any other service.<\/p>\n","protected":false},"author":101011,"featured_media":76,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[17,33],"tags":[58,60,248,249,108],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v14.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>A quick guide to a solid DNS configuration using AWS Route 53 (and how to configure DNS using any other DNS service) - CloudInsidr<\/title>\n<meta name=\"description\" content=\"This quick guide on how to configure DNS using Route 53 or any other service will get you started in no time. End the guesswork!\" \/>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.cloudinsidr.com\/content\/quick-and-dirty-dns-configuration-using-aws-route-53-or-any-other-service\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"A quick guide to a solid DNS configuration using AWS Route 53 (and how to configure DNS using any other DNS service) - CloudInsidr\" \/>\n<meta property=\"og:description\" content=\"This quick guide on how to configure DNS using Route 53 or any other service will get you started in no time. End the guesswork!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.cloudinsidr.com\/content\/quick-and-dirty-dns-configuration-using-aws-route-53-or-any-other-service\/\" \/>\n<meta property=\"og:site_name\" content=\"CloudInsidr\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-23T19:06:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-07-23T10:07:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2015\/11\/cloudinsidr_logo_900px-wide.png\" \/>\n\t<meta property=\"og:image:width\" content=\"900\" \/>\n\t<meta property=\"og:image:height\" content=\"326\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#website\",\"url\":\"https:\/\/www.cloudinsidr.com\/content\/\",\"name\":\"CloudInsidr\",\"description\":\"Cyber security, infotech\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.cloudinsidr.com\/content\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/quick-and-dirty-dns-configuration-using-aws-route-53-or-any-other-service\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.cloudinsidr.com\/content\/wp-content\/uploads\/2015\/11\/cloudinsidr_logo_900px-wide.png\",\"width\":900,\"height\":326,\"caption\":\"cloudinsidr.com logo (900px wide)\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/quick-and-dirty-dns-configuration-using-aws-route-53-or-any-other-service\/#webpage\",\"url\":\"https:\/\/www.cloudinsidr.com\/content\/quick-and-dirty-dns-configuration-using-aws-route-53-or-any-other-service\/\",\"name\":\"A quick guide to a solid DNS configuration using AWS Route 53 (and how to configure DNS using any other DNS service) - CloudInsidr\",\"isPartOf\":{\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/quick-and-dirty-dns-configuration-using-aws-route-53-or-any-other-service\/#primaryimage\"},\"datePublished\":\"2018-08-23T19:06:19+00:00\",\"dateModified\":\"2019-07-23T10:07:21+00:00\",\"author\":{\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#\/schema\/person\/21ce63bea726ea64da1beed97e63ba84\"},\"description\":\"This quick guide on how to configure DNS using Route 53 or any other service will get you started in no time. End the guesswork!\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.cloudinsidr.com\/content\/quick-and-dirty-dns-configuration-using-aws-route-53-or-any-other-service\/\"]}]},{\"@type\":[\"Person\"],\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#\/schema\/person\/21ce63bea726ea64da1beed97e63ba84\",\"name\":\"Anna E Kobylinska\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.cloudinsidr.com\/content\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7a3e9bd152f9d5cd41bf2b92df649857?s=96&d=mm&r=g\",\"caption\":\"Anna E Kobylinska\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/posts\/653"}],"collection":[{"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/users\/101011"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/comments?post=653"}],"version-history":[{"count":22,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/posts\/653\/revisions"}],"predecessor-version":[{"id":2596,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/posts\/653\/revisions\/2596"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/media\/76"}],"wp:attachment":[{"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/media?parent=653"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/categories?post=653"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloudinsidr.com\/content\/wp-json\/wp\/v2\/tags?post=653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}