---
title: "Discussion on \"Deep Dive into CloudFront: Understanding Internal Caching Mechanisms and Implementing Websites on S3 with Region Failover\" | Hashnode"
description: "Discussion on \"Deep Dive into CloudFront: Understanding Internal Caching Mechanisms and Implementing Websites on S3 with Region Failover\". Deep Dive into CloudFront: Understanding Internal Caching Mechanisms and Implementing Websites on S3 with Region Failover. Hosting static website on s3 buck"
url: "https://hashnode.com/posts/deep-dive-into-cloudfront-understanding-internal-caching-mechanisms-and-implementing-websites-on-s3-with-region-failover/64a026186f60f1d4896b4398"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Deep Dive into CloudFront: Understanding Internal Caching Mechanisms and Implementing Websites on S3 with Region Failover](https://ankitjodhani.hashnode.dev/deep-dive-into-cloudfront-understanding-internal-caching-mechanisms-and-implementing-websites-on-s3-with-region-failover?utm_source=hashnode&utm_medium=feed)

Deep Dive into CloudFront: Understanding Internal Caching Mechanisms and Implementing Websites on S3 with Region Failover. Hosting static website on s3 buck

Jul 1, 2023 · 10 min read · ankitjodhani.hashnode.dev  
Read the article

-   [#aws](https://hashnode.com/tag/aws)
-   [#awscommunity](https://hashnode.com/tag/awscommunity)
-   [#cloudfront](https://hashnode.com/tag/cloudfront)
-   [#s3](https://hashnode.com/tag/s3)
-   [#s3-bucket](https://hashnode.com/tag/s3-bucket)

## Written by

[Ankit Jodhani](https://hashnode.com/@ankitjodhani)

@ankitjodhani · india

  
[View profile](https://hashnode.com/@ankitjodhani)

I would Love to write about Cloud ( AWS ) and DevOps practice's

Hello, I'm Ankit Jodhani, a B.tech graduate from P P SAVANI UNIVERSITY. I have a strong passion for DevOps and Cloud technologies. During my internship, I gained valuable experience in DevOps, focusing on Continuous Integration and Deployment (CI/CD) using popular tools like GitLab and CircleCI. Currently, I am actively expanding my knowledge in DevOps and Cloud. With a particular emphasis on the AWS cloud, I have successfully completed numerous projects and explored various AWS services, including EKS, ECS, EC2, LightSail, S3, VPC, CloudFront, WAF &amp; Shield, DynamoDB, RDS, CloudWatch and CodePipeline. Furthermore, I possess proficient skills in backend development, particularly with Node.js. I have very good knowledge of DevOps tools such as Kubernetes, Docker, Terraform, Ansible, and Jenkins. Leveraging these tools, I have consistently implemented robust and scalable solutions. I am enthusiastic about sharing my experiences and knowledge regarding AWS, DevOps, and the projects I have undertaken. I look forward to providing insightful content in these domains

## Responses 3

Markdown supported · ⌘↵ to post

[Nitesh Daga](https://hashnode.com/@daganitesh)

[Jul 1, 2023](https://hashnode.com/posts/deep-dive-into-cloudfront-understanding-internal-caching-mechanisms-and-implementing-websites-on-s3-with-region-failover/64a026186f60f1d4896b4398/comment/64a063d02eab00c6bef0643b)

Wow, great post on origin failover in CloudFront! It's impressive how CloudFront ensures high availability, but it's important to address the latency bottleneck associated with this approach.

While CloudFront's origin failover configuration is powerful, it introduces additional latency. Monitoring the primary origin and making failover decisions adds processing time, impacting end-user latency. This may not be ideal for certain applications or use cases.

To mitigate latency, consider using DNS failover. By leveraging a DNS-based traffic management service like Route 53, we can minimize latency while providing failover capabilities.

Here's how to implement it:

1.  Set up separate CloudFront distributions for primary and secondary origins, optimizing caching and content delivery.
    
2.  Configure custom origins in each CloudFront distribution, ensuring accessibility for both.
    
3.  Implement DNS failover using Route 53. Set up two DNS records, pointing to each CloudFront distribution, to control traffic routing based on health checks.
    
4.  Configure health checks for CloudFront distributions using Route 53 health checks.
    
5.  Set up DNS failover rules based on health check results in Route 53 to route traffic to the secondary distribution if the primary fails.
    

DNS failover offers fast failover with minimal latency. Default routing goes to the primary distribution, ensuring low latency for most requests. If a failure occurs, DNS failover quickly switches to the secondary distribution, redirecting traffic to the secondary origin.

Consider DNS propagation and TTL settings to ensure timely failover. DNS failover provides more control over failover and optimizes latency for the primary origin. This approach reduces the latency introduced by the origin failover configuration and offers greater flexibility and control over your content delivery infrastructure.

[Lasya Mayukha Ramachandruni](https://hashnode.com/@lmayukha)

[Jul 1, 2023](https://hashnode.com/posts/deep-dive-into-cloudfront-understanding-internal-caching-mechanisms-and-implementing-websites-on-s3-with-region-failover/64a026186f60f1d4896b4398/comment/64a03da68db091c40103381b)

l really enjoyed reading this blog. Thanks for sharing knowledge.
