How do I redirect an apex domain to its subdomain or any other domain using S3 and Route 53?

3 minute read

I want to redirect internet traffic from my root (apex) domain (for instance, to its subdomain (for instance, using Amazon Simple Storage Service (Amazon S3). Or, I want to redirect internet traffic from my apex domain to another domain (for instance, using Amazon S3.



  • You have a hosted zone for your apex domain in Amazon Route 53.
  • You have permissions to create records in the hosted zone for the apex domain.
  • You have permissions to create S3 buckets.
  • An S3 bucket with the exact same name as your apex domain doesn't already exist.
    Note: Amazon S3 website endpoints don't support HTTPS. So, redirection works for HTTP requests only. To redirect both HTTP and HTTPS requests, use other methods, such as redirecting requests using an Application Load Balancer or using Amazon CloudFront.

Use the following procedure to redirect your domain using Amazon S3. For example, to redirect requests for the apex domain to its subdomain, use following steps:

  1. In the Amazon S3 console, create an S3 bucket with the exact name of your apex domain. For instance
    Note: S3 bucket names are globally unique. If the bucket name that you need is already in use, then you can't use Amazon S3 for redirection. In this case, consider other methods, such as configuring redirection using an Application Load Balancer or using Amazon CloudFront with an edge function.
  2. Select the bucket that you created, and then choose Properties.
  3. Under Static website hosting, choose Edit.
  4. Choose Redirect requests for an object.
  5. For Host name, enter the website that you want to redirect to. For instance,
  6. For Protocol, choose the protocol for the redirected requests (none, HTTP, or HTTPS).
    Note: If you don't specify a protocol, then the default option is none.
  7. Choose Save changes.
  8. In the Route 53 console, select the hosted zone for your apex domain. For instance,
  9. Create an A-Alias record for the apex domain in the selected hosted zone with the following values:
    Record name: Leave this field blank.
    Record Type: Choose A – IPv4 address.
    Route traffic to: Choose Alias to S3 website endpoint.
    Region: Choose the Region where your S3 bucket is located.
    Enter S3 Endpoint: From the dropdown list, choose the S3 bucket that you created. For instance Make sure that the S3 bucket name exactly matches the name of the hosted zone for your apex domain.
    Routing policy: Choose Simple.
    Evaluate Health Target: Choose No, and then choose Create Records.

To validate the redirection, open your apex domain in a browser. Or, use the following curl command to check the HTTP status code for the response and the value of the Location header in the response. A successful redirection returns the HTTP 301 Moved Permanently status code and the Location header value has a URL for the domain that you're redirecting to.

curl -i -s | grep -E "HTTP|Location"
      HTTP/1.1 301 Moved Permanently

Related information

How can I redirect one domain to another in Route 53?

Redirect requests for your bucket's website endpoint to another bucket or domain

AWS OFFICIALUpdated 2 years ago