Simplifying DNSLearn how to quickly configure DNS and secure your domain with HTTPS with one command.
ByAnis Mer_

Simplifying DNS

Setting up DNS records, acquiring an HTTPS certificate, and verifying your domain can be time-consuming, especially when you're doing it manually or through a dashboard on platforms like Vercel, Netlify, DigitalOcean, or similar services.

If you're deploying a Next.js app on AWS or exploring Vercel alternatives, you’ll find DeployFast to be an efficient solution. With a single command, DeployFast automates DNS setup via Route53, configures an HTTPS certificate using AWS Certificate Manager, and verifies your domain—all critical steps for smooth cloud infrastructure automation.

Prerequisites

To get started, you need to fill out the credentials in your prod.tfvars file. Here's how it should look:

################################
## AWS IAM SPECIFIC VARIABLES ##
################################

# Access key ID for your AWS account
aws_access_key_id = "AKIAIOSFODNN7EXAMPLE"

# Secret access key for your AWS account
aws_secret_access_key = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"

# Domain name you have purchased
aws_hosted_zone_name = "example.com"

##############################################
## ROUTE53 (DNS RECORDS) SPECIFIC VARIABLES ##
##############################################

# Domain name you have purchased
domain_name = "yourdomain.com"

# CNAME records
cname_records = [
  { name = "email",
    value = "mailgun.org.",
    ttl = 300 },
  { name = "protonmail._domainkey",
    value = "protonmail.domainkey.fakehashvalue1.domains.proton.ch.",
    ttl = 300 },
  { name = "protonmail2._domainkey",
    value = "protonmail2.domainkey.fakehashvalue2.domains.proton.ch.",
    ttl = 300 },
  { name = "protonmail3._domainkey",
    value = "protonmail3.domainkey.fakehashvalue3.domains.proton.ch.",
    ttl = 300 }
]

# MX records
mx_records = [
  { name = "",
    value = "10 mail.protonmail",
    ttl = 300 },
  { name = "",
    value = "20 mailsec.protonmail",
    ttl = 300 },
  { name = "mail",
    value = "10 mxa.mailgun.org.",
    ttl = 300 },
  { name = "mail",
    value = "10 mxb.mailgun.org.",
    ttl = 300 }
]

# TXT records
txt_records = [
  { name = "",
    value = "protonmail-verification=fakeverificationtoken123",
    ttl = 300 },
  { name = "",
    value = "v=spf1 include:_spf.protonmail.ch ~all",
    ttl = 300 },
  { name = "_dmarc",
    value = "v=DMARC1; p=quarantine; rua=mailto:yourname@exampledomain.com; ruf=mailto:yourname@exampledomain.com; pct=100",
    ttl = 300 },
  { name = "_dmarc.mail",
    value = "v=DMARC1; p=none; rua=mailto:yourname@exampledomain.com; ruf=mailto:yourname@exampledomain.com; pct=100",
    ttl = 300 },
  { name = "k1._domainkey.mail",
    value = "fakekeyhashvalue1234567890abcdefghijklmnopqrstuvwx/FAKEKEYCONTENTS1234567890ABCDEFGHIJKLMNOPQRSTUVWX/FAKEKEYID",
    ttl = 300 },
  { name = "mail",
    value = "v=spf1 include:mailgun.org ~all",
    ttl = 300 }
]

Once you've entered all the necessary information, save the prod.tfvars file.

DNS Setup and HTTPS Certification Steps

  1. Run the command
    After setting up your credentials and records, run the following command in your terminal to trigger the configuration process:

    ./create_acm_route53.sh
    

    This command will do the heavy lifting: it will automatically set up your DNS records in Route53, request an SSL certificate from AWS Certificate Manager (ACM), and verify your domain for HTTPS.

  2. Copy your Nameservers
    Once the command has successfully executed, go to your AWS Route53 console and copy your NS (Nameservers).

  3. Login to Your Domain Registrar
    Use the nameservers from AWS Route53 and update them in your domain registrar (where you bought your domain). This step ensures that your domain points to the correct DNS settings.

  4. You're Done!
    That’s it! DeployFast has set up your DNS, requested and validated your HTTPS certificate, and verified your domain with just one command.

Why Use DeployFast for Next.js Deployment?

If you're deploying a Next.js app on AWS, DeployFast simplifies the DNS and SSL setup process. It's a fast alternative to other CI/CD tools like Vercel and provides granular control over infrastructure compared to platforms like Netlify. With support for AWS services like CodePipeline, S3 buckets, and EC2 instance types, DeployFast can scale with your cloud infrastructure, making it a reliable solution for indie makers and developers.

For more details, check out the DeployFast documentation or watch this video walkthrough.

Back