Amazon S3: Static Web Sites: Custom Domain or Subdomain

前端 未结 6 600
北海茫月
北海茫月 2020-12-02 04:56

Amazon.com just announced that one can host static web sites in a S3 bucket. I went to their setup page at http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?W

相关标签:
6条回答
  • 2020-12-02 05:35

    It turns out that to make it work, you cannot just map any arbitrary subdomain to any arbitrary bucket. The fully qualified subdomain name must be the same as the S3 bucket name.

    1. Suppose the name of your site is static.mydomain.com. Then you need to create a S3 bucket with that same name, named static.mydomain.com.
    2. Once you configure that bucket as a S3 static web site, it will have a URL assigned to it that looks something like http://static.mydomain.com.s3-website-us-east-1.amazonaws.com.
    3. Go to your domain host and map your subdomain to the URL from step 2. In enom.com, that meant mapping the host "static" to the address "static.mydomain.com.s3-website-us-east-1.amazonaws.com" as a CNAME record.

    Thanks to Uriah and David for suggestions. I eventually got my answer at an Amazon AWS forum.

    0 讨论(0)
  • 2020-12-02 05:35

    Make sure that you follow the S3 DNS bucket naming conventions when creating your bucket.

    Then:

    1. Enable S3 Website support for the bucket using the AWS Management Console at Properties --> Website

    2. Make sure the files in the bucket have public read permissions

    3. Try the website using the endpoint listed in the Management Console

    4. Setup your CNAME using the listed endpoint (e.g. www.example.com CNAME www.example.com.s3-website-us-east-1.amazonaws.com)

    0 讨论(0)
  • 2020-12-02 05:45

    How about using a DNS service, like the Route 53 that Amazon provides. Set it up with a CNAME from your sub domain to the public bucket URL. Of course, if your domain company provide CNAME configuration, that could work directly.

    0 讨论(0)
  • 2020-12-02 05:45

    Update 2019 : AWS custom subdomain hosting in S3

    As of today following steps worked for me to have a working subdomain for AWS S3 hosted static website:

    1. Create a bucket with subdomain name. In this example www.subtest.mysite.com

    Note: Make sure on 'Permission' tab of bucket: -Block public access (bucket settings) -Access Control List & -Bucket policy are appropriately set to make sure bucket is public. ( Assuming you already did this for your root domain bucket, those settings can be mirrored on this subdomain bucket)

    1. Upload the index.html file in the bucket

    1. Create a CNAME record with your domain provider
    0 讨论(0)
  • 2020-12-02 05:48

    This is called Virtual Hosting of Buckets: http://docs.amazonwebservices.com/AmazonS3/latest/dev/VirtualHosting.html

    0 讨论(0)
  • 2020-12-02 05:59
    1. Create a hosted zone say mydomain.com. You can use a web based UI DNS30.
    2. Now create a CNAME entry for this hosted zone.
    3. Add a resource record with following detail Name as "mydomain.com" Type as "CNAME" Value as "mydomain.com.s3.amazonaws.com" TTl as "on your required configuration"

    Hope this will also work for static.mydomain.com

    Regards-

    Udit

    0 讨论(0)
提交回复
热议问题