DEV Community

Bhuvaneswari Subramani for AWS Heroes

Posted on • Updated on


Enabling resiliency for a static website hosted on AWS Cloud

"Everything fails all the time." says Werner Vogels, CTO & VP, Amazon.
Though, happily hosted my personal website on Amazon S3 as a static website hosting in the Mumbai region and set up CI / CD to integrate the changes from GitHub repo to Amazon S3.
Is the disaster recovery in-place or is it resilient?

What is Resiliency?

Resiliency is the ability for a system to recover from a failure induced by load, attacks, and failures.

Amazon S3 is highly available and resilient for zonal failure but is the website resilient for a regional disaster like power, weather.,? Though the chances are very remote with AWS Cloud, let's make the website resilient by setting up disaster recovery. Of course, the cloud has better ways to help provide business continuity, and here is one.

Table of Contents

AWS Services Used

  • S3
  • Route 53
  • CloudFront
  • IAM

Best Practise

  • Ensure to tag all the resources that you create.
    • S3 dr bucket
  • I have created two tags (Name: and Usage: website), which will help for resource grouping and cost analysis.
  • To standardize,, and is used as root and subdomain throughout this article


Alt Text

Detailed Implementation Instructions

Create S3 bucket for Disaster Recovery

  • Create an S3 bucket (say in a different region to set up a disaster recovery site for the website and configure for static website hosting as follows

Alt Text

Important Note Ensure versioning is enabled for both source ( and destination bucket (

Setup replication from to

Select the main S3 bucket,, and go to the Management tab, select Replication rules and click Create replication rule

Alt Text

Alt Text

Alt Text

Alt Text

Alt Text

Alt Text

Alt Text

Create Origin Group

Our ultimate goal is to remove the single point of failure, implementing automatic detection of failure, and configure a redundant path to establish business continuity.

Now that you have the dr-s3 bucket created and replication configured source, let's proceed to add Origin Group to your Cloudfront distribution pointing to your static website.

Edit the Web distribution created for your static website and add another origin pointing to the disaster recovery S3 bucket ( and here is the setting for the new origin.

Alt Text

The next step is to create an Origin Group with both the origins as follows with as primary and as secondary.

Alt Text

Time to test for resiliency!!
Go and delete the S3 bucket ( where your static website is hosted and watch the Cloudfront re-directing the request to the disaster recovery S3 bucket (

Top comments (1)

waswani profile image

Do we need static website hosting configuration as we are configuring CloudFront OAI to access S3? Moreover, the endpoint configured in the CloudFront Origin is not the http endpoint of the S3 website but S3 bucket directly which is accessed over https?

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git