top of page
Search

10 Reasons why YOU should use AWS Lamba

  • Writer: Logan Seo
    Logan Seo
  • Nov 19, 2021
  • 6 min read


Here is a little background about AWS Lambda before we dig in!


Amazon's serverless computing service is known as AWS Lambda. It allows you to run your code without needing to maintain servers or containers. It will automatically scale based on how much work you supply it.


It may be used in data pipelines, to answer to web requests, and even to write and send emails. It's a jack-of-all-trades approach to running code in the AWS cloud.


Although Lambdas are designed to be used on the cloud, you may easily use them locally during development. You'll only pay for what you use when you run Lambdas on the cloud.


When compared to the cost of operating VMs or containers, this can save considerable amounts of money in some circumstances.

Let's begin with a high-level introduction of AWS Lambda before delving more into what this service is, how it works, and what makes it so appealing. Following that, I've listed more detailed use cases.


Following that, I've discussed some of AWS Lambda's restrictions, so you're aware of cases when it might not suit so well. Lastly, the article concludes by summarizing the post and giving a few concluding thoughts.



Why Should You Care About AWS Lambda?


I've outlined AWS Lambda and listed a few features in the introduction. Now let's delve a little further into it. If you're already familiar with the service... well, you can skip ahead!


AWS Lambda is a service that enables developers and software firms to run code without the need to set up and manage servers, a practice known as "serverless architecture." How does it function?


In a nutshell, you provide the code for your function to AWS, and they execute it. In a "pay as you go" paradigm, you only pay for the time the function is actually performed. That's all there is to it.


As a result, using AWS Lambda eliminates the requirement for traditional computing services and infrastructure. The cost and complexity of your IT operations are considerably reduced, development periods are shortened, and scalability is simplified.


You may argue that the advantages I've just listed aren't unique to AWS Lambda, but rather are shared by other serverless alternatives. You'd be correct. However, let me change your mind with these 10 reasons below.



1. Major Coding Languages are Supported!

  • Python

  • Java

  • Go

  • C#

  • Node.js

Although you may be accustomed to writing in these languages in a formal manner, keep in mind that Lambdas are stateless. They only run your function once and then discard everything. You'll be able to persist and keep the state in your database, but for transactions, you'll do it all at once.


Don't worry if your preferred language isn't supported right away. AWS allows you to offer your own custom runtime!



2. No Need to Manage Infrastructure


Flipped a server upside down to fix a problem with a server patch? Would you want to spend a significant amount of your time as a developer maintaining servers? Or would you rather be coding up some useful stuff?


The advantage of not needing to manage infrastructure is that you can spin up a new Lambda without adding a new resource to your infrastructure.


It's an excellent technique to extend your existing infrastructure or to launch new services in a microservices architecture. You also don't have to worry about scalability because there is no infrastructure to manage. AWS Lambda grows automatically to meet the volume of incoming requests, with no configuration required. There is no limit to the amount of requests your code may process; yet, performance remains constant.



3. Connects to API Gateway and Other Connection Points


The API Gateway serves as a doorway to your environment within AWS. It can connect directly to many cloud services, but when you need flexibility, Lambda is your best bet.


As you can see, it's where you write custom code to handle API Gateway queries. When you need to access many services or do custom processing, use a Lambda.


Lambdas are used to run custom code on data streams as it moves through services. This is important in a Kinesis Pipeline that receives data from sensors such as IoT.


Aside from that, Lambdas may link to a plethora of other AWS services. It essentially serves as a connection between such services.



4. Direct Online Editing


There is an online editor in the Lambda interface on the AWS web console for some of the supported languages (JavaScript and Python). The web browser can be used to code and edit the function.


This implies you can use your mobile device to build or amend a Lambda. It also saves each version and allows you to switch between new and old versions. Y


Don't misunderstand me. You can still develop and change functions on your local machine and deploy them using a variety of deployment mechanisms.


It's only that you can find yourself in a position where you need to write a function but don't have access to your preferred IDE.



5. Pay for What You Use


The billing for Lambda functions is done in 100 ms increments.


Surprisingly, when the expenses are considered, this creates an incentive to employ more efficient code. You can also adjust the maximum resource utilization of each Lambda, which influences the base price for function executions.


Consider a function that merely logs an Amazon Cognito permission to get a sense of how much it would cost. This Node.js method just does the following with a minimum memory setting of 128 MB:

console.log(JSON.stringify(event));

This code logs to an AWS S3 bucket. It runs in less than 100 milliseconds, hence the execution time charged for each run is 100 milliseconds. The projected charges for 5 million Lambda function executions per month are roughly $1.



6. Run AWS Lambda Locally


AWS has released the SAM (serverless architecture model) CLI. This is the tool for locally operating serverless architectures, the heart of which are Lambdas.


To define the application, use SAM to generate a CloudFormation template. The template is written in YAML, so it's about as clean as it gets.


The Lambda can then be invoked locally via the SAM CLI. Just provide to the Lambda either the output of a SAM CLI "generate-event" command or a JSON file containing static data. Python, Docker, and the AWS CLI are required for SAM.


The serverless framework is another alternative for running Lambdas locally. Using Node.js, the serverless framework emulates AWS. When it comes to Lambdas, it has some limitations: it can only run Node.js, Python, and Java functions.



7. Support for Strong Security


Cloud security is critical for any service, and AWS Lambdas are no exception.


AWS is in charge of securing the infrastructure that runs lambdas, while the developer is in charge of the services that will trigger execution and the services that the functions will contact.


Use IAM security fine-grained access policies in the same way that you would for any other AWS service. Identity and Access Management (IAM) is an Amazon Web Services (AWS) solution that allows administrators to securely regulate access to AWS Lambdas.



8. Orchestrate Using AWS Step Function


AWS Step Functions allows us to combine several AWS services into serverless workflows, allowing you to easily build and update apps. It also lets you to construct workflows that use sequential, parallel, branching, and error-handling steps to trigger Lambda functions.


Step Functions use State Machines to run a Lambda function through a number of steps, with the output of one step acting as input into the next. It supports looping, branching, waiting, timeouts, retries on failure, and so on.



9. Event Driven


AWS Lambda functions are only called when a specific message or event occurs. An event can be anything from an object being uploaded to an S3 bucket to a row being deleted from a DynamoDB table to an HTTP call to a function.



10. Leverage Pre-Built Serverless Apps

AWS Serverless Application Repository is a controlled repository provided by Amazon that allows developers and teams to exchange and store reusable serverless apps.


By leveraging existing components and apps, your team or organization may avoid reinventing the wheel and directly deploy them to your serverless architectures, eliminating the need to clone a repository, construct an application, and publish it somewhere.



Limitations (uh oh)


The size of the Lambda function deployment package is limited to 50MB when it is already zipped. Furthermore, the maximum number for function timeout is 900 seconds (15 minutes), with the default being 3 seconds.


Another significant restriction of AWS Lambda is the overhead associated with invoking the function for the first time, sometimes known as "cold start." According to the AWS document linked here, a cold-start added approximately 650ms to the overall performance.

The other limits, in general, are more about the serverless architecture itself, which lends itself well to shorter-lived apps. As a result, Lambda functions are short-lived, forcing you to rely on other services for durability, such as the previously mentioned DynamoDB.


Monitoring is a final potential drawback of AWS Lambda. As previously said, it exclusively logs to CloudWatch, which may provide some friction for your monitoring needs. Fortunately, if you use Scalyr's log management system, this is not a problem. Scalyr, among other useful features, allows you to import CloudWatch logs, giving you a centralized view of your serverless architecture.


Ending Note


Whatever method you use to run Lambdas, they may be the way to go for designing serverless apps.


You may build them in different languages, link several AWS components, and only pay for what you use—all without having to manage any infrastructure.


You only need to code the function, configure it, and deploy it. These 10 arguments should be more than enough to persuade you to use AWS Lambda!

 
 
 

Comments


© 2021 by Logan

bottom of page