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., twtechapp |
✅
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 (yes specifies TTL) |
✅
Yes (TTL auto-managed or configurable) |
|
Chainable? |
✅
Yes (can point to another CNAME) |
❌
No (must point to a single AWS resource or record) |
Sample Scenarios
- CNAME
Record Example:
# textName: web.twtechapp.comType: CNAMEValue: springapp.twtech.com- Use case: Forwarding subdomains to a 3rd-party provider.
Alias
Record Example:
# text Name: twteceh.comType: 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
Step-1:
- Go to Route 53 and Select the hosted zone to create A record: 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:
- twtech verifies that the rocord created with the CNAME is working on: Firefox
- Accessing A record on the browser is sometime not compactible: it does work with my: google chrome in my environment.
- 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
- Step-3:
- twtech Creates 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
- twtech uses the A 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
- 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
- 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 does not access the A records.
- Not all browsers are compactible.
- The browser that is compactible for my environment may not be compactible for some other persons.
- This application is already deployed in us-east-2.
No comments:
Post a Comment