Route 53 & Custom Domain for Spring Boot Applications
Learn how to configure Amazon Route 53 with custom domains for Spring Boot applications. This guide covers DNS fundamentals, hosted zones, domain registration, ALB integration, CloudFront, SSL certificates, routing policies, health checks, and production best practices.
Introduction
Every enterprise application needs an easy-to-remember domain name.
Instead of users accessing applications using an IP address like:
http://54.201.45.210:8080
we use a domain such as:
https://codewithvenu.com
or
https://api.codewithvenu.com
Amazon Route 53 is AWS's highly available Domain Name System (DNS) service that maps domain names to AWS resources such as:
- Application Load Balancer
- CloudFront
- EC2
- S3 Static Websites
- API Gateway
- Global Accelerator
In this article, we will learn how to configure Route 53 for Spring Boot applications using custom domains and HTTPS.
Learning Objectives
After completing this article, you will understand:
- What is DNS?
- What is Route 53?
- Hosted Zones
- Domain Registration
- DNS Records
- Alias Records
- Route 53 Routing Policies
- Route 53 Health Checks
- ACM SSL Certificates
- Custom Domain for Spring Boot
- CloudFront Integration
- Production Best Practices
What is DNS?
DNS stands for Domain Name System.
DNS converts a human-readable domain into an IP address.
Example:
codewithvenu.com
↓
54.210.15.110
Without DNS, users would need to remember IP addresses instead of domain names.
Why Route 53?
Benefits include:
- Highly available
- Global DNS service
- Fast DNS resolution
- Integrated with AWS services
- Health checks
- Routing policies
- Supports custom domains
- Automatic failover
High-Level Architecture
flowchart LR
User
Route53
ALB
SpringBoot
Aurora
User --> Route53
Route53 --> ALB
ALB --> SpringBoot
SpringBoot --> Aurora
Enterprise Architecture
flowchart TD
Users
Route53
CloudFront
AWSWAF
ALB
SpringBoot
Aurora
Users --> Route53
Route53 --> CloudFront
CloudFront --> AWSWAF
AWSWAF --> ALB
ALB --> SpringBoot
SpringBoot --> Aurora
Real-Time Example
Customer opens
https://codewithvenu.com
Route 53 resolves
↓
CloudFront
↓
Application Load Balancer
↓
Spring Boot
↓
Amazon Aurora
Domain Name Components
Example:
blog.codewithvenu.com
| Component | Meaning |
|---|---|
| blog | Subdomain |
| codewithvenu | Domain |
| com | Top Level Domain (TLD) |
Route 53 Components
| Component | Purpose |
|---|---|
| Hosted Zone | DNS Configuration |
| Record Set | Maps domain to resource |
| Alias Record | AWS resource mapping |
| Health Check | Endpoint monitoring |
| Routing Policy | Traffic distribution |
Public Hosted Zone
Used for internet-facing applications.
Example:
codewithvenu.com
Accessible from anywhere.
Private Hosted Zone
Accessible only inside a VPC.
Useful for:
- Internal APIs
- Databases
- Microservices
Example:
internal.company.local
Register Domain
AWS Console
↓
Route 53
↓
Registered Domains
↓
Register Domain
Example:
codewithvenu.com
If you already own a domain from another registrar (Cloudflare, GoDaddy, Namecheap, etc.), you can use Route 53 by updating the domain's name servers.
Create Hosted Zone
AWS Console
↓
Hosted Zones
↓
Create Hosted Zone
Type:
Public Hosted Zone
DNS Records
Common DNS records:
| Record | Purpose |
|---|---|
| A | IPv4 Address |
| AAAA | IPv6 Address |
| CNAME | Alias to another hostname |
| MX | |
| TXT | Verification |
| NS | Name Servers |
| Alias | AWS Resources |
A Record
Example
api.codewithvenu.com
↓
54.210.10.50
CNAME Record
Example
www.codewithvenu.com
↓
codewithvenu.com
Alias Record
AWS recommends Alias records for:
- CloudFront
- ALB
- S3
- API Gateway
Unlike CNAME, Alias records work at the zone apex (for example, codewithvenu.com).
Route 53 Request Flow
flowchart LR
Browser
Route53
CloudFront
ALB
SpringBoot
Browser --> Route53
Route53 --> CloudFront
CloudFront --> ALB
ALB --> SpringBoot
Spring Boot Architecture
flowchart TD
Users
Route53
ALB
SpringBootAZ1
SpringBootAZ2
Aurora
Users --> Route53
Route53 --> ALB
ALB --> SpringBootAZ1
ALB --> SpringBootAZ2
SpringBootAZ1 --> Aurora
SpringBootAZ2 --> Aurora
Configure Application Load Balancer
Deploy Spring Boot
↓
Create Target Group
↓
Create ALB
↓
Register EC2 instances
↓
Verify:
http://alb-123456.us-east-1.elb.amazonaws.com
Map Domain to ALB
Create Alias Record
Example
api.codewithvenu.com
↓
Application Load Balancer
Now users can access:
https://api.codewithvenu.com
CloudFront Integration
For static websites:
flowchart LR
Users
Route53
CloudFront
S3
Users --> Route53
Route53 --> CloudFront
CloudFront --> S3
SSL Certificates
Always use HTTPS.
AWS provides certificates through:
Amazon Certificate Manager (ACM)
Benefits:
- Free SSL
- Automatic renewal
- AWS integration
HTTPS Flow
flowchart LR
Browser
HTTPS
CloudFront
ALB
SpringBoot
Browser --> HTTPS
HTTPS --> CloudFront
CloudFront --> ALB
ALB --> SpringBoot
Route 53 Routing Policies
Supported routing policies:
- Simple
- Weighted
- Latency
- Geolocation
- Geoproximity
- Failover
- Multivalue Answer
Simple Routing
One resource
↓
One destination
Best for:
Small applications.
Weighted Routing
Example
Version A
80%
Version B
20%
Useful for:
- Canary deployments
- A/B testing
Latency Routing
Users automatically connect to the AWS Region with the lowest latency.
Example:
US users
↓
us-east-1
Europe users
↓
eu-west-1
Geolocation Routing
Route traffic based on country.
Example:
India
↓
Mumbai Region
USA
↓
Virginia Region
Failover Routing
Primary application fails.
↓
Automatically route traffic to backup region.
Supports Disaster Recovery.
Health Checks
Route 53 continuously monitors your application.
Example endpoint:
https://api.codewithvenu.com/actuator/health
Healthy response:
{
"status":"UP"
}
If unhealthy:
Traffic automatically switches to a healthy endpoint.
Route 53 Health Check Flow
flowchart LR
Route53
HealthCheck
SpringBoot
Healthy
Route53 --> HealthCheck
HealthCheck --> SpringBoot
SpringBoot --> Healthy
Multi-Region Architecture
flowchart TD
Users
Route53
USEast
EUWest
Users --> Route53
Route53 --> USEast
Route53 --> EUWest
Spring Boot Deployment Flow
flowchart LR
Developer
GitHub
CI_CD
EC2
ALB
Route53
Developer --> GitHub
GitHub --> CI_CD
CI_CD --> EC2
EC2 --> ALB
ALB --> Route53
Common Issues
Domain Not Resolving
Check:
- Name Servers
- Hosted Zone
- DNS Propagation
SSL Certificate Error
Verify:
- ACM Certificate
- Domain Validation
- Listener Configuration
502 Bad Gateway
Check:
- Spring Boot running
- Target Group health
- Security Groups
- ALB listener
DNS Propagation Delay
DNS updates may take several minutes (or longer depending on TTL and resolver caching) to propagate globally.
Best Practices
- Use HTTPS everywhere
- Use ACM certificates
- Use Alias records for AWS resources
- Enable Route 53 health checks
- Use CloudFront for static content
- Keep Route 53 TTL reasonable
- Enable multi-region failover for critical applications
- Use subdomains for APIs
- Monitor DNS health
- Protect applications with AWS WAF
Developer Checklist
Before production deployment:
- Domain registered
- Hosted Zone created
- ALB configured
- Alias record created
- ACM certificate issued
- HTTPS listener configured
- Spring Boot health endpoint enabled
- Route 53 health check configured
- CloudFront configured (if applicable)
- DNS verified
Interview Questions
What is Amazon Route 53?
Amazon Route 53 is AWS's managed DNS service used to route user requests to AWS resources.
What is a Hosted Zone?
A Hosted Zone contains DNS records for a domain.
What is an Alias Record?
An Alias record maps a domain directly to AWS resources such as ALBs, CloudFront distributions, or S3 buckets.
Difference between CNAME and Alias?
A CNAME points to another hostname and cannot be used at the zone apex. An Alias record is AWS-specific, can point to AWS resources, and can be used for the root domain.
Why use ACM with Route 53?
ACM provides free SSL/TLS certificates that integrate seamlessly with AWS services such as CloudFront and Application Load Balancers.
Which routing policy is best for disaster recovery?
Failover Routing with health checks.
Summary
In this article, we learned how to configure Amazon Route 53 with Spring Boot applications.
We covered:
- DNS fundamentals
- Hosted Zones
- Domain registration
- DNS records
- Alias records
- Application Load Balancer integration
- CloudFront integration
- ACM SSL certificates
- Routing policies
- Health checks
- Multi-region architecture
- Production best practices
Amazon Route 53 plays a critical role in building secure, highly available, and scalable Spring Boot applications. Combined with CloudFront, ACM, ALB, and Auto Scaling, it provides a robust networking foundation for enterprise-grade deployments.
Comments
Share a question, correction, or practical insight about this article.
Checking login status...
Loading approved comments...