Soru

Zorluk: OrtaAmazon CloudFront Caching, Origins, and Security

A company's primary web application is served through an Amazon CloudFront distribution with an Application Load Balancer (ALB) as the custom origin. During peak traffic events, the ALB occasionally returns HTTP 502 (Bad Gateway) errors. To maintain a good user experience, the SysOps administrator wants to configure CloudFront to serve a static maintenance page hosted in an Amazon S3 bucket when these errors occur. How should the administrator configure the CloudFront distribution to meet these requirements?

  1. A
    Configure an Amazon Route 53 active-passive failover routing policy that routes traffic to the S3 bucket when the ALB is unhealthy.
  2. B
    Modify the ALB target group health check path to point directly to the static maintenance page hosted in the S3 bucket.
  3. Create an origin group containing the ALB as the primary origin and the S3 bucket as the secondary origin, then configure failover criteria to include the 502 status code.Cevap
  4. D
    Create a CNAME record at the zone apex in Route 53 pointing to the S3 bucket static website endpoint to redirect users when the ALB returns a 502 status code.

Cevap

Create an origin group containing the ALB as the primary origin and the S3 bucket as the secondary origin, then configure failover criteria to include the 502 status code.
Creating a CloudFront origin group with the ALB as the primary origin and the S3 bucket as the secondary origin allows CloudFront to fail over automatically. When the primary origin returns an HTTP 502 status code, CloudFront requests the content from the secondary origin (S3 bucket), ensuring that the maintenance page is served to the viewer.

Adım Adım Çözüm

1
Identify that the primary origin (ALB) returns transient HTTP 502 errors and that failover needs to happen dynamically at the CloudFront edge.
Realize that DNS-level failover is inappropriate because it cannot inspect HTTP response codes on a per-request basis.
Choosing the correct layer for failover ensures minimal downtime and correct handling of status codes.
2
Configure an origin group within the CloudFront distribution.
Add the ALB as the primary origin and the S3 bucket containing the maintenance page as the secondary origin.
This establishes the backup path for content delivery.
3
Select the HTTP 502 status code in the origin group's failover criteria configuration.
CloudFront will intercept 502 errors from the ALB and fetch the requested resource (or maintenance page) from the S3 bucket instead.
Specifying the status code triggers the automated redirect behavior at the edge.

Anahtar Kavram

CloudFront Origin Groups and High Availability
Bu soruyu puanla