AWS Cloud Architecture•Part 4: Storage, Content Delivery & Databases (36 - 50)
CloudFront Edge Locations & Regional Edge Caches.
In Simple Words:
- Edge Locations: 450+ points of presence worldwide that cache content close to end users for ultra-fast load times.
- Regional Edge Caches: A larger caching layer sitting between Edge Locations and your origin server to prevent cache misses from overwhelming backend origins.
hcl
resource "aws_cloudfront_distribution" "s3_distribution" {
origin {
domain_name = aws_s3_bucket.static_assets.bucket_regional_domain_name
origin_id = "S3Origin"
}
enabled = true
default_root_object = "index.html"
default_cache_behavior {
allowed_methods = ["GET", "HEAD"]
cached_methods = ["GET", "HEAD"]
target_origin_id = "S3Origin"
viewer_protocol_policy = "redirect-to-https"
}
}