Question

Difficulty: MediumServerless and Automated Scaling Architectures for Cost Efficiency

A logistics company is designing an architecture to process batch data files containing shipment logs uploaded to Amazon S3. The processing of each batch file is a compute-intensive operation that takes approximately 20 minutes to complete. The files are uploaded sporadically throughout the day with highly unpredictable traffic spikes, including long periods of no activity. The company wants a serverless, cost-optimized solution that automatically scales based on demand and minimizes costs during idle periods. Which architecture meets these requirements most cost-effectively?

  1. A
    Configure Amazon S3 to trigger an AWS Lambda function directly for each upload to run the processing application, writing results back to Amazon S3.
  2. B
    Configure Amazon S3 to send event notifications to an Amazon SQS queue. Run the processing application on a fleet of Amazon EC2 instances in an Auto Scaling group with a minimum capacity of two instances, storing execution state in an Amazon DynamoDB table configured with high Provisioned Capacity mode to handle sudden peaks.
  3. Configure Amazon S3 to send event notifications to an Amazon Simple Queue Service (Amazon SQS) queue. Run the processing application as containerized tasks in Amazon Elastic Container Service (Amazon ECS) on AWS Fargate Spot, scaling the number of tasks dynamically based on the queue depth, and use a Gateway VPC Endpoint for Amazon S3 traffic.Answer
  4. D
    Configure Amazon S3 to send event notifications to an Amazon Simple Queue Service (Amazon SQS) queue. Run the processing application on AWS Fargate tasks launched in a private subnet, routing all data transfer to and from Amazon S3 through a NAT Gateway.

Answer

Configure Amazon S3 to send event notifications to an Amazon Simple Queue Service (Amazon SQS) queue. Run the processing application as containerized tasks in Amazon Elastic Container Service (Amazon ECS) on AWS Fargate Spot, scaling the number of tasks dynamically based on the queue depth, and use a Gateway VPC Endpoint for Amazon S3 traffic.
The correct answer combines AWS Fargate Spot (which provides serverless container execution at a steep discount) with an SQS-based scaling policy that allows the environment to scale down to zero tasks when no logs are waiting to be processed. Additionally, using a Gateway VPC Endpoint for Amazon S3 ensures that the high-volume data transfer between the Fargate tasks and S3 does not incur NAT Gateway data processing charges.

Step-by-Step Solution

1
Evaluate the execution duration against AWS serverless compute limitations.
The processing job takes 20 minutes, which exceeds the 15-minute execution limit of AWS Lambda, necessitating a containerized approach like AWS Fargate.
AWS Lambda is disqualified due to the hard timeout constraint, requiring Amazon ECS or EKS on Fargate for serverless execution.
2
Select the most cost-effective compute capacity and scaling strategy.
AWS Fargate Spot capacity provider combined with SQS queue-depth auto-scaling is selected.
Fargate Spot offers up to a 70% discount compared to regular Fargate pricing. Auto-scaling based on queue depth allows the task count to scale to zero when there are no files to process, avoiding idle capacity costs.
3
Optimize data transfer costs between the private compute tasks and Amazon S3.
A Gateway VPC Endpoint for Amazon S3 is chosen to handle the file transfers.
Routing S3 traffic through a NAT Gateway incurs expensive hourly and per-GB data processing charges. A Gateway VPC Endpoint is free and keeps traffic within the AWS network.

Key Concept

Serverless and Automated Scaling Architectures for Cost Efficiency
Estimated Time:1m 30s
Rate this question