Serve a custom error page from S3 through CloudFront while the ALB fault is fixed

Answer Correct answers: A, E — Host the custom error pages in S3 and add a CloudFront custom error response to return them.

A retail company is operating its ecommerce application on AWS. The application runs on Amazon EC2 instances behind an Application Load Balancer (ALB). The company uses an Amazon RDS DB instance as the database backend. Amazon CloudFront is configured with one origin that points to the ALB. Static content is cached. Amazon Route 53 is used to host all public zones. After an update of the application, the ALB occasionally returns a 502 status code (Bad Gateway) error. The root cause is malformed HTTP headers that are returned to the ALB. The webpage returns successfully when a solutions architect reloads the webpage immediately after the error occurs. While the company is working on the problem, the solutions architect needs to provide a custom error page instead of the standard ALB error page to visitors. Which combination of steps will meet this requirement with the LEAST amount of operational overhead? (Choose two.)

  1. Create an Amazon S3 bucket. Configure the S3 bucket to host a static webpage. Upload the custom error pages to Amazon S3. Correct Answer
  2. Create an Amazon CloudWatch alarm to invoke an AWS Lambda function if the ALB health check response Target.FailedHealthChecks is greater than 0. Configure the Lambda function to modify the forwarding rule at the ALB to point to a publicly accessible web server.
  3. Modify the existing Amazon Route 53 records by adding health checks. Configure a fallback target if the health check fails. Modify DNS records to point to a publicly accessible webpage.
  4. Create an Amazon CloudWatch alarm to invoke an AWS Lambda function if the ALB health check response Elb.InternalError is greater than 0. Configure the Lambda function to modify the forwarding rule at the ALB to point to a public accessible web server.
  5. Add a custom error response by configuring a CloudFront custom error page. Modify DNS records to point to a publicly accessible web page. Correct Answer

Community Votes

AE
100%

100% of anonymous learners picked answer AE. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

CloudFront can be configured with a custom error response that maps the 502 status to an object in an S3 bucket, so the visitor gets the branded page while the transient origin fault is being resolved, and neither Route 53 nor the ALB needs to be reconfigured.

An ecommerce application behind an ALB occasionally returns a 502 Bad Gateway because the targets return malformed HTTP headers, and reloading immediately afterwards succeeds. While engineers investigate, visitors should see a custom error page instead of the default ALB error page.

Rewiring DNS or the ALB forwarding rule to a fallback web server. Those approaches change the request path for all traffic, add a component to operate, and the fault here is transient and application-level, so pointing production traffic at a different origin is a much larger change than adding an error response.

Community Discussion (8 comments)

pangchn 👍 5 Selected: AE
same question as page1 question 10
AzureDP900 👍 1
Option A allows for a simple and quick solution by hosting a custom error page on Amazon S3. No changes are required to Route 53, CloudFront, or the ALB. Option E uses CloudFront to display a custom error page without modifying any other resources. Both options A and E meet the requirement with minimal operational overhead, so choosing both of them is correct!
career360guru 👍 1 Selected: AE
A and E
arberod 👍 2 Selected: AE
it is AE
kejam 👍 3 Selected: AE
Answer: AE All other answers won't help for transient failures https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/GeneratingCustomErrorResponses.html#custom-error-pages-procedure
master9 👍 1 Selected: AE
answer is A and E
alexis123456 👍 3
correct answer is A and E
duriselvan 👍 1
A,B, ans

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

The problem is a transient 502 returned by the ALB, and the immediate need is only what the visitor sees during that window. Hosting a static custom error page in an Amazon S3 bucket is the cheapest way to have that page available, and it requires no change to the existing application or ALB configuration. A CloudFront custom error response is then configured to return that S3 object when CloudFront receives the 502 status, so visitors see the branded page. Because the fault is transient and the page reload succeeds, this is a presentation-layer measure that carries the least operational overhead, since no new compute, DNS, or health check logic has to be maintained.

Why the Other Options Are Wrong

B: Modifying the ALB forwarding rule to point at a publicly accessible web server is a response to a health check failure metric, but the root cause here is malformed headers on specific requests rather than failing health checks, and changing the forwarding rule would redirect normal production traffic to a fallback server. D: Using the Elb.InternalError metric has the same two problems as B, since it changes the request path for all traffic and requires Lambda plus a fallback web server to operate. C: Adding health checks and a fallback target in Route 53 is aimed at resolving records when a target is unhealthy, which is not the failure described, and it adds DNS-level complexity for a page-rendering requirement.

Community Comment Notes

The community voted 100 to 0 for A and E, and the top-voted comment linked the CloudFront documentation for generating custom error responses. A commenter also noted this is the same question as an earlier item in the same practice set, which is consistent with the fully unanimous answer.

Official Reference

Related Analysis

Practice All SAP-C02 Questions

Access 85 questions with complete answers and detailed explanations.

View Full SAP-C02 Practice Test →

← Back to SAP-C02 Study Guide