Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Serverless Computing: AWS Lambda

The serverless architecture used to be considered as the application dependent on third-party cloud services, which allows managing the server-side logic and state.

However, everything changes with the time and it’s defined by stateless compute containers as well as designed for an event-driven solution. In a microservice architecture, monolithic apps are broken down into smaller services. This allows developing, managing and scaling them independently. With Function as a service (FaaS), it goes even deeper as it breaks apps to the level of events and functions.

In this post, we’ll take a look at the serverless technology, which is known as AWS Lambda, consider its strong and weak sides and understand how to use it in practice.

What is AWS Lambda

AWS Lambda is an event-driven, serverless computing platform launched by Amazon web services in 2014. All the code is executed in Lamba upon configured event trigger.

You’ll be able to see the full potential of this technology if you work with integration. For example, you can easily integrate AWS Lambda with API Gateway, which provides a starting point for your IP address.

How does it work with Lambda? Having got a web request, it triggers events that will run our Lambda function.

Here’s a real-life example. You upload an image into Amazon Simple Storage Service (S3). Using Lambda function, you can easily (what is more importantly — automatically) resize this image for various devices including tablet, mobile, and desktop devices. The file, which you upload to S3, should trigger the Lambda function. And here we go, things are happening.

This means that you won’t need to host your application on a server. You can simply upload a function and call it whenever you want by using one of the many triggers necessary for initiating a function call. As a result, this allows you to call your functions only when you need to.

Everything has its strong and weak sides. And AWS Lambda is not an exception:

Pros:

Faster Development

Serverless architecture solves the challenge of system engineering. As a result, you’ll have to spend much less time on operational issues. This is great news for devops :)

Less Operational Costs

The basic and at the same time the biggest advantage of AWS Lambda is a reduction in operational costs.

You pay only for the execution time of your function as well as resources needed for its execution. So you’ll be getting your bill only when the function as a service (FaaS) is called.

As a result, you’ll be paying much less compared to running a server for a certain period of time.

Easier operational management

Scaling functionality of Function as a server allows reducing not only computational costs but also operational management overheads. Serverless platform draws a line between apps that run on the platform and infrastructure services.

Building the FaaS architecture is piece of cake if we compare it with building and deploying the entire server. Programmers can simply write their code just in the vendor console.

The thing is that FaaS or SOA (service oriented architecture) bring a new approach for dev teams, where every member of the team has to know and be responsible for each step of the delivery process including the operational support. That’s why AWS Lambda doesn’t require any system administration.

Cons:

No Control Over Environment

By the way, have you ever heard about cold or hot functions? This is how most Lambda functions operate. If a function was called after some time of “non-use,” this will result in a short delay before the function starts responding. These functions are also known as “cold functions.”

Nevertheless, if your gateway and caching front are properly configured, this won’t be a challenge at all. The time of a delay will be about a second. Will it hurt you? If not, go for it!

So you’ll need to spend a certain amount of time in order to make a function hot and get rid of delay.

Testing

Since there are not so many custom libraries or interfaces to implement, unit testing Serverless Apps is not a big deal. All you need is coding :)

Nevertheless, the situation is quite different when it comes to integration testing. The main challenge is that such vendors as vendors don’t provide any local implementation. This means you’ll have to use the regular production implementation. As a result, all the acceptance or integration tests would be deployed remotely.

AWS Lambda in Action

We can dwell in endless debated talking about strong and weak sides of this technology. Nevertheless, why need talking when we can take a look at how it works in action.

  • Backend optimization operations. Your website must be as user-friendly as possible. Lambda can help you with it as it can parse the visitor’s input for storing it in a database, while a website renders the next page.
  • Backups automation. Since functions can be called on schedule, it makes Lambda a perfect tool for repetitive tasks including backups creation, reports generating, checking for idle resources and so on.
  • Analyze the logs as you go. Lambda looks for the specific log entries and specific triggers that invoke an SNS notification as soon as such things happen. All the notifications may be easily sent to Slack, Jobber or other support systems.

Additionally, Function as a server is highly useful modern technology for event-based applications. You can build Software as a service (SaaS) on Lambdas.

  • Image-rich apps. Since AWS Lambda allows automatically optimizing the images for all screens without having to keep various versions on a server. As a result, this will allow decreasing the loading time of images.
  • Chatbots. Chatting bots should be able to mimic a real human conversation. The more users you have, the more scalable should be your app (without affecting your budget).
  • IoT applications. Imagine, you have an app that controls a security camera in your home. The camera shouldn’t continuously work to detect suspicious behavior. For this purpose, we have motion sensors. As soon as the sensors were triggered, they activate the camera (it’s cheaper and more user-friendly).
  • Log/Media processing. Thanks to serverless power, you won’t have to scale entire compute fleets to cope with heavy workloads. Serverless approach makes it much easier.

The Bottom Line

When we talk about serverless architecture, there are several ways to run our server-side systems as part of our applications.

The first way is Backend as a Service (BaaS), when we need to integrate the third party remote app services directly into the front-end of our apps.

The second one is Functions as a Service, “which moves server-side code from long-running components to ephemeral function instances.

Lambda is one of the most effective tools if we talk about the AWS ecosystem. There are tons of various user cases, where this technology can be applied. But the biggest and the most powerful advantage of Lambda is that it’s absolutely Free! This means that you won’t have to pay for devops, support, deploy. You won’t have to pay for anything.

Of course, there are some pitfalls too. For example, if your functions are not implemented well, things may go wrong. So if you chose Lambda, always make sure your functions are perfectly architectured and tested before publishing them live. Nevertheless, this drawback is only a little minus between dozens of fat pluses. So start using Lambda by your own and you’ll see.


Serverless Computing: AWS Lambda was originally published in JetRuby on Medium, where people are continuing the conversation by highlighting and responding to this story.



This post first appeared on JetRuby Agency - Featured Technical Stories Based In Our Experience, please read the originial post: here

Share the post

Serverless Computing: AWS Lambda

×

Subscribe to Jetruby Agency - Featured Technical Stories Based In Our Experience

Get updates delivered right to your inbox!

Thank you for your subscription

×