Deep-dive on the Next Gen Platform. Join the Webinar!

Skip Navigation
Show nav
Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Visit the Heroku Blog

    Find news and updates from Heroku in the blog.

    Visit Blog
  • Log inorSign up
Hide categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Working with Node.js
      • Troubleshooting Node.js Apps
      • Node.js Behavior in Heroku
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • PHP Behavior in Heroku
      • Working with PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Working with AI
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Heroku Architecture
  • Networking & DNS
  • Configuring Amazon Route 53 DNS for Your Heroku App

Configuring Amazon Route 53 DNS for Your Heroku App

English — 日本語に切り替える

Last updated April 24, 2024

Table of Contents

  • Prerequisites
  • Overview
  • Hosted Zone
  • CNAME Records
  • Naked/Root Domain
  • Activate Route 53

The Domain Name System (DNS) is the internet’s routing layer responsible for mapping human-readable domain names (for example, www.heroku.com) into machine-addressable IP addresses (for example, 198.51.100.1).

Amazon AWS’s DNS service is called Route 53 and is a highly available and scalable service. For users with existing AWS infrastructure components, it can be convenient to use Route 53 as your DNS provider.

This guide walks through the steps of setting up your Heroku app’s DNS configuration on Route 53.

Prerequisites

Before configuring your app’s DNS make sure you’ve used the Heroku CLI to attach your domain name to the application. This is necessary, including the third-party DNS changes, to properly route traffic for specific domains to the right application on Heroku.

If you haven’t done so yet, attach the correct domains to your app:

$ heroku domains:add example.com
$ heroku domains:add www.example.com

Be sure to specify all domains your application serves, including subdomains.

Overview

As with any DNS provider, configuring your Heroku app’s DNS involves the following steps:

  1. Create a CNAME record to map from www.example.com to your DNS target for your own Custom Domain.
  2. Establish a redirect from the root domain example.com to www.example.com to avoid the risks associated with root domains and A-records.
  3. Set Route 53 servers as the nameservers for your domain.

Route 53 uses different terms than standard industry parlance so this guide has non-trivial variance from other guides.

Hosted Zone

A hosted zone is Route 53’s term for the collection of DNS records that make up a single domain’s configuration. You must create a hosted zone for each domain you wish to configure on Route 53.

Sign in to the AWS management console and select the Route 53 service. Click the Create hosted zone button and type the domain name you’re configuring.

Use the root domain name for the hosted zone (for example, example.com).

CNAME Records

New records, such as the www CNAME record, are added in Route 53 as a Record.

To create a Record:

  1. Select the newly created hosted zone for your domain and click the Create record button.
  2. The Create record window opens. In the Record name field, type the name www (such as www.example.com). In the Record type field, select the CNAME type. In the Value field, type the custom domain’s DNS Target in the Value field.

Create a Record

$ heroku domains
=== sushi Heroku Domain

sushi-1234567890ab.herokuapp.com

=== sushi Custom Domains

 Domain Name      DNS Record Type DNS Target                              SNI Endpoint
 ──────────────── ─────────────── ─────────────────────────────────────── ─────────────
 www.example.com  CNAME           example-target-12345zyxwv.herokudns.com example-12345

Click the Create records button at the bottom of the form to save the www CNAME record mapping.

Naked/Root Domain

S3 doesn’t allow you to configure an SSL certificate, so you can’t easily use Route 53 to redirect your root domain in HTTPS. If you must this, consider using a DNS provider that offers CNAME/ALIAS records root domains. For more information, see the Custom domains Dev Center article, or this blog post, which shows how to set up an SSL naked domain redirect.

Route 53 supports Alias records, which use Amazon S3 static websites to dynamically resolve naked domains to their www counterparts using a 301 redirect. For example, example.com to www.example.com.

In order for the following bucket to appear when creating an Alias record in Route 53, you must name the bucket the exact same as the hosted zone. For example, if the hosted zone is example.com then the bucket is named example.com.

To create an Alias record:

  1. Go to your AWS management console, then open your S3 management console.
  2. Select the newly created bucket, but don’t open it. Click the Properties tab and open the “Static Website Hosting” section.
  3. Click Redirect all requests to another host name and you see that www.example.com is pre-filled. If it isn’t, type www.example.com.
  4. Save the redirect settings, then open your Route 53 hosted zone for example.com.
  5. Create a record set. Leave the name blank. Select A type. Set alias to Yes and select example.com from the S3 Website Endpoints section of the Alias Target dropdown.
  6. Create the record set.

Your domain example.com now redirects to www.example.com in a scalable way. Using Route 53 and Amazon S3 you’ve set up a naked domain which, resolves to your Heroku app.

Activate Route 53

At this point, you’ve established the correct DNS configuration but no requests are using it. In order for Route 53 DNS to become active for your application you must tell your domain registrar (GoDaddy, DNSimple, NameCheap, 1&1, and so on) to use your hosted zone’s Route 53 nameservers.

Go back to the Hosted Zones list and select your new hosted zone. There’s a pre-populated Delegation Set section in the sidebar. These are the nameservers you must provide your domain registrar for Route 53 to resolve your app domain.

Refer to your registrar’s instructions for updating the nameservers.

Supply this Delegation Set to your registrar to activate Route 53 for your application. It can take up to 48 hours for nameservers to become fully active.

Keep reading

  • Networking & DNS

Feedback

Log in to submit feedback.

WebSockets on Heroku Custom Domain Names for Apps

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure
  • .NET

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices