6 ms·
Amazon S3 has similar problems. To host static website you need use your domain name as the S3 bucket name. Amazon does not verify ownership of your domain, and
by mixedbit 10y ago
Amazon S3 has similar problems. To host static website you need use your domain name as the S3 bucket name. Amazon does not verify ownership of your domain, and bucket names use global namespace.
Someone can easily block you from using S3 static website hosting by adding a bucket with your domain name before you do. Also if you delete a bucket and do not change your DNS, someone can recreate the bucket and will be serving files from your domain.
- athrun 10y agoAs a best practice, use a 'normal' name for your S3 bucket and then put Cloudfront in front of your S3 website. This way you are not limited by bucket names and you also avoid any SSL validation errors. Note: you can set Cloudfront's TTL to 0 if you don't need any caching.
- mortar 10y agoThis is certainly good practice as long as anyone contemplating this considers the cost implications versus serving from S3 directly.
- athrun 10y agoGood point. It's actually generally cheaper to serve content through Cloudfront instead of S3 directly as bandwidth is less expensive with Cloudfront. However you are going to pay for Cloudfront requests in addition to S3's. In the vast majority of cases, it's insignificant compared to the savings you can achieve on the bandwidth side. (And at a certain level you can ask AWS to waive CF request fees entirely).
- nulagrithom 10y agoEDIT: Just tested it and looks like I'm wrong. Proxying with CloudFlare doesn't help either... Looks like I may have done this with CloudFront instead? That's not correct. The S3 bucket name is always prefixed. The format is: bucketname.region.amazonaws.com. https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosti... To clarify, you're going to have to add a DNS record either way. Doesn't matter what you call your bucket. And no, you don't need to put CloudFlare in front of it for this.
- mixedbit 10y agoYou can't point DNS to any bucket, the bucket name must match the domain name.
- nulagrithom 10y agoOh wow you're right! Just tested it.