Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the AWS SDK V2 class for Lambda S3Event?

For the Java SDK V1, I have a lambda function like this:

public static void doSomethingLambda(S3Event s3Event) throws Exception {
    s3Event....

however in SDK V2, S3Event does not seem to exist. Unless I am using the wrong dependency? (The docs for V2 are pretty sparse)

Here is my SDK V1 Dependencies:

  <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-lambda-java-events</artifactId>
        <version>1.3.0</version>
    </dependency>

    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk-s3</artifactId>
        <version>1.11.534</version>
    </dependency>

and SDK V2:

 <dependency>
        <groupId>software.amazon.awssdk</groupId>
        <artifactId>s3</artifactId>
    </dependency>
    <dependency>
        <groupId>software.amazon.awssdk</groupId>
        <artifactId>lambda</artifactId>
    </dependency>
like image 298
Wayneio Avatar asked Apr 16 '19 14:04

Wayneio


People also ask

What is AWS SDK v2?

The AWS SDK for Java 2.0 is a rewrite of 1.0 with some great new features. As with version 1.0, it enables you to easily work with Amazon Web Services but also includes features like non-blocking IO and pluggable HTTP implementation to further customize your applications.

Can I use AWS SDK in Lambda?

To integrate the latest version of an AWS SDK into your Lambda function's deployment package, create a Lambda layer, and then add it to your function. You can use either the AWS Command Line Interface (AWS CLI) or the Lambda console to create a Lambda layer and add it to your function.

What is AWS Java SDK Lambda?

You can run Java code in AWS Lambda. Lambda provides runtimes for Java that run your code to process events. Your code runs in an Amazon Linux environment that includes AWS credentials from an AWS Identity and Access Management (IAM) role that you manage. Lambda supports the following Java runtimes.

What is Lambda SDK?

The Lambda API Reference provides information about each of the API methods, including details about the parameters in each API request and response. You can use Software Development Kits (SDKs), Integrated Development Environment (IDE) Toolkits, and command line tools to access the API.


1 Answers

According to the resolution provided on 18 May for aws lambda java libs to aws sdk java v2

aws-lambda-java-events version 3.0.0 was just released with support for all events (including S3) without the inclusion of SDK v1 dependencies.
This should help you make use of the AWS SDK for Java v2 and reduce your function package size as the v1 SDK does not need to be bundled anymore if it's not explicitly needed.

Source code is here

like image 63
Mohan Radhakrishnan Avatar answered Oct 13 '22 00:10

Mohan Radhakrishnan