about S3 web hosting index setting does not work - amazon-s3

I'm using S3 web hosting for host website.
I want to make setting for ,
if user access mydomain/ then response mydomain/index.html
On S3 console I set Index Document: index.html in webhosting section.
but it doesn't work well.
now I access to mydomain/" then response is 403(access denied) status code.
if I access to mydomain/index.html" then index.html returned(works well)
I'm not using Route53 for DNS, I'm using my domain register's DNS.
I set cname recode.
Please give me some advise.
That's very helpful for me.
Thanks.

Related

Webserver and Cloudfront distribution with the same domain name

We have a (django) wep application that is running at example.com and we would like to serve some static assets on s3 via cloudfront from this same domain. So if we had a file with key assets/img.jpg we would be able to access it via example.com/assets/img.jpg.
We have been attempting to use this guide but have only been able to get it working with a subdomain to access cloudfront so static.example.com/assets/img.jpg
The issue we are running into is the DNS setup for this, there is already a CNAME for example.com (web app) that routes traffic to the server, but we are unable to create a second entry with the same name example.com to the cloudfront distribution.
In order to do this, go to the configuration for your Cloudfront distribution.
From there, you need to create another "origin" that points to that S3 bucket, and then a "behavior" for the "/assets/*" path to send the traffic to that S3 bucket.

CloudFront + S3+ EC2 - domain name shows unsecure even though SSL certificate is installed

Issue:
When I access my website https://www.guidancecoding.com/ and try to login It shows unsecure, even though SSL certificate is present in the browser.
Questions:
Any thought as to why it is happening?
Any idea how to resolve it?
Does anyone need more information to better understand this problem.? There is too much information in the whole process and I am not sure what will add value. It will be great if you guys can feel free to ask me for relevant information.
Description:
website: https://www.guidancecoding.com/ .
I am trying to deploy(Angular+ springboot) application in s3 and Ec2 using elastic beanstalk.
S3 is where my Angular static content is present.
Ec2 along with a loadbalancer serves the spring-boot API.
CloudFront origin is S3.
Important notes:
An SSL certificate for guidancecoding.com and www.guidancecoding.com is created and installed in loadbalancer using elastic bean stalk. (Mumbai region)
An SSL certificate for guidancecoding.com and www.guidancecoding.com is created in N. Virginia for AWS CloudFront. (This is a requirement).
Project Architecture:
Domain Name (guidancecoding.com) points to cloudfront url.
Cloudfront points to Angular app in S3 bucket.
Once app is open in browser, the browser makes API request to elastic bean environment for data.
Image for reference:
Additional information from safari console.

Subdomain point to Amazon S3 Bucket

I am a little bit confused with subdomain point to S3 bucket.
I have domain called mydomain.com from NameCheap.com and my hosting server is Hostgater.
So my website is up and running.
I have a lot of mp3 files. So I have created Amazon S3 bucket call
media.mydomain.com
So I got my static s3 website URL as follow.
http://media.mydomain.com.s3-website-ap-southeast-1.amazonaws.com/
I want to point this url to my subdomain, media.mydomain.com.
May I know how and where to point? NameCheap or Hostgator.
I have created subdomain in hostgator but it can only redirect to S3 URL
Thanks,
Alex
You can make a new DNS record in Namecheap for this task
In your Namecheap account, go to Manage your domain, then Advanced DNS, and Add new Record with CName type
Host: Enter your subdomain media
Value: Enter media.mydomain.com.s3-website-ap-southeast-1.amazonaws.com. (with a dot . at the end)
TTL: Automatic
Save all changes and wait for about 1 hour for the new record to take effect.

Setting foobar.com and www.foobar.com to point to my Amazon S3–hosted site

I have a website hosted at Amazon S3; the URL is something like www.foobar.com.s3-website-us-east-1.amazonaws.com. I would like to set my domain registrar (NameCheap) to redirect both foobar.com and www.foobar.com to this website. Setting the record
www.foobar.com CNAME www.foobar.com.s3-website-us-east-1.amazonaws.com.
works fine for the www subdomain. However, I can’t figure out how to configure the no-subdomain version of the site. I tried
foobar.com CNAME www.foobar.com.s3-website-us-east-1.amazonaws.com.
but that doesn’t seem to work. (And did I read somewhere that CNAMEs aren’t supposed to be used like this?) I know that the S3 bucket name is supposed to be identical to the fully-qualified DNS name, but does this really mean that I need to mirror my website contents in two different buckets? I feel like there must be a better solution than that.
Thanks!
You cannot serve "domain apex" content from S3-hosted websites. The easiest solution is to configure your domain such that "foobar.com" is redirected to "www.foobar.com". Unfortunately this requires you to run a HTTP server with a rewrite rule to enforce it.
I can't vouch personally for the service but http://www.wwwizer.com/ offers a free apex to www redirect service.
It looks like AWS S3 added bucket redirection around the end of 2012 to allow support for www.foobar.com and foobar.com

Amazon S3: Static Web Sites: Custom Domain or Subdomain

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?WebsiteHosting.html and created a bucket for my static web site, and it worked fine. I have an URL of the form http://[my bucket name].s3-website-us-east-1.amazonaws.com/.
However, I would like to point a subdomain that I own (e.g. static.mydomain.com) to my static web site at Amazon S3. Has anybody figured out how to do that?
I appreciate any help you can give me.
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.
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.
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.
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.
Make sure that you follow the S3 DNS bucket naming conventions when creating your bucket.
Then:
Enable S3 Website support for the bucket using the AWS Management Console at Properties --> Website
Make sure the files in the bucket have public read permissions
Try the website using the endpoint listed in the Management Console
Setup your CNAME using the listed endpoint (e.g. www.example.com CNAME www.example.com.s3-website-us-east-1.amazonaws.com)
Create a hosted zone say mydomain.com. You can use a web based UI DNS30.
Now create a CNAME entry for this hosted zone.
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
This is called Virtual Hosting of Buckets: http://docs.amazonwebservices.com/AmazonS3/latest/dev/VirtualHosting.html
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.
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:
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)
Upload the index.html file in the bucket
Create a CNAME record with your domain provider