aws - browse to website - 404 not found - no such bucket - amazon-web-services

I have created a record set for my webiste volcalc.io and www.volcalc.io which is stored in an s3 bucket.
When I try to browse to the website I see this error:
404 Not Found
Code: NoSuchBucket
Message: The specified bucket does not exist
BucketName: volcalc.io
RequestId: xxx
HostId: xxx
The bucket name is www.volcalc.io, not volcalc.io
How do I change it to make it look for bucket named www.volcalc.io?

See Setting Up a Static Website Using a Custom Domain.
To allow requests for both example.com and www.example.com, you need to create two buckets even though you will host content in only one of them. You will need to configure the other bucket to redirect requests to the bucket that hosts the content.

Related

CloudFront: The specified bucket does not exist

I have a static website hosted on S3 which works fine when accessed through my bucket's endpoint. However, when I create a CloudFront distribution and try access it through using the CloudFront domain I keep getting the error below.
d1xu3mknlk0sbd.cloudfront.net
Code: NoSuchBucket
Message: The specified bucket does not exist
BucketName: d1xu3mknlk0sbd.cloudfront.net
RequestId: 656B653A2ED5B2B1
HostId: 9etNAX1XEJmbVKUAMylBDz3xEky+7RhAnr9b8HhpkIb9+pkMnn920v/MSAUjr78oyONEUdlba50=
I have set up my CloudFront origin domain name to the s3 url of my static site which works when I type it in the browser so why can't CloudFront find the bucket ...
Ended up solving this by changing my s3 bucket name from 'sample' to 'www.sample.com' .Strangely CloudFront started resolving the correct bucket name. Why this works remains a mystery ...

How to set subdomain with s3 and cloudflare?

I want to assign http://remo.babylook.mom/ on s3 bucket http://babylook-remo.s3-website-us-west-1.amazonaws.com.
I set Cloudflare like this tho,
I got this error.
Code: NoSuchBucket
Message: The specified bucket does not exist
BucketName: remo.babylook.mom
RequestId: 8F85DEC6EA4AB692
HostId: T7Mikx7Fj7fBMJhSbSVDjelX0BGkK87QY40BnTdH0Ga2wqt6c8C/s+LTChQ90uehEV3KmtkxMU4=
Do you know how to set this? I can see s3 website normally with s3 address. And also, I'm using http://babylook.mom/ and working well.
You'll have to add the following record:
Name: http://remo.babylook.mom/
Value/Target: http://babylook-remo.s3-website-us-west-1.amazonaws.com/
Type: CNAME

New S3 bucket created hosting static website: access denied / 403 forbidden error

Created a new bucket in S3.
Created a hosted zone in Route 53 service, added the domain(buzzindia.biz)
Created the bucket policy, bucket policy can be seen here
Uploaded a index.html file to the bucket
Able to access the index file from this url
but unable to access from the domain name in the browser (buzzindia.biz),getting 403 forbidden error
403 Forbidden
Code: AccessDenied
Message: Access Denied
RequestId: 4BECED9C1264762B
HostId: 7LooXNEnXbVJ7rVPRaakzfmmYNKzgsygBS4EiBnez85w+m4//dtmZPv7jsdKb0z1QTKSeFmWErQ=
Also, we changed the nameservers for this domain (buzzindia.biz) to the following
NS-1373.AWSDNS-43.ORG
NS-1927.AWSDNS-48.CO.UK
NS-476.AWSDNS-59.COM
NS-631.AWSDNS-14.NET
Kindly help us in access our website from the domain name url i.e buzzindia.biz

Access Denied for index.html Amazon S3 static website

I've set up an example static website on Amazon S3 and I added a custom folder to it with file inside: custom-folder/index.html, but
I'm getting Access Denied error when trying to access url /custom-folder.
The index document is configured to be index.html, so S3 should serve index.html when I'm accessing /custom-folder url, but it doesn't work.
How can I fix this?
It seems you are using the wrong URL to access the bucket.
For example, when you enable to static website hosting feature in S3 (us-west-2 in this example), you are given a URL with the following format:
Endpoint : http://bucket-name.s3-website-us-west-2.amazonaws.com
You can see your endpoint by going to S3 > Click on your bucket > Bucket Properties > Static website hosting > should reveal your endpoint.
In case it helps anyone else, I was using a AWS Cloudfront Distribution on top of an S3 bucket.
The solution to the "Access Denied" issue for me was to perform the / to /index.html redirect in Cloudfront (rather than S3).
This is achieved by setting the "Default Root Object" to index.html on the AWS Cloudfront Distribution (and disabling "Static website hosting" entirely in S3).

AWS CloudFront redirecting to S3 bucket

I have created a CloudFront distribution to serve the static website. S3 is origin server.
Now if we access CloudFront URL, it redirects to S3 location.
d2s18t7gwlicql.cloudfront.net
or
test.telekha.in
In the browser it is showing
https://telekha-test-www.s3.ap-south-1.amazonaws.com/index.html#/dashboard
I am expecting https://test.telekha.in/#/dashboard
If I access https://test.telekha.in through curl it returns my index.html document
If I access http://test.telekha.in through curl it returns
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>CloudFront</center>
</body>
</html>
But in browser both HTTP and HTTPS are redirecting to https://telekha-test-www.s3.ap-south-1.amazonaws.com/index.html#/
Please let me know how to resolve this issue.
Quick Solution
Use the regional domain name of your S3 bucket to configure the CloudFront distribution's origin, e.g.: {bucket-name}.s3.{region}.amazonaws.com.
Explanation
According to the discussion on AWS Developer Forums: Cloudfront domain redirects to S3 Origin URL (via archive.org), it takes time for DNS records to be created and propagated for newly created S3 buckets. The issue is not visible for buckets created in US East (N. Virginia) region, because this region is the default one (fallback).
Each S3 bucket has two domain names, one global and one regional, i.e:
global — {bucket-name}.s3.amazonaws.com
regional — {bucket-name}.s3.{region}.amazonaws.com
If you configure your CloudFront distribution to use the global domain name, you will probably encounter this issue, due to the fact that DNS configuration takes time.
However, you could use the regional domain name in your origin configuration to escape this DNS issue in the first place.
CloudFormation Template
If you are using CloudFormation, you can use the RegionalDomainName output attribute of the AWS::S3::Bucket resource:
S3Bucket:
Type: AWS::S3::Bucket
CloudFrontDistribution:
Type: AWS::CloudFront::Distribution
Properties:
DistributionConfig:
Origins:
- DomainName: !GetAtt S3Bucket.RegionalDomainName
More information
As well, I would highly recommend to read this blog post on the future of S3 different path formats:
Amazon S3 Path Deprecation Plan – The Rest of the Story
I found the issue. It is with cloudfront configuration.
This blog helped me.
While defining the origin I have directly selected S3 bucket. We should enter the domain of the S3 bucket like telekha-test-www.s3-website.ap-south-1.amazonaws.com
The first thing to check if you think you are seeing this is to run the curl command below. If it returns HTTP/1.1 307 Temporary Redirect, then you are seeing this issue.
$ curl -I https://YOUR_CF_DOMAINNAME.cloudfront.net/
HTTP/1.1 307 Temporary Redirect
Content-Type: application/xml
Content-Length: 0
Connection: keep-alive
x-amz-bucket-region: ap-southeast-2
Location: http://yourS3bucketname.s3-ap-southeast-2.amazonaws.com/
Date: Wed, 12 Jul 2017 00:20:27 GMT
Server: AmazonS3
Age: 1775
X-Cache: Hit from cloudfront
Via: 1.1 someid.cloudfront.net (CloudFront)
X-Amz-Cf-Id: someguid==
The best description I found of this issue is:
S3 updates the DNS for the global REST endpoint hierarchy *.s3.amazonaws.com with a record sending requests to the right region for the bucket within a short time after bucket creation, and CloudFront appears rely on this for sending the requests to the right place. Before that initial update is complete, S3 will return a redirect and CloudFront returns that redirect to the browser. ~ michael-sqlbot
Given this issue is actually due to the internal DNS propagation of the S3 bucket name (which is not 100% clear, but seems highly likely) that occurs when you configure the bucket in S3, then it should be possible to avoid this issue by configuring a public web site in S3 prior to configuring the Cloudfront distro, and per the doco, configure the S3 public web name as the cloudfront origin rather than the s3 bucketname.
For reference, I have both S3 bucket names and S3 website names configured as Cloudfront origins and I can say that they do both work! (eventually?)
References:
AWS official setup guide
AWS Forum topic
Turns out this is just a timing issue which fixes itself after a while if everything is configured correctly. More information can be found in this AWS forum thread.
Current accepted answer here and linked blog article suggest enabling static website for your S3 bucket and then changing CF origin to point to that static website. This solution does solve the redirect problem but with the side effect that you website is now available using both CF URL or your custom CNAME as well as using S3 URL.
To expand on the accepted answer, this part at the end of the referenced blog post in particular is helpful:
I found a subtle “bug” some days ago: when using URLs like
www.example.com/about/, Amazon S3 will in fact return the “index.html”
file inside the folder (because it is configured as a static website
bucket).
The funny thing is that if you omit the trailing slash
(www.example.com/about), S3 will first check if an object called
“about” exists. If it does not, it will consider that about is a
folder, and will issue a 301 redirection to about/. When using
CloudFront, this means that CloudFront will in fact cache… the
redirection instead of the file itself! Therefore, you must make sure
that all your URLs end by a trailing slash to avoid a useless
redirect.