A company uses an AWS Batch job to run its end-of-day sales process. The company needs a serverless solution that will invoke a third-party reporting application when the AWS Batch job is successful. The reporting application has an HTTP API interface that uses username and password authentication.
Which solution will meet these requirements?
A. Configure an Amazon EventBridge rule to match incoming AWS Batch job SUCCEEDED events. Configure the third-party API as an EventBridge API destination with a username and password. Set the API destination as the EventBridge rule target.
B. Configure Amazon EventBridge Scheduler to match incoming AWS Batch job SUCCEEDED events. Configure an AWS Lambda function to invoke the third-party API by using a username and password. Set the Lambda function as the EventBridge rule target.
C. Configure an AWS Batch job to publish job SUCCEEDED events to an Amazon API Gateway REST API. Configure an HTTP proxy integration on the API Gateway REST API to invoke the third-party API by using a username and password.
D. Configure an AWS Batch job to publish job SUCCEEDED events to an Amazon API Gateway REST API. Configure a proxy integration on the API Gateway REST API to an AWS Lambda function. Configure the Lambda function to invoke the thirdparty API by using a username and password.
A
技巧:排除明显错误选项,在没有明显错误的选项中选择最合理的选项。
A. 正确。配置一个 Amazon EventBridge 规则以匹配传入的 AWS Batch 作业成功事件。将第三方 API 配置为 EventBridge API 目标,并设置用户名和密码。将该 API 目标设置为 EventBridge 规则的目标。该方案利用 EventBridge 捕获 Batch 作业成功事件,并且 EventBridge 支持直接将外部 API 配置为目标,能在规则匹配事件时直接调用第三方 API,同时支持在配置 API 目标时设置用户名和密码进行身份验证,完全满足无服务器触发和调用带身份验证 API 的要求,是可行的方案。
B. 不正确。配置 Amazon EventBridge Scheduler 以匹配传入的 AWS Batch 作业成功事件。配置一个 AWS Lambda 函数,使用用户名和密码调用第三方 API。将该 Lambda 函数设置为 EventBridge 规则的目标。EventBridge Scheduler 主要侧重于计划任务,不是专门用于捕获实时事件(如 Batch 作业成功事件)的最佳工具。通常应使用 Amazon EventBridge 来捕获此类事件,所以该方案在事件触发机制选择上不合适,不满足要求。
C. 不正确。配置 AWS Batch 作业将作业成功事件发布到 Amazon API Gateway REST API。在 API Gateway REST API 上配置 HTTP 代理集成,使用用户名和密码调用第三方 API。让 AWS Batch 作业直接发布事件到 API Gateway 不是常见的做法,Batch 作业本身不具备直接与 API Gateway 交互发布事件的功能,实现起来复杂且不符合常规架构设计。通常使用 EventBridge 等事件总线服务来捕获和处理事件,所以该方案不可行。
D. 不正确。配置 AWS Batch 作业将作业成功事件发布到 Amazon API Gateway REST API。在 API Gateway REST API 上配置到 AWS Lambda 函数的代理集成。配置 Lambda 函数使用用户名和密码调用第三方 API。该方案与选项 C 类似,让 Batch 作业直接发布事件到 API Gateway 不合理且难以实现。而且此方案引入了不必要的复杂层级,使用 EventBridge 直接捕获事件并调用 API 或 Lambda 函数更为简洁高效,所以该方案也不符合要求。