Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Host static web site in Amazon S3 without using Amazon route 53

I tried to publish a static website in Amazon S3 and after following all the steps I managed to do it, but after a few minutes it didn't work anymore. I didn't use Amazon Route 53, I just created a CNAME file with my domain provider (http://my.dot.tk/cgi-bin/login01.taloha). I followed the IP by host my endpoint but I saw it changes white often. I don't want to use Route 53 since is not free unlike the AWS free usage Tier.

Any clues? May it be Amazon firewall?

like image 980
Watchmaker Avatar asked Aug 05 '13 20:08

Watchmaker


People also ask

Can Amazon S3 run a static website?

After you create a bucket, you can enable static website hosting for your bucket. You can create a new bucket or use an existing bucket. Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/ .

Is it free to host static website on S3?

This is the little gem I learned from a course on AWS Developer Associate Certificate. Normally, hosting a website on normal web hosting will cost at least $5 / month, but AWS S3 offers the 1-year free tier of 5GB storage and 15GB bandwidth.

Can you host dynamic websites on S3 what about Static websites?

For hosting a dynamic website on AWS, you need to use EC2 product. S3 is only used for storage and static website hosting. Other than EC2, you can also use Lightsail, which is basically a VPS. For hosting on EC2, you will need to launch an empty and install LAMP or any PHP based stack you have on the server.


2 Answers

I had the same issue. I actually can't use Route53 because of way my employer handles DNS. It is an ugly solution, but what I did was have a free tier eligible t1.micro ec2 instance with a web server running with a static "elastic ip". I have my static site in s3, my domain name is pointed at the elastic ip. The ec2 web-server serves pages that are essentially iframes that contain the desired page from s3. The html on the ec2 instance looks like:

<!DOCTYPE html>
<html>  
    <head>  
        <title>Title</title>
        <style type="text/css">
            body, html
            {       
                margin: 0; padding: 0; height: 100%; overflow: hidden; 
            }       

            #content
            {       
                position:absolute; left: 0; right: 0; bottom: 0; top: 0px; 
            }       
        </style> 

    </head>
    <body>  
        <div id="content">
            <iframe width="100%" height="100%" frameborder="0" src="http://yoursite.s3-website-zone.amazonaws.com" />
        </div>  
    </body> 
</html> 

Like I said, it is an ugly solution, but it works with my extremely simple sites.

like image 65
pauldast Avatar answered Oct 23 '22 19:10

pauldast


You can, but it wont work very well. You would need to create a CNAME record to map to the endpoint, which you can't use for apex records. You would need some other way of forwarding traffic from the apex to presumably www.domain.com.

S3, Cloudfront either a set of IPs or Geo-DNS to determine which IP address will serve a given request. This is not something you can efficiently replicate in your own DNS.

The cost of Route53 is pretty low, depending on traffic, it could hit be a $1 or less per month.

like image 1
datasage Avatar answered Oct 23 '22 19:10

datasage