amazon-web-servicesamazon-s3terraformamazon-route53aws-cloudmap

Create AWS Cloud Map DNS alias for an S3 static website


Route 53 can route traffic to an S3 bucket with static web hosting, but you can't manually add records to a Route 53 namespace managed by Cloud Map.

So how should Cloud Map be configured to route traffic from mys3website.private-namespace to mybucket.s3-website-eu-west-1.amazonaws.com? And how can this be written in Terraform?


Solution

  • This can't be done because S3 relies on the HTTP Host header to determine the bucket name. So a DNS CNAME record won't help in renaming the bucket.