What is the difference between AWS Lambda & AWS Elastic Beanstalk
Asked Answered
I

4

16

I am studying for my AWS Cloud Practitioner Certification and I am confused with the difference between AWS Lambda & AWS Elastic Beanstalk. From my understanding, for both services you upload your code to AWS and AWS essentially manages the underlying infrastructure for you.

I know with Lambda you upload your code to a 'Lambda Function' and set triggers for when the code executes.

With AWS EB you upload your application code and EB automatically handles the deployment, capacity, provisioning, etc...

They both sound very similar as you upload your code to both and both handle underlying instances/environments.

Thanks!

Insentient answered 28/3, 2021 at 22:20 Comment(3)
This might help you: entranceconsulting.com/aws/aws-lambda-vs-elastic-beanstalkLeaper
This also: acloud.guru/forums/aws-certified-solutions-architect-associate/…Leaper
The best place to ask and learn about aws certs is here old.reddit.com/r/AWSCertifications . They will be able to answer your question in detail in the context of the exam.Kerikeriann
H
34

Elastic beanstalk and lambda are very different though some of the features may look similar. At high level, elastic beanstalk deploys a long running application whereas lambda deploys short running code function

  1. Lambda can at maximum run for 15 minutes, whereas EB can run continuously. Generally, we deploy websites/apps on EB whereas lambda are generally used for triggered functionality like processing image when image gets uploaded to S3.

  2. Lambda can only handle one request at a time whereas number of concurrent requests EB can handle depends on your underlying infrastructure. So, if you are having say 100 requests, 100 lambdas will be created whereas these 100 requests can be handled by one underlying EC2 instance in EB

  3. Lambda is serverless (underlying infra is entirely abstracted from developer). Whereas EB is automation over infra provisioning. You can still see your EC2 instances, load balancer, auto scaling group etc. in your AWS console. You can even ssh/rdp to your instance and change running services. AWS EB allows you also to have your custom AMIs.

  4. Lambda is having issue of cold starts as in lambda, infra needs to be provisioned on demand by AWS, whereas in EB, you generally have EC2 instances already provisioned to handle your requests.

Haiduk answered 29/3, 2021 at 3:23 Comment(2)
On point 2: hasn't Lambda got concurrency though? I get your point about it creating multiple functions but from a utility point of view, I think we could still say Lambda handles concurrent requests.Sorenson
Great answer! This can help to understand point#2 better.Salpa
S
3

All great (and exam-specific) points by SmartCoder. If I may add a general ancillary comment:

Wittgenstein said, "In most cases, the meaning of a word is its use." I think this maxim is remarkably apt for software engineering too. In the context of your question, those two AWS services are used for significantly different purposes.

Lambda - Say you developed a photo uploading application with Node.js that uploads some processed images to an S3 bucket. The core logic for this is probably quite straightforward, and it's got a singular, distinct task. Simply take in an image, do some processing and if not for any exception, store it in a bucket. In this case, it's inefficient to waste time spinning up servers, configuring them with a runtime environment, downloading dependencies, maintenance, etc. A literal copy and paste of your code into the Lambda console while setting up a few configurations should get your job done. Plus, you save a lot of money as infrastructure is "provisioned" only when your Node.js function is invoked. Again, keep in mind the principle of this code performing a singular task.

Elastic Beanstalk - This same photo uploading system mentioned above might now mature into a more complex full-fledged software application that requires user management, authentication, and further processing of the images, which certainly requires more provisioning of resources. This application will probably do a lot of things with multiple code repositories for you to manage and deploy. And yet, you don't want to spend money on a DevOps engineer or learn to use an IaC (Infrastructure as Code) platform like CloudFormation or Terraform. In this case, Elastic Beanstalk is useful for a developer without too much in-depth DevOps knowledge as it's a PaaS (Platform as a Service) tool; it pretty much gives you a clear interface to spin up whole new production-ready systems.

Here are two good whitepapers I read a while back on the above topics. https://docs.aws.amazon.com/whitepapers/latest/serverless-architectures-lambda/serverless-architectures-lambda.pdf https://docs.aws.amazon.com/whitepapers/latest/introduction-devops-aws/introduction-devops-aws.pdf

Sorenson answered 10/6, 2022 at 1:40 Comment(0)
C
0

AWS Lambda is suitable for small, event-driven functions and microservices, while Elastic Beanstalk is better suited for deploying full-fledged web applications and services

Collyrium answered 8/6 at 17:36 Comment(0)
P
-4

Lambda is run based on specific trigger events.. and it exits as soon as its work is over.

Persia answered 18/4, 2022 at 9:31 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Engelbert

© 2022 - 2024 — McMap. All rights reserved.