问题描述
我正在尝试按照此处.其中描述了RequestHandler
接口的实现,还引用了aws-lambda-java-core库.但是,我尝试在推荐的此处中使用最新的SDK,但这是完全不同的并且RequestHandler
界面似乎不再存在.
I'm trying to develop a AWS Java lambda function by following the guidance described here. In it it describes the implementation of the RequestHandler
interface and also references the aws-lambda-java-core library. However I am trying to use the latest SDK as recommended here but this is completely different and the RequestHandler
interface doesn't appear to exist anymore.
我不清楚我需要什么Java库的名称和版本.是否有关于所有不同版本的AWS Java库的指南以及任何更新的示例.我必须承认,我对AWS Java库的版本和命名感到完全困惑,并且不完全知道要在Java中创建一个简单的AWS Lambda函数,我需要添加哪些/什么作为依赖项.
It's not clear to me what the name and version of the java libraries I need. Is there any guidance on all the different versions of the AWS java libraries there are and any updated examples. I have to admit I am completely confused by the AWS Java library versions and naming and don't entirely know which/what I need to add as a dependency just to create a simple AWS lambda function in Java.
推荐答案
您使用了错误的依赖项.这是一个可通过其REST API使用AWS Services的SDK,例如:
You're using wrong a dependency. This is an SDK for using AWS Services via its REST API, like:
- 将对象放入S3
- 列出EC2实例
- 从AWS DynamoDB删除项目
- 调用Lambda
- …
- Putting an object to S3
- Listing EC2 instances
- Deleting an item from AWS DynamoDB
- Invoking a Lambda
- …
即这是一个用于处理各种AWS服务的SDK.它包含许多库,例如 aws-java-sdk-s3
, aws-java-sdk-dynamodb
. aws-java-sdk-lambda
是其中之一,但是它是用于与Lambda API进行交互,而不是用于编写Lambda.
I.e. this is an SDK for working with various AWS services. It consists of many libraries, like aws-java-sdk-s3
, aws-java-sdk-dynamodb
. aws-java-sdk-lambda
is one of them, but it is for interacting with Lambda API and not for authoring Lambdas.
创作Lambda所需的库为:
The libraries you need for authoring Lambdas are:
如您所见,它们是不同的.首先提供您要查找的Handler
接口,其次包含Lambda可以接受作为输入的各种事件:SNS事件,CloudWatch计时器和等等.
As you see, those are different. First provides Handler
interfaces you're looking for and second contains various events Lambda can accept as input: SNS events, CloudWatch timers and so on.
这篇关于用于创建Lambda的AWS Java SDK版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!