loading...

Host a serverless static website with free SSL in 15 minutes.

Arswaw on February 20, 2019

In this guide, I will show you how to host a static website using AWS in a serverless manner. The following AWS services will be used: Simple St... [Read Full]
markdown guide
 

Is there a way to do it without hosting the full zone on route53?

Having only a subdomain served through ssl hosted on s3, while the zone is managed by another DNS manager where there are currently several rules already in place.

 

Does your DNS manager allow you to create CNAME records? Try adding one of those and point it to your Cloudfront URL. Cloudfront has a space for you to pass in alternate domain names. Type the outside domain in that field.

If you try, would you mind letting me know if it worked?

 

Yup, it worked using the alternate names and a CNAME redirecting. Thanks!

 

I think this post missed an important point. So for some people here talking about other solutions or alternatives. Using cloudfront brings you a really great feature that is CDN. Your site is hosted on many locations over the world, this means less latency. The Cloudfront page even says that the amazon prime movies are stored using Cloudfront. So IMHO this provides a great architectural design to your project

 

It's possible that those alternatives provide global deployments.

 

I mean yeah. But it is probably not as good as the replication aws cloudfront provides you. In my opinion the reason to go for this approach is just that. Cloudfront charges for that.

 

If this is a serverless static site I think if able hosting on github pages is a better solution that is even easier and does allow SSL.

In our office setting we deploy sites how you describe above, was not my decision but I have some fears about this overtime and having so many sites in our S3 bucket, 100 and growing.

 

The other commenters mentioned other hosting providers that would work. This is how you might do it on AWS.

Interesting that you're hosting 100 websites in one S3 bucket. I think I'd call that an antipattern.

 

Netlify includes almost all of this and it's free.

 

A friend of mine uses it. He seems to like it. If a person wants to use Netlify, then they have this option. If a person wants to use AWS, then this guide may prove beneficial.

 

Hi thanks for this post i intend to use this to learn more about server-less and aws services, how much will it cost deploying a static site using this approach with let say 12000 visitors per month.Thanks

 
 

Excellent article, I use this setup in my work, I usually let CloudFront modify the Bucket Policy for me.

 

Yes, that's right. You can go to the origin tab on your distribution. Then you can and select "Yes, update bucket policy."

 

Good article. I would add "Default Root Object: index.html" to CloudFront distribution since you do not use the "Use this bucket to host a website" approach so there is no "Index document" field then.

 

Yeah I should outline both approaches in the article. Thank you.

 
 

I've tried, but according to the documentation, you cannot use AWS without a bank card.

If you're a student then AWS Educate may be usable without a card.

EDIT: I now see an option to add a bank to my account. Maybe that could work too.

 

Would I need to renew my cert to keep HTTPS working? Maybe it would be worth adding a section for that.

I've used GitHub pages for creating a static site, and they handle the cert renewal.

 

AWS Certificate Manager handles renewals. I will make a note of that in the post.

I use Github pages for my personal site. I didn't always realize how convenient it was to have the cert renewal. Your reminder may help people who are concerned.

Thank you.

 

I do this with 3 commands:
firebase init
firebase deploy
and "Add Domain" in the hosting section

 

There are many excellent hosting solutions for static websites. Firebase is one of them. My guide can help those who wish to host theirs on AWS.

 

AWS Amplify Console provides a simplified experience for doing all of the above with continuous deployment - console.amplify.aws

 

If a user chooses to use Amplify, I hope it works for them. If a user chooses to use my guide, I wish them the best.

code of conduct - report abuse