In today’s interconnected digital landscape, businesses often need to redirect traffic from their primary domain to external URLs hosted outside their cloud infrastructure. Whether it’s for rebranding, marketing campaigns, mergers, or compliance, redirecting a top-level domain (TLD) is a common yet critical task.
In this article, we’ll explore real-world use cases for domain redirection and walk you through a step-by-step guide to achieve this using AWS services like Route 53, S3, ACM, and CloudFront.
*Scenarios Requiring Domain Redirection *
Here are some common situations where mapping a TLD to an external URL is necessary:
-
Rebranding or Domain Consolidation
- Example: A company rebrands from example.com to tester.com/agents/ and wants legacy traffic to seamlessly redirect to the new site.
-
Marketing Campaigns
- Example: A short-term campaign uses a memorable domain (e.g., promo.example.com) to redirect users to a third-party landing page (e.g., tester.com/summer-sale).
-
Mergers and Acquisitions
- Example: After acquiring a company, redirect its domain (e.g., acquired-company.com) to a section of the parent company’s site (e.g., tester.com/partners).
-
Compliance or Legal Requirements
- Example: Redirecting users from a non-compliant legacy domain to an updated, compliant URL hosted externally.
If any of these scenarios sound familiar, this walkthrough is for you!
Solution Overview: AWS Architecture for Domain Redirection
For the use case example.com → www.tester.com/agents/dns, the following AWS services are leveraged:
- AWS Route 53: Managed DNS routing for the TLD.
- Amazon S3: Hosts a simple redirect rule.
- AWS Certificate Manager (ACM): Provides SSL/TLS certificates for secure redirection.
- Amazon CloudFront: Ensures HTTPS support and improves performance.
Step-by-Step Walkthrough
Here’s how to redirect example.com and www.example.com to www.tester.com/agents/dns/ using AWS services:
Step 1: Create S3 Buckets for Redirection
-
Create the root domain bucket:
- Go to AWS S3 Console → Create bucket.
- Bucket name:
example.com
(must match your domain). - Region: Choose a region (e.g., US East (N. Virginia)).
- Uncheck Block all public access
- Click Create bucket.
-
Configure static website hosting for the root domain bucket:
- Open the bucket → Properties tab → Static website hosting.
- Select Redirect all requests to another host name.
- Target domain:
www.tester.com/agents/dns/
. - Protocol:
https
(if the target supports HTTPS).
Step 2: Request an SSL Certificate (AWS Certificate Manager)
-
Request a certificate:
- Go to AWS Certificate Manager (ACM) → Request a certificate.
-
Domain names:
-
example.com
-
*.example.com
(covers subdomains like www).
-
- Validation method: DNS validation.
- Click Request.
-
Validate the certificate:
- ACM will ask you to add CNAME records to your Route 53 hosted zone.
- Click Create records in Route 53
- Wait for validation (status changes to Issued).
Step 3: Create CloudFront Distributions
-
Create a CloudFront distribution for the root domain:
- Go to CloudFront Console → Create Distribution.
- Origin Domain: Select the S3 bucket example.com (use the S3 website endpoint URL).
- Origin Path: Leave blank.
- Viewer Protocol Policy: Redirect HTTP to HTTPS.
-
Alternate Domain Names (CNAMEs):
example.com
and www.example.com. - SSL Certificate: Select the ACM certificate you created.
- Default Root Object: Leave blank.
- Click Create Distribution.
Step 4: Update Route 53 DNS Records
-
Point the root domain to CloudFront:
- Go to Route 53 Console → Hosted Zones → example.com.
- Edit the A record for the root domain:
- Record name: Leave blank.
- Alias: Yes.
- Route traffic to: Alias to CloudFront distribution → Select the root domain CloudFront distribution.
- Save.
-
Point the www subdomain to CloudFront:
- Create/edit the A record for
www
:-
Record name:
www
. - Alias: Yes.
- Route traffic to: Alias to CloudFront distribution → Select the root domain CloudFront distribution.
-
Record name:
- Save.
- Create/edit the A record for
Step 5: Test the Redirection
- Wait for DNS propagation (up to 48 hours, but usually faster).
- Test using:
-
Browser: Visit
https://example.com
→ Should redirect tohttps://www.tester.com/agents/dns/
.
-
Browser: Visit
Troubleshooting Tips
-
SSL/TLS Errors:
- Ensure the ACM certificate is created in us-east-1 (required for CloudFront).
- Verify the certificate is attached to the CloudFront distribution.
-
Infinite Redirect Loops:
- Ensure S3 bucket redirects point directly to the external URL (not to another S3 bucket).
-
DNS Issues:
- Use
dig example.com
to confirm DNS resolution.
- Use
Conclusion
Redirecting a top-level domain hosted on AWS to an external URL is a powerful strategy for maintaining brand continuity, complying with legal requirements, or executing marketing campaigns. By leveraging AWS services like Route 53, S3, ACM, and CloudFront, you can achieve seamless, secure, and cost-effective redirection without infrastructure overhead.
Call to Action
Have you implemented domain redirection on AWS? Share your experience in the comments below! If you have questions, feel free to ask—we’re here to help.
Tags: #AWS #DomainManagement #Route53 #CloudComputing #WebHosting #HTTPS #DevOps
Top comments (0)