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/

Advertisements
This entry was posted in Amazon, AWS, AWS Services, Microservices, S3, Scala and tagged , , . Bookmark the permalink.

4 Responses to Serverless Architecture-Blog-2 (AWS Lambda)

  1. Thanks for sharing such a wonderful information with us.

  2. Pingback: Rackspace Adds Professional Services for AWS Cloud - Hosting Journalist

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s