A company is designing an application where users upload small files into Amazon S3. After a user uploads a file, the file requires one-time simple processing to transform the data and save the data in JSON format for later analysis. Each file must be processed as quickly as possible after it is uploaded. Demand will vary. On some days, users will upload a high number of files. On other days, users will upload a few files or no files.
Which solution meets these requirements with the LEAST operational overhead?
A. Configure Amazon EMR to read text files from Amazon S3. Run processing scripts to transform the data. Store the resulting JSON file in an Amazon Aurora DB cluster.
B. Configure Amazon S3 to send an event notification to an Amazon Simple Queue Service (Amazon SQS) queue. Use Amazon EC2 instances to read from the queue and process the data. Store the resulting JSON file in Amazon DynamoDB.
C. Configure Amazon S3 to send an event notification to an Amazon Simple Queue Service (Amazon SQS) queue. Use an AWS Lambda function to read from the queue and process the data. Store the resulting JSON file in Amazon DynamoDB.
D. Configure Amazon EventBridge (Amazon CloudWatch Events) to send an event to Amazon Kinesis Data Streams when a new file is uploaded. Use an AWS Lambda function to consume the event from the stream and process the data. Store the resulting JSON file in an Amazon Aurora DB cluster.
C
一家公司正在設計一個應用程序,用戶將小文件上傳到Amazon S3。用戶上傳文件后,該文件需要進行一次性簡單處理以轉換數據,并將數據以JSON格式保存以供后續分析。每個文件上傳后必須盡快處理。需求會有所變化。某些天用戶會上傳大量文件。其他日子用戶可能只上傳少量文件或不上傳。
本題要求設計一個解決方案,用于處理用戶上傳到Amazon S3的小文件,進行簡單數據處理并存儲為JSON格式,需滿足文件上傳后盡快處理,且能應對不同上傳量的情況,同時要求運營開銷最小。
本題關鍵在于選擇一種能夠根據文件上傳量自動擴展處理能力,且運營管理簡單的架構。需要考慮事件觸發機制、處理邏輯的執行方式以及數據存儲的合適選擇。
技巧:排除明顯錯誤選項,在沒有明顯錯誤的選項中選擇最合理的選項。
A. 不正確。配置Amazon EMR從Amazon S3讀取文本文件。運行處理腳本轉換數據。將生成的JSON文件存儲在Amazon Aurora數據庫集群中。Amazon EMR主要用于大規模數據處理,通常用于處理大量數據的復雜場景。對于這種小文件的一次性簡單處理,使用EMR過于復雜,成本較高,且運營管理難度大,不符合最小運營開銷的要求。
B. 不正確。配置Amazon S3向Amazon Simple Queue Service(Amazon SQS)隊列發送事件通知。使用Amazon EC2實例從隊列讀取數據并進行處理。將生成的JSON文件存儲在Amazon DynamoDB中。使用EC2實例需要手動管理實例的啟動、停止和擴展,以應對不同的文件上傳量。這增加了運營管理的復雜性,并且當文件上傳量較少時,EC2實例可能閑置,造成資源浪費,運營開銷較大。
C. 正確。配置Amazon S3向Amazon Simple Queue Service(Amazon SQS)隊列發送事件通知。使用AWS Lambda函數從隊列讀取數據并進行處理。將生成的JSON文件存儲在Amazon DynamoDB中。當文件上傳到S3時,S3可以觸發事件通知到SQS隊列。Lambda函數作為無服務器計算服務,可以根據隊列中的消息自動觸發并擴展,無需手動管理服務器。處理完成后,將結果存儲在DynamoDB中,DynamoDB是一種無服務器數據庫,也能自動擴展。這種方案能夠很好地應對不同的文件上傳量,且運營開銷最小。
D. 不正確。配置Amazon EventBridge(Amazon CloudWatch Events)在上傳新文件時向Amazon Kinesis Data Streams發送事件。使用AWS Lambda函數從流中消費事件并處理數據。將生成的JSON文件存儲在Amazon Aurora數據庫集群中。雖然Lambda函數可以自動擴展,但Kinesis Data Streams主要用于實時數據流處理,對于這種小文件的簡單處理場景,引入Kinesis Data Streams增加了架構的復雜性,運營管理難度較大,且成本可能較高。