Question

Difficulty: Very hardServerless and Automated Scaling Architectures for Cost Efficiency

A logistics company is designing an architecture to process telemetry data from its fleet of delivery vehicles. The telemetry data contains status updates that must be processed in the exact sequence they are generated per vehicle to ensure accurate route mapping. The ingestion volume is highly irregular, peaking during daytime deliveries and dropping to zero overnight. Each processing run involves executing a route optimization simulation that takes approximately 20 minutes to complete. The company wants a highly cost-efficient, serverless, and automated scaling solution that preserves message ordering, handles the database writes dynamically, and eliminates idle compute costs. Which architecture meets these requirements?

  1. Ingest the telemetry data using Amazon API Gateway and write to an Amazon SQS FIFO queue. Process the queue using Amazon ECS tasks running on AWS Fargate Spot that scale dynamically based on the queue depth and scale down to zero when the queue is empty, storing the results in an Amazon DynamoDB table in On-Demand capacity mode.Answer
  2. B
    Ingest the telemetry data using Amazon API Gateway and write to an Amazon SQS Standard queue. Process the queue using Amazon ECS tasks running on AWS Fargate Spot that scale dynamically based on CPU utilization, storing the results in an Amazon DynamoDB table in On-Demand capacity mode.
  3. C
    Ingest the telemetry data using Amazon API Gateway and write to an Amazon SQS FIFO queue. Process the messages using an AWS Lambda function triggered by the queue, storing the results in an Amazon DynamoDB table in On-Demand capacity mode.
  4. D
    Ingest the telemetry data using Amazon API Gateway and write to an Amazon SQS FIFO queue. Process the queue using Amazon ECS tasks running on AWS Fargate Spot that scale dynamically based on the queue depth, storing the results in an Amazon DynamoDB table in Provisioned Capacity mode with Auto Scaling.

Answer

The architecture that uses Amazon API Gateway to ingest data, an Amazon SQS FIFO queue to preserve sequence, Amazon ECS on AWS Fargate Spot to process the 20-minute simulation with auto-scaling to zero, and Amazon DynamoDB in On-Demand capacity mode to handle spiky database writes.
The correct architecture uses Amazon SQS FIFO to ensure that telemetry status updates are processed in the exact sequence they are generated per vehicle (using the vehicle ID as the Message Group ID). Since each processing run takes 20 minutes, using AWS Fargate Spot is the most cost-effective and scalable compute option, as it supports long-running processes (unlike AWS Lambda's 15-minute execution limit) and saves up to 70% compared to standard Fargate tasks. Scaling the ECS service to zero when the queue is empty eliminates idle compute costs. Finally, Amazon DynamoDB in On-Demand capacity mode is ideal for highly irregular workloads with overnight idle periods, as there is no baseline capacity charge and it scales instantly to handle peak traffic.

Step-by-Step Solution

1
Evaluate the execution duration requirement against serverless compute limits.
The simulation takes 20 minutes to execute. Since AWS Lambda has a maximum execution limit of 15 minutes, containerized execution on Amazon ECS (or AWS Batch) must be selected instead of Lambda to avoid timeouts.
AWS Lambda is not suitable for continuous, long-running processes exceeding 15 minutes.
2
Evaluate message ordering requirements.
The status updates must be processed in the exact sequence they are generated per vehicle. An Amazon SQS FIFO queue must be used, using the vehicle ID as the Message Group ID to ensure sequential processing for each vehicle while enabling parallel processing across different vehicles.
Amazon SQS Standard queues do not guarantee first-in, first-out (FIFO) ordering.
3
Evaluate compute cost efficiency for the highly irregular, zero-overnight traffic pattern.
Amazon ECS on AWS Fargate Spot should be used. The tasks should be configured to scale based on SQS queue metrics and scale down to zero when the queue is empty, avoiding compute charges during idle hours.
Fargate Spot offers up to a 70% discount compared to standard Fargate, and scaling to zero tasks when idle eliminates baseline compute costs.
4
Evaluate database capacity scaling and cost optimization.
Amazon DynamoDB should be configured in On-Demand capacity mode to automatically handle spikes in write traffic without manual capacity planning, and to avoid any baseline capacity costs when traffic drops to zero overnight.
DynamoDB Provisioned Capacity mode with Auto Scaling cannot scale down to zero and suffers from scaling delays, leading to either write throttling or excessive idle resource costs.

Key Concept

Decoupling and scaling serverless architectures cost-effectively for spiky, long-running, and ordered workloads.
Estimated Time:3m 0s
Rate this question