I know this is too late for the original question but there may be more people with the same issues (me last week).
I was having the same issue while trying to create a route in route53 with CloudFormation. I was trying to redirect my domain www.example.com
to example-bucket.s3-website-eu-west-1.amazonaws.com
.
It turns out you cannot redirect to an arbitrary bucket. The bucket name must be the same as the domain you're trying to alias. So if you want to redirect www.example.com
, your bucket name must be www.example.com
and the URL must be www.example.com.s3-website-eu-west-1.amazonaws.com
.
Moreover cloudformation has a weird syntax. Cloudformation doesn't need the name of the bucket (it already knows it). It only needs the endpoint.
So instead of using something like
"AliasTarget": {
"DNSName" : "example-bucket.s3-website-eu-west-1.amazonaws.com",
"HostedZoneId" : "<zoneID>"
},
you need
"AliasTarget": {
"DNSName" : "s3-website-eu-west-1.amazonaws.com",
"HostedZoneId" : "<zoneID>"
},
And route53 where to redirect because the name of the route must be the same as the name of the bucket.
Related question https://stackoverflow.com/a/5048129/54256