Writing the foundation of a Lambda function

We can start our task with writing a Lambda function, which responds to S3 events and will resize the image. At this stage, the code will not resize the image, but it will only log the request, so first, we can see that the function is really triggered by S3.

As usual, we can create our new module with the name lambda-imageresizer:

    $ mkdir -p lambda-imageresize/src/main/java/com/      serverlessbook/lambda/imageresize 

Then, let's add this new module to our settings.gradle file:

    $ echo "include 'lambda-imageresizer'" >> settings.gradle  

We can now create our Handler class in the com.serverlessbook.lambda.imageresize package:

    $ touch lambda-imageresizer/src/main/java/com/serverlessbook/lambda/ imageresizer/Handler.java ...

Get Building Serverless Architectures now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.