SAP-C02 practice question 9 of 35

A company runs a processing engine in the AWS Cloud The engine processes environmental data from logistics centers to calculate a sustainability…

Full set: 689 questions

Domain Design Solutions for Organizational Complexity

A company runs a processing engine in the AWS Cloud The engine processes environmental data from logistics centers to calculate a sustainability index The company has millions of devices in logistics centers that are spread across Europe The devices send information to the processing engine through a RESTful API The API experiences unpredictable bursts of traffic The company must implement a solution to process all data that the devices send to the processing engine Data loss is unacceptable Which solution will meet these requirements?
Answer options
A: Create an Application Load Balancer (ALB) for the RESTful API Create an Amazon Simple Queue Service (Amazon SQS) queue Create a listener and a target group for the ALB Add the SQS queue as the target Use a container that runs in Amazon Elastic Container Service (Amazon ECS) with the Fargate launch type to process messages in the queue
B: Create an Amazon API Gateway HTTP API that implements the RESTful API Create an Amazon Simple Queue Service (Amazon SQS) queue Create an API Gateway service integration with the SQS queue Create an AWS Lambda function toprocess messages in the SQS queue Correct answer
C: Create an Amazon API Gateway REST API that implements the RESTful API Create a fleet of Amazon EC2 instances in an Auto Scaling group Create an API Gateway Auto Scaling group proxy integration Use the EC2 instances to process incoming data
D: Create an Amazon CloudFront distribution for the RESTful API Create a data stream in Amazon Kinesis Data Streams Set the data stream as the origin for the distribution Create an AWS Lambda function to consume and process data in the data stream
Correct Answer:
B. Create an Amazon API Gateway HTTP API that implements the RESTful API Create an Amazon Simple Queue Service (Amazon SQS) queue Create an API Gateway service integration with the SQS queue Create an AWS Lambda function toprocess messages in the SQS queue
Explanation

This solution provides a highly scalable and resilient architecture for handling unpredictable traffic bursts without data loss. Amazon API Gateway is a managed service designed to handle API traffic at scale. By using a direct AWS service integration, API Gateway can place incoming requests directly into an Amazon SQS queue. This decouples the API ingress from the backend processing. The SQS queue acts as a durable buffer, absorbing traffic spikes and ensuring that no data is lost. An AWS Lambda function is then triggered by messages in the SQS queue, providing a scalable, event-driven compute layer to process the data asynchronously. This serverless pattern is cost-effective and automatically scales with the workload.

Why Incorrect

A. This architecture is not valid. An Application Load Balancer (ALB) cannot directly add an SQS queue as a target for its target group. ALB targets must be instances, IP addresses, Lambda functions, or other ALBs.
C. This synchronous pattern is less resilient to unpredictable bursts. A sudden traffic spike could overwhelm the EC2 instances before the Auto Scaling group can react, leading to request throttling and potential data loss.
D. This architecture is not valid. Amazon CloudFront cannot use an Amazon Kinesis Data Stream as a direct origin. A CloudFront origin must be an accessible HTTP endpoint, such as an S3 bucket, an ELB, or API Gateway.

References

1. API Gateway to SQS Integration: AWS API Gateway Developer Guide, "Working with AWS service integrations for HTTP APIs". The guide details how to configure an integration to send requests to other AWS services, including SQS. The tutorial "Creating an HTTP API with an AWS service integration" provides a concrete example.

2. Decoupling with SQS: AWS Documentation, Amazon SQS Developer Guide, "Common Amazon SQS use cases". Section "Decouple microservices" explains how SQS queues can be used as a buffer between components of an application that may produce and consume messages at different rates, which is ideal for handling traffic bursts.

3. ALB Target Groups: AWS Documentation, Elastic Load Balancing User Guide for Application Load Balancers, "Target groups for your Application Load Balancers". This page lists the valid target types for an ALB target group as: instance, ip, lambda, and application-load-balancer. SQS is not a supported target type.

4. CloudFront Origins: AWS Documentation, Amazon CloudFront Developer Guide, "Working with origins". This section specifies that origins can be Amazon S3 buckets, MediaStore containers, MediaPackage channels, or custom origins (like an HTTP server, which includes an ELB or EC2 instance). Kinesis Data Streams is not a valid origin type.

Scroll to Top