When connecting a GoDaddy-registered domain to an AWS Elastic Load Balancer (ELB), you're dealing with two critical DNS record types:
- A Records - For root domain resolution (e.g., example.com)
- CNAME Records - For subdomain aliasing (e.g., www.example.com)
Here's the precise configuration for your scenario:
- Log in to your GoDaddy account and navigate to DNS Management
- Create a CNAME record for www:
Type: CNAME
Name: www
Value: your-elb-dns-name.us-east-1.elb.amazonaws.com
TTL: 1 Hour
- For the root domain (A record), use AWS-provided IP addresses:
Type: A
Name: @
Value: [ELB's IP addresses]
TTL: 1 Hour
Important Note: AWS ELBs don't have static IPs. Instead, use AWS's Route 53 alias records if possible, or consider these alternatives:
Option 1: Using Route 53 (Recommended)
# AWS CLI command to get ELB hosted zone ID
aws elbv2 describe-load-balancers --names your-elb-name --query 'LoadBalancers[0].CanonicalHostedZoneId'
Then create an alias record in Route 53 pointing to your ELB.
Option 2: Forwarding with URL Redirect
In GoDaddy's Domain Forwarding section:
Forward from: example.com
Forward to: http://www.example.com
Redirect type: 301 (Permanent)
Forward settings: Forward only
Use these commands to verify your setup:
# Check A record
dig example.com +short
# Check CNAME resolution
dig www.example.com +short
Remember DNS changes can take up to 48 hours to propagate globally.
When exposing your EC2 instance through a load balancer:
# Example security group rules for HTTPS
aws ec2 authorize-security-group-ingress \
--group-id your-sg-id \
--protocol tcp \
--port 443 \
--cidr 0.0.0.0/0
Always configure SSL certificates at the load balancer level for secure connections.
When connecting a GoDaddy domain to an AWS EC2 Load Balancer, you're dealing with three key elements:
- Your domain registrar (GoDaddy)
- AWS Elastic Load Balancer (ELB)
- DNS record types (A, CNAME, ALIAS)
Here's the proper way to set up your DNS records in GoDaddy:
1. Get Your ELB DNS Name
First, obtain the DNS name of your load balancer from the AWS EC2 console. It will look something like:
my-load-balancer-1234567890.us-west-2.elb.amazonaws.com
2. Configure CNAME for www Subdomain
In GoDaddy DNS management:
- Create a CNAME record for 'www'
- Point it to your ELB DNS name
Type: CNAME Name: www Value: my-load-balancer-1234567890.us-west-2.elb.amazonaws.com TTL: 1 Hour
3. Handle the Root Domain (Apex)
For the root domain (example.com), you have two options:
Option A: Using GoDaddy Forwarding
This is what you described in your question, but it's not the most reliable method:
- Set up domain forwarding from example.com to www.example.com
- Create an A record pointing to AWS's IP addresses (not recommended as ELB IPs can change)
Option B: Using ALIAS/ANAME Records (Recommended)
If your DNS provider supports it (GoDaddy does):
Type: ALIAS Name: @ Value: my-load-balancer-1234567890.us-west-2.elb.amazonaws.com TTL: 1 Hour
After making changes, verify with these commands:
dig example.com dig www.example.com
Or use online tools like digwebinterface.com or mxtoolbox.com
- SSL Certificate Problems: Ensure your ELB has a valid SSL certificate for both example.com and www.example.com
- Propagation Delays: DNS changes can take up to 48 hours to propagate globally
- ELB Health Checks: Confirm your EC2 instances pass health checks
For more reliability, consider transferring DNS to AWS Route 53:
# Example Terraform configuration for Route 53 resource "aws_route53_zone" "primary" { name = "example.com" } resource "aws_route53_record" "www" { zone_id = aws_route53_zone.primary.zone_id name = "www.example.com" type = "CNAME" ttl = "300" records = ["my-load-balancer-1234567890.us-west-2.elb.amazonaws.com"] } resource "aws_route53_record" "root" { zone_id = aws_route53_zone.primary.zone_id name = "example.com" type = "A" alias { name = "my-load-balancer-1234567890.us-west-2.elb.amazonaws.com" zone_id = "Z35SXDOTRQ7X7K" # ELB zone ID for us-west-2 evaluate_target_health = true } }