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 的配额。该方案提高了可扩展性,且配置工作量相对较低。