In our last blog, we have seen the serverless introduction, Continuing that in this blog we will implement serverless using AWS lambda.
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
Step 2: Configure triggers
Step 3: Configure function, choose JAVA 8 language.
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
Step 5: Set Lambda function handler and role.
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.
6 thoughts on “Serverless Architecture-Blog-2 (AWS Lambda)2 min read”
Thanks for sharing such a wonderful information with us.
Reblogged this on LearningPool.
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?
Sure Alex, email@example.com
Comments are closed.