AWS Certified Solutions Architect Professional SAP-C02 Practice Question
A media-streaming startup hosts a single-page web application in an Amazon S3 bucket behind an Amazon CloudFront distribution. Every viewer request is forwarded to an Amazon API Gateway endpoint in us-east-1 where a Lambda function (about 8 MB of Node.js libraries) generates a personalized HTML page after reading viewer cookies and making a brief call to Amazon DynamoDB. Global users experience 300-500 ms of additional latency because each request must reach the AWS Region before the page can be formed.
The company wants to reduce first-byte latency by moving the personalization logic as close to viewers as possible while continuing to use serverless services. The new solution must allow the existing Node.js code size, support occasional network calls to DynamoDB, and require minimal operational overhead.
Which AWS solution will meet these requirements?
Use AWS Global Accelerator to route traffic to multiple Regional API Gateway endpoints that host the Lambda function.
Migrate the personalization code to a Lambda@Edge function that is invoked on the CloudFront origin request event.
Deploy the code on Amazon EC2 instances inside AWS Wavelength Zones in each target geography.
Move the personalization code to CloudFront Functions and attach it to the viewer response event.
Running the code as a Lambda@Edge function that is triggered by the CloudFront origin request event deploys the existing Node.js logic to every CloudFront edge location. Lambda@Edge supports deployment packages up to 50 MB for origin-facing events, which accommodates the 8 MB function (viewer-facing events are limited to 1 MB). The function can also make outbound network calls, allowing it to invoke DynamoDB while still executing close to users. CloudFront automatically replicates, scales, and operates the function, eliminating infrastructure management and sharply reducing latency.
CloudFront Functions cannot call external services and limits code packages to 10 KB, so it cannot run the existing personalization logic. Deploying code on Amazon EC2 instances inside AWS Wavelength Zones is not suitable because Wavelength provides edge compute within specific 5G networks, not to a global user base, and would require managing infrastructure. AWS Global Accelerator improves routing but does not run application code at the edge, so it cannot remove the latency from the regional round trip.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is Lambda@Edge, and how does it work?
Open an interactive chat with Bash
What is the difference between CloudFront Functions and Lambda@Edge?
Open an interactive chat with Bash
Why can Lambda@Edge reduce latency compared to an API Gateway setup?
Open an interactive chat with Bash
AWS Certified Solutions Architect Professional SAP-C02
Continuous Improvement for Existing Solutions
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access