As you may already know, Amazon offers the best cloud services through an initiative called Amazon Web Services (or simply Amazon AWS). Among the available services are some that, when combined, allow the hosting of websites to be effortless and with a relatively low (and scalable) cost. One such service is called Simple Storage Service (S3), a service that stores files in the cloud.
Hosting a website traditionally uses a dedicated, shared physical or virtual server and some software that will serve the features of the site. Monitoring and continuously updating both Hardware and Software are not simple tasks, not to mention the risk of unavailability. The chance of losing a file or even the whole website is a risk that no one can afford; that is when AWS S3 Buckets comes in handy. On AWS servers, the risk of losing a file is virtually zero, and it is way more secure than saving data into a conventional data system such as flash drives, hard drives, or any other alternative media.
AWS S3 buckets have redundancy in its storage system. In other words, it replicates each file stored in a bucket on several different servers. So, in addition to having a copy of your data in many different servers, you also have its redundancy increased by replicating it in other regions, countries and continents.
“AWS s3 stores data as objects within resources called “buckets.” These buckets allow its users to store as many objects as you want, as well as save, read, and delete objects. “
But using S3 can go far beyond a simple object storage service. We can use it for hosting static websites and using AWS S3 for this purpose it is possible to obtain several advantages that would not exist or would be way more challenging to perform in the traditional model of web hosting, such as:
- Very high availability (99.99% uptime)
- Possibility of integration with CloudFront for certificates and caching
- Access control (access authorization by ips, for example)
- Object redirect rules
- Replication across regions (for latency reduction)
- File Versioning
The following tutorial aims to explain quickly and briefly how to host a static website on an AWS S3 Bucket.
Hosting a static website on a AWS S3 bucket
Sign up for Amazon AWS if you haven’t already.
In Route53, create a new hosted zone. Add the name server settings to your domain registrar. Then be prepared to wait, this can take a while to propagate.
In S3, create two buckets, example.com + www.example.com.
In your primary domain, select Static website hosting >> Use this bucket to host a website. Fill in the necessary document details.
The secondary domain, add the redirect.
Remember to turn blocking off, or no one will be able to access your website.
In Certificate Manager, add your domain name. Verify you own the domain through Route53 using DNS verification.
Remember to use example.com + www.example.com (or *.example.com which is a wildcard ssl)
Wait until it is valid.
In CloudFront, create a new Distribution.
Add your Origin Domain Name: example.com.s3.amazonaws.com (it will auto fill as you start typing)
Add your URL name to Alternate Domain Names (CNAMEs): example.com, if you don’t, CloudFront DNS won’t be selectable in Route53.
Select your Custom SSL Certificate (example.com): example.com (f3d1b334d-66fc-4b0c-87c9-74f33729dde8)
Add the Default Root Object: index.html (example)
Select the proper target alias in your settings:
If you select the S3 version, SSL won’t work, you need to select the CloudFront option.
Both example.com + www.example.com need to be A-records, pointed to the Alias bucket/cloudfront distribution or the www redirect will not work.
Last step: Check your website URL to make sure it works.
Full Stack Developer, Digital Marketer, and InfoSec enthusiast. He received his Bachelor’s Degree from the University of Western Sydney and his Business Diploma from Georgian College before joining various marketing positions in search portals, e-commerce, higher education, and addiction recovery services.Follow @ twitter
HTML sitemap w/o a WP Plugin
Have you heard about HTML sitemap? Well, it offers easy navigation for your website visitors. To be more precise, it’s the bulleted outline text version of a website. The visitors can use the sitemap to easily find/locate any topic which they can’t find searching through the whole website menus. The best part is that HTML… Read More
Add Quick Keys in Safari (or any Program on your Mac)