AWS -Amazon Route 53

Amazon Route 53 is a highly available and scalable Domain Name System (DNS) web service. 

You can use Route 53 to perform FOUR main functions in any combination: domain registration, DNS routing, and health checking.

DNS management

If you already have a domain name, such as example.com, Route 53 can tell the Domain Name System (DNS) where on the Internet to find web servers, mail servers, and other resources for your domain. 

Traffic management

Route 53 traffic flow provides a visual tool that you can use to create and update sophisticated routing policies to route end users to multiple endpoints for your application. 

Availability monitoring

Route 53 can monitor the health and performance of your application as well as your web servers and other resources. Route 53 can also redirect traffic to healthy resources.

Domain registration

If you need a domain name, you can find an available name and register it by using Route 53. You can also make Route 53 the registrar for existing domains that you registered with other registrars.                                                                                                                                 

Building Resilient Applications with Rout 53

Elastic load balancing health checks & a latency –based routing policy, for less latency

Cloud front edge locations for minimal client policy

ELB load balancers across AZs with connection draining

Health checks to ensure only healthy EC2 instances get requests

Multiple region application deployment to avoid outage

-----------------------------------------------------------------------

How to Deploy a Secure Static Site to AWS with S3 and CloudFront

-----------------------------------------------------------------------------------------------------

We’ll be setting up 4 AWS services in the process of setting up our static website. To give a bit of context, here’s what each of these services provides us:

Table of Contents

Setup

Step 1: Generate an SSL certificate

To have Amazon generate a certificate for us, we will need to prove that we own our custom domain by receiving an email at it. Then, AWS will create and manage an SSL certificate for our domain.

Step 2: Setup an S3 bucket for Static Hosting

Now we’ll create an S3 bucket to hold out site’s static content.

Important: This bucket will be the only thing that you will have to interact with after completing this guide. Making changes to the content in this bucket will change the content served as your site. You can edit your HTML/CSS/JS, and the changes will be reflected almost immediately to the outside world.

Step 3: Create CloudFront Distribution with SSL Termination

With the content of our website now upload to AWS, we’ll configure CloudFront to serve it to the public.

Step 4: Configure Route53 to Route Traffic From Our Custom Domain

Now we will use Route53 - Amazon’s DNS routing service - to point our custom domain name at our CloudFront distribution.

And that’s it! It can take up to 48 hours for all your DNS change to propagate, but once that process has completed you should be able to navigate to your custom top-level domain and see your website being served over HTTPS.

A Word on Pricing

While enterprise-level AWS hosting fees balloon to be quite substantial, at a hobbyist scale AWS is extremely affordable.

Here’s a breakdown of the current pricing for the collection of services we’re using for hosting:

There are additional fees for S3 and CloudFront based on the number of requests you serve, but these are fairly minimal, and won’t drive your bandwidth costs if you’re working at small scale.

Disregarding bandwidth for a second, if we consider even relatively large site with 1 GB of static content, we’re only paying $0.52 a month as a baseline for our hosting.

Considering bandwidth, if we do 50GB/month of bandwidth - about 100k views assuming about 500kB per page view - our bandwidth costs would be $4.33.6

If you are even more price conscious, you can cut out CloudFront and serve content directly from S3 (though, you give up HTTPS). This cuts back on bandwidth costs by a bit.

You can play around with AWS’s own pricing estimator here.

Alternative DNS Routing Approaches

If you don’t want to have AWS handle your DNS, there are a couple of options you can look in to:

Both of these secondary approaches make setting up SSL a bit trickier.

Closing

AWS makes setting up highly available static hosting ridiculously simple at a relatively cheap pricing schedule. Once you’ve setup an S3 bucket to be served with CloudFront, you can update that bucket’s contents to make changes to your site without having to worry about the surrounding infrastructure.

It’s also worth looking into automating deployment of your site to S3 using AWS’s REST API