AWS Route53 + S3 static website gives an error: alias target name does not lie within the target zone

Viewed 948

I have registered a domain using Route53 and created a S3 bucket for my website. Assume the following:

  • Route53 hosted zone is: domain.com
  • S3 bucket name is: staging.domain.com

Using the Route53 console I then attempted to create new record to point to my S3 bucket with the following settings:

  • Record name: staging.domain.com
  • Value/Route traffic to: Alias to S3 website endpoint
  • Region: (from drop-down) Africa(Cape Town)[af-south-1]
  • Choose S3 bucket: (from drop-down) s3-website.af-south-1.amazonaws.com (staging.domain.com)
  • Record type: A

After clicking on create records I am greeted with the following error:

**Error occurred
Bad request.**
(InvalidChangeBatch 400: Tried to create an alias that targets s3-website.af-south-1.amazonaws.com., type A in zone Z11KHD8FBVPUYU, but the alias target name does not lie within the target zone)

In my mind the alias target is supposed to be staging.domain.com.s3-website.af-south-1.amazonaws.com not s3-website.af-south-1.amazonaws.com

For completeness sake I have 2 other A records listed on this domain:

  • dev.domain.com -> Pointing to an EC2 instance (working)
  • test.domain.com -> Pointing to a CloudFront distribution (working)

Any idea why this is happening or how it can be corrected?

1 Answers

I think drop down you are getting is correct.

See this screenshot : First Second

New Console UI has different feature. First you have to select as region then bucket selection.

Check if you are following same seeting then you should not get error. Also one more check whether S3 bucket is enable for website hosting or not.

Related