A company is designing an application. The application uses an AWS Lambda function to receive information through Amazon API Gateway and to store the information in an Amazon Aurora PostgreSQL database. During the proof-of-concept stage, the company has to increase the Lambda quotas significantly to handle the high volumes of data that the company needs to load into the database. A solutions architect must recommend a new design to improve scalability and minimize the configuration effort.
Which solution will meet these requirements?
A. Refactor the Lambda function code to Apache Tomcat code that runs on Amazon EC2 instances. Connect the database by using native Java Database Connectivity (JDBC) drivers.
B. Change the platform from Aurora to Amazon DynamoDB,provision a DynamoDB Accelerator (DAX) cluster. Use the DAX client SDK to point the existing DynamoDB API calls at the DAX cluster.
C. Set up two Lambda functions. Configure one function to receive the information. Configure the other function to load the information into the database. Integrate the Lambda functions by using Amazon Simple Notification Service (Amazon SNS).
D. Set up two Lambda functions. Configure one function to receive the information. Configure the other function to load the information into the database. Integrate the Lambda functions by using an Amazon Simple Queue Service (Amazon SQS) queue.
D
技巧:排除明顯錯誤選項,在沒有明顯錯誤的選項中選擇最合理的選項。
一家公司正在設計一個應用程序,該應用程序使用 AWS Lambda 函數通過 Amazon API Gateway 接收信息,并將信息存儲在 Amazon Aurora PostgreSQL 數據庫中。在概念驗證階段,公司需要顯著提高 Lambda 的配額以處理需要加載到數據庫中的大量數據。解決方案架構師必須推薦一種新的設計,以提高可擴展性并減少配置工作量。
A. 不正確。將 Lambda 函數代碼重構為在 Amazon EC2 實例上運行的 Apache Tomcat 代碼。使用原生 Java 數據庫連接(JDBC)驅動程序連接數據庫。這種方法將無服務器架構(Lambda)改為傳統的服務器架構(EC2),增加了基礎設施的管理復雜性,需要手動配置和管理 EC2 實例,增加了配置工作量,而且無法直接解決 Lambda 配額限制的問題,因為問題在于 Lambda 的并發執行限制,而不是代碼本身。該解決方案增加了配置工作量,且未直接解決可擴展性問題。
B. 不正確。將平臺從 Aurora 改為 Amazon DynamoDB,部署一個 DynamoDB Accelerator(DAX)集群。使用 DAX 客戶端 SDK 將現有的 DynamoDB API 調用指向 DAX 集群。這種方法涉及將數據庫從關系型數據庫(Aurora PostgreSQL)改為 NoSQL 數據庫(DynamoDB),這需要大量代碼重構。DAX 主要用于提高 DynamoDB 的讀取性能,而不是解決 Lambda 的并發限制。更換數據庫平臺可能會引入新的復雜性和兼容性問題。該方案涉及數據庫遷移,增加了復雜性和配置工作量。
C. 不正確。設置兩個 Lambda 函數。一個函數用于接收信息,另一個函數用于將信息加載到數據庫。通過 Amazon Simple Notification Service(Amazon SNS)集成 Lambda 函數。使用 SNS 進行 Lambda 之間的集成是可行的,但 SNS 是發布 / 訂閱模型,適合廣播消息,而不是有序的消息傳遞。對于需要順序處理的數據加載場景,SNS 可能無法保證消息的順序和可靠性。配置 SNS 和 Lambda 的集成可能需要額外的配置工作。
D. 正確。設置兩個 Lambda 函數。一個函數用于接收信息,另一個函數用于將信息加載到數據庫。通過 Amazon Simple Queue Service(Amazon SQS)隊列集成 Lambda 函數。SQS 支持高吞吐量和可擴展性,可以處理大量消息,使用 SQS 作為消息隊列,可以解耦 Lambda 函數,提高可擴展性。AWS 提供了內置的觸發器支持配置 SQS 和 Lambda 的集成相對簡單。可以輕松調整隊列的吞吐量,而無需修改 Lambda 的配額。該方案提高了可擴展性,且配置工作量相對較低。