Aktuelles

Dienstag, 20. Oktober 2020

AWS Lambda and Monitoring

I just recently came across Amazon’s serverless compute platform called Lambda. And without further ado, I gotta say it’s brilliant! Let alone that the Lambda sign (λ) kept on reminding me of the fabulous computer game back in the late 90s, this platform changed my mindset of a modern software architecture: When I started developing enterprise software, we wrote our backend web services following the Enterprise JavaBeans standard (EJB as it was called, they call it Jakarta Enterprise Beans now). It worked very well but resulted in quite amount of code. It was also tedious to control access at a function level, let alone the entity manager at the database access layer or the webserver that provides the runtime. However, it is 2020 and we have a former online book seller that needs to handle all of its online business in an efficient way – there has to be something…

And there is: At one of our customers, we had a requirement to provide an API endpoint that receives data via HTTP POST and forwards it to an AWS SNS topic, which, again, sends it to IBM Netcool via MessageBus probe. So the first version of that API was a Node.js express backend, using the AWS SDK to send alarms to an AWS EventBridge EventBus, which had an EventRule deployed to forward all incoming data to an SNS topic. Deployment was easy using AWS’ Elastic Beanstalk, but you can already grasp by the previous sentence, that there were a few components involved to get this running. During the deployment into customer’s account, their architect asked me why I didn’t write a lambda function for that. Bloody honest, I didn’t think about it. So I started doing that and came up with a solution that can’t be any simpler:

 

We have an API Gateway that exposes a POST route. Whenever that route is hit, a lambda function is triggered. Whatever that lambda function returns in response, is forwarded to an SNS topic. The only code I had to write (or reuse from my express app), was the part that validates the incoming data (using Joi) and handles all kinds of errors in a meaningful way. That’s it! Very straight-forward, isn’t it? Grant it, you need to configure some permissions and it is not for free (for pricing see https://aws.amazon.com/lambda/pricing/), but damn it was easy to get that code up and running! 

#aws #lambda #awslambda #innovation #nodejs #awscloud #awscloudexperience #awsdevops