Create 301 Redirection in Amazon Route 53 for Wildcard Subdomains

amazon s3amazon-route53domain-name-systemwildcard

My domain name hosted on Route 53 DNS.

Amazon has a guide to do 301 redirection for www. To naked domain by point www. version to a S3 static website with 301 setted up.

My question is, how can I have *.domain.com all have 301 redirec to naked domain name.

I guess either:

Some way to get all wildcard subdomains end up into one S3 bucket, how?

Or:

Use CloudFront on the www. version S3 site and put wildcard subdomains on the CloudFront, but how?

Or:

There's some hidden settings just lies on Router 53, then where?

Or: use EC2, better not suggest me this, too costing for this task.

Please advice.

Best Answer

There isn't a way to do this in Route53/CloudFront without getting a server involved. Like it or not, your best option is an EC2 t1.micro instance that handles these redirects.