SAA-C03 Question 167
Single answerA company is running a web application on Amazon EC2 instances behind an Application Load Balancer (ALB). The application stores user-uploaded files in an Amazon S3 bucket. Recently, the company noticed that some users are uploading very large files, causing performance issues for the application. The solution architect is tasked with ensuring that file uploads larger than 100 MB are rejected before they reach the EC2 instances. How can this requirement be met?
- A
Configure the ALB with a listener rule to check the Content-Length header and reject requests larger than 100 MB.
- B
Use an AWS Lambda function triggered by the ALB to validate the file size and reject requests larger than 100 MB.
- C
Configure Amazon S3 bucket policies to deny uploads of files larger than 100 MB.
- D
Leverage an AWS WAF rule associated with the ALB to inspect the Content-Length header and block requests larger than 100 MB.
Show answer and explanation
Correct answer: D
Explanation
The correct solution is to use AWS WAF to block requests with a Content-Length header indicating a file size larger than 100 MB. AWS WAF integrates with the ALB and can inspect HTTP requests for specific patterns, including header values. This approach prevents large file uploads from reaching the EC2 instances, preserving application performance without introducing unnecessary complexity.
- A. Incorrect.
Application Load Balancers do not support inspecting the Content-Length header or blocking requests based on file size. This option is not feasible.
- B. Incorrect.
While AWS Lambda can be used for various tasks, using it in this scenario would introduce additional latency and complexity. There are simpler, more efficient ways to achieve the requirement.
- C. Incorrect.
S3 bucket policies can control access and permissions for S3 objects, but they do not provide a mechanism to inspect file sizes in HTTP requests before they are uploaded.
- D. Correct.
AWS WAF (Web Application Firewall) can inspect HTTP headers, including the Content-Length header, and enforce rules to block requests exceeding specific file size thresholds. This is the most appropriate solution for the given scenario.