Serverless Architecture-Blog-2 (AWS Lambda)

In our last blog, we have seen the serverless introduction, Continuing that in this blog we will implement serverless using AWS lambda.

images

AWS Lambda is a compute service that lets you run code without provisioning or managing servers. AWS Lambda executes your code only when needed and scales automatically, from a few requests per day to thousands per second.You pay only for the compute time you consume – there is no charge when your code is not running. With AWS Lambda, you can run code for virtually any type of application or backend service – all with zero administration. AWS Lambda supports currently Node.js, Java, C# and Python.

You pay only for the compute time you consume – there is no charge when your code is not running. With AWS Lambda, you can run code for virtually any type of application or backend service – all with zero administration. AWS Lambda supports currently Node.js, Java, C# and Python.

You can use AWS Lambda to run your code in response to events, such as changes to data in an Amazon S3 bucket or an Amazon DynamoDB table etc.

Now we will build a mailer application in scala and put that application in AWS Lambda with AWS S3 PutObject triggered.

Step 1:  Create a lambda blank function

Screenshot from 2017-04-01 02-02-45

Step 2: Configure triggers
Screenshot from 2017-03-31 01-56-03

Step 3: Configure function, choose JAVA 8 language.

Screenshot from 2017-04-01 01-37-55
Step 4: Upload your executable jar and set environmental variables.

Note:  You can find the sample project from here AWS-Lambda-Scala-Mailer

Steps to make executable jar:

  • git clone https://github.com/knoldus/AWS-Lambda-Scala-Mailer.git
  • cd AWS-Lambda-Scala-Mailer
  • sbt assembly

Screenshot from 2017-04-01 01-38-25.png
Step 5: Set Lambda function handler and role.

Screenshot from 2017-04-01 01-42-20

Then Click next your Lambda-scala-mailer is ready. This function will get triggered with S3 action.

If you find any challenge, Do let me know in the comments.

Stay tuned for the next blog on serverless. Till then Happy coding. 🙂

References:  https://aws.amazon.com/

Written by 

Joseph Ross is a Principal Consultant at Knoldus Inc. having more than 10 years of experience. Joseph has a passion for identifying challenges and give impactful solutions to the clients. He is a football fan and loves to watch TV series. Joseph has a cross-functional business operations and technology consulting experience. Joseph is familiar with programming languages such as Scala, C++, Java, CSS and HTML.

6 thoughts on “Serverless Architecture-Blog-2 (AWS Lambda)

  1. F*ckin’ awesome issues here. I’m very happy to look your article. Thanks a lot and i’m looking forward to contact you. Will you kindly drop me a mail?

Leave a Reply

%d bloggers like this: