Monday, June 9, 2025

CNAME vs Alias & Domain Apex

 

In Amazon Route 53, both CNAME and Alias records are used to map one domain name to another, but they behave differently and are used in different scenarios.

 CNAME vs Alias – Key Differences

Feature

CNAME Record

Alias Record (Route 53-specific)

Purpose

Maps one domain name to another

Maps a domain to AWS resources (like ELB, S3, CloudFront)

Standard DNS

Yes – part of standard DNS specification

No – Route 53–specific feature

Zone Apex Allowed?

Not allowed at root (e.g., example.com)

Allowed at root domain

Supported by Route 53?

Yes

Yes

DNS Query Charges

Yes

No (free for AWS targets)

Target Types

Any domain name

AWS resources (ELB, S3 website, CloudFront, etc.), records

TTL Support

Yes (you specify TTL)

Yes (TTL auto-managed or configurable)

Chainable?

Yes (can point to another CNAME)

No (must point to a single AWS resource or record)

 Example Scenarios

 CNAME Record Example:

# text
Name:    web.twtechapp.com
Type:    CNAME
Value:   springapp.twtech.com

·        Use case: Forwarding subdomains to a 3rd-party provider.

 Alias Record Example:

#  text 
Name:    twteceh.com
Type:    A (Alias)
Alias Target:  d123.cloudfront.net (CloudFront distribution)

·        Use case: Pointing a root domain to a CloudFront distribution, which is not possible with a CNAME.

twtech Key Takeaways

·        Use CNAME when pointing subdomains to other domains, non-AWS resources, or where standard DNS behavior is required.

·        Use Alias when pointing to AWS resources, especially at the root domain (zone apex).

Project: Hands-on

How twtech create A records with:  CNAME and Alias

Select the hosted zone to create the record to and double click:  twtech.click

Create the record of type CNAME: myspringapp.twtech.click

Assign a name: myspringapp.twtech.click


Select record type: CNAME


The value must be a domain name(twtech is using DSN): twtech-Route53-ALB-14518xxx.us-east-2.elb.amazonaws.com


The idea is, instead of twtech accessing the application via the DNS, it will access it via the record name instead:

Myspringapp.twtech.net ----------- > twtech-Route53-ALB-145xxx.us-east-2.elb.amazonaws.com

 Create the record with CNAME:


How twtech verifies that the rocord created with the CNAME is working on: Firefox



Again, accessing the record on the browser in sometime selective (not compactible): it does work with my:  google chrome

 

Instead of creating and directing the record to DNS, twtech may also use an Alias:

Select the hosted zone to be used and double click: twtechnet.uk


Crate a record: myalias.twtechnet.uk

Assign a name: myalias.twtechnet.uk

Enable Alias and select from the list of Aliases: Alias to Application and Classic Load Balancer.

Select the region for the application: us-east-2 (Ohio)

Select the application Load balancer: dualstack.twtech-Route53-ALB-145183xxxx.us-east-2.elb.amazonaws.com

Enable evaluation of target heath with: Yes

Create the record with Alias: myalias.twtechnet.uk


How twtech use the record with Alias to access the application: myalias.twtechnet.uk

From firefox, the application is: reachable


However, it is not accessible from my : google chrome browser


NB:

The Alias record is free to Query: twtech is not charged

How twtech creates a record and uses the domain apex to direct traffic to the application.

Select the Hosted zone and click open: twtech.click

Create  record:

No Record name

Record type: A-Routes traffic to an IPv4 address and some AWS resources

Value : DNS (of ALB)

Enable Alias and select: Alias to Application and Classic Load Balancer


How twtech verifies that the alias created from domain apex is access on the browser: twtech.click

NB:

Remember to always try another browser if one is not acces the records.

Not all browsers are compactible.

The browser that is compactible for me may not be compactible for some other persons.

In few cases, the records may also be accessed from all browsers


No comments:

Post a Comment

Kubernetes Clusters | Upstream Vs Downstream.

  The terms "upstream" and "downstream" in the context of Kubernetes clusters often refer to the direction of code fl...