Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Building Serverless Architectures

You're reading from   Building Serverless Architectures Unleash the power of AWS Lambdas for your applications

Arrow left icon
Product type Paperback
Published in Jul 2017
Publisher Packt
ISBN-13 9781787129191
Length 242 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Cagatay Gurturk Cagatay Gurturk
Author Profile Icon Cagatay Gurturk
Cagatay Gurturk
Arrow right icon
View More author details
Toc

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

In this Lambda function, we will consume standardized events prepared...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime