AWS EC2 vs Lambda | Whats the difference? Pros and Cons?
HTML-код
- Опубликовано: 11 июл 2024
- In this video, I explain to you the difference between AWS EC2 and Lambda and how to decide between the two in your project.
Looking to get hands on experience building on AWS with a REAL project? Check out my course - The AWS Learning Accelerator! courses.beabetterdev.com/cour...
🎉SUPPORT BE A BETTER DEV🎉
Become a Patron: / beabetterdev
📚 MY RECOMMENDED READING LIST FOR SOFTWARE DEVELOPERS📚
Clean Code - amzn.to/37T7xdP
Clean Architecture - amzn.to/3sCEGCe
Head First Design Patterns - amzn.to/37WXAMy
Domain Driver Design - amzn.to/3aWSW2W
Code Complete - amzn.to/3ksQDrB
The Pragmatic Programmer - amzn.to/3uH4kaQ
Algorithms - amzn.to/3syvyP5
Working Effectively with Legacy Code - amzn.to/3kvMza7
Refactoring - amzn.to/3r6FQ8U
🎙 MY RECORDING EQUIPMENT 🎙
Shure SM58 Microphone - amzn.to/3r5Hrf9
Behringer UM2 Audio Interface - amzn.to/2MuEllM
XLR Cable - amzn.to/3uGyZFx
Acoustic Sound Absorbing Foam Panels - amzn.to/3ktIrY6
Desk Microphone Mount - amzn.to/3qXMVIO
Logitech C920s Webcam - amzn.to/303zGu9
Fujilm XS10 Camera - amzn.to/3uGa30E
Fujifilm XF 35mm F2 Lens - amzn.to/3rentPe
Neewer 2 Piece Studio Lights - amzn.to/3uyoa8p
💻 MY DESKTOP EQUIPMENT 💻
Dell 34 inch Ultrawide Monitor - amzn.to/2NJwph6
Autonomous ErgoChair 2 - bit.ly/2YzomEm
Autonomous SmartDesk 2 Standing Desk - bit.ly/2YzomEm
MX Master 3 Productivity Mouse - amzn.to/3aYwKVZ
Das Keyboard Prime 13 MX Brown Mechanical- amzn.to/3uH6VBF
Veikk A15 Drawing Tablet - amzn.to/3uBRWsN
☁Topics covered include:
What is EC2?
What is Lambda?
EC2 History
Autoscaling Groups
Target Groups
Scaling
Lambda Functions
Lambda Scaling
🌎 Find me here:
Twitter - / beabetterdevv
Instagram - / beabetterdevv
Patreon - Donations help fund additional content - / beabetterdev
#AWS
#EC2
#Lambda
#Serverless
Looking to become an expert on AWS Lambda? Check out my new course: AWS Lambda - A Practical Guide
www.udemy.com/course/aws-lambda-a-practical-guide/?referralCode=F6D1A50467E579C65372
I have to be honest, I was watching a Udemy course about aws cloud solutions architect and it was very comprehensive. But I think your channel has the best explanations for the different services. Easy to understand and to follow, and you also combine different services in your video. You dont just explain what a ec2 instance is, but also mention that it can be combined with a load balancer and co. I mean that combining load balancer and ec2 is pretty basic, but I mean for an entire new beginner, having the connections early helps to connect things faster and I think you do it great. Have should find your channel earlier...
Awesome, very good explanation thank you!
Amazing explanation, many thanks for your efforts
Thanks mate! Great info and I can definitely come to a better decision now! :)
Such a great video. Thank you
Amazing video. Thanks so much!
great great great video! I am starting to learn about AWS and this video cleared up many questions. You earned a like and a new subscriber, thank you!
Thanks Vinicius, and welcome!
I feel like you’ve been using the Feynman technique because this is one of the best explanations of anything I’ve ever seen. Awesome job!
if you study physics / engineering, you'll do so
This channel is gold!
This was very illuminating. Thank you for putting in the effort, you just got a sub!
You're very welcome!
that's one of the best explanations I've heard, I just like your content!
You're very welcome, Human!
Great video -- tons of info. THANK YOU
Glad you enjoyed it!
Just started a new dev job and haven't worked with AWS that much. This video is better than any Udemy course I was given. Really cleared things up for me. Thanks :D
Hi Lynkbear,
Super glad you enjoyed the video and found it helpful.
Daniel
This is one of the Awesome explanations with the most simplistic way of making one understand. Great Job. Rarely we find such tutorials.
Thanks so much Kedar!
Couldn't agree more.
Great explanation! Thanks!
Thank Cesar! Glad you enjoyed :)
Great video! Thanks a lot!
You're very welcome, Anna!
this deserves more love. Thank you so much
Thanks Azl, glad you enjoyed :)
@Draven Callan no we are not gonna do that
@Andreas Lorraine we shall not
wow!! i just started with cloud and i understand this! Amazing!
Very good explanation. Thanks!
Glad you enjoyed it!
excellent video, congratulations for the great work
Thank you very much Paulo!
What a Ground Breaking Illustration between EC2 and Lamda Function !!!. I love you man. did you know, by sharing your wonderful knowledge , you also helping our humanity. and for that you have my gratitude. Million Thanks to you !!!. Mat.
if you ever happen to be come to Colorado, I take you to dinner. a Restaurant of your Choice. I really mean it.
Mat,
Comments like these are what inspire me to keep making videos. Thank you for such kind words of support and inspiration. I never thought of myself as helping humanity, but just a guy trying to help people navigate the world of AWS. I'm glad my videos have been helpful to you and so many others. I'll never stop making them!
And if I ever and in Colorado, I'll send you over a message to get together.
Cheers
Daniel
@@BeABetterDev Thanks Daniel !!. absolutely. Please let me know. Thanks again. Mat.
Very useful and informative. One extra thing to consider about lambdas is the cold start time. If a lambda is inactive, there is a (short) delay to spin up the lambda, which an EC2-based solution wouldn't have. Of course, once spun up, the next time the lambda is invoked will be pretty much immediate. Lambdas automatically spin down after a period of inactivity.
Crisp and easy to understand
Awesome video! Thanks you very much!!!
You're very welcome!
Great content! Thank you.
Glad it helped!
Thank you, working at my AWS SA certs and this is great.
Glad I could help!
I have been verifying couple of articles for identifying diff between EC2 and Lambda , but this video cleared all my doubts.
Lambda server less definition was outstanding
Glad I could help Ram!
great stuff
Absolutely love your videos.
Thanks so much !
THIS IS A GREAT VIDEO !
Thank you so much!
Thanks, keep it up!
Thanks Charith!
Such a great video! Thanks!new subscriber here!
Thank you and welcome!
Thank you for your classes! They are very clear and relevant to help understand AWS services. I have serious doubts on the development of APIs in EC2 with API Gateway services, but I'm not finding references to clarify them. Do you have any video that explains that in detail? Thanks again.
I think i have been studying AWS for like 2 months just to take a test for work but now I finally understand these two things xD
So glad to hear Reidy! Thanks for watching :)
Thoughtful analysis! Glad you mentioned the cost comparison. Lambdas with something like Serverless Framework even eliminates the clicks :)
Thanks Glenn. Completely agree with serverless framework, they've really made Lambdas even easier to set up and get started these days :)
I would like to recommend Pulumi.
Great thanks
Give this man a 🛡️🏅!
I find this explanation easier than Amazon's wiki
Thanks mradul! Don't forget to try Sage! ;)
Good explnation, Thanks
Very welcome Krishna, thanks for watching!
Great explanation . This is cleaner than some internal wiki
Thanks Kevin! Don't forget to check Sage! ;)
@@BeABetterDev What is Sage?
Thanks broo
Best explanation on EC2 and lambda!!!
Thanks Tianho! Glad you found this useful :)
Can we talk on technology, I wish to learn more from you, please reach me at messenger id- amoltofi
Insta I'd - amoldhaygude 👍
Great video. What about the use case part in terms of on-demand EC2 ? Will they both tie in-terms of advantages or still you prefer lambda ?
Thank you. ; )
You're very welcome Po!
Hii, can you make a video on how to add Http security headers on our web app which is hosted on EC2 pls. It will be a great help.
I feel it would have been useful to compare Lambda and Fargate (Function-as-a-Service versus Serverless)… then you might also include ECS as well to show the spectrum of benefits/concerns.
Thanks Cameron, this is a great idea for a followup video. Cheers.
finished watching
Nice video :) Just wondering, is it out of the realm of possibilities for you to go over Apache Airflow? Specifically ETLing in it? I heard that a lot of companies will use something like that over just having a bunch of redshift/lambdas as their ETL (especially if it goes over 15min limit anyways or redshift wlm taking too long and timing out lambda)
Hi there!
I'll look into Apache Airflow. Thanks for the suggestion.
Thanks for watching!
nice and very well done. is it possible to share the slide? thanks!
Nice explanation! Which app do you use for writing?
Your way of exaplaning the things is really awesome , if possible could you please share with us api gateway link , I want to watch that video too 👍🏻Thank you for making these useful videos 👍🏻
Thanks so much Sibanandra. I believe the video I was referring to is this one: ruclips.net/video/uFsaiEhr1zs/видео.html
Hope you enjoy!
Thank you
You're very welcome!
Awesome
Nice video as always, though I have a couple of questions:
About pricing, say we have 1 on-demand EC2 instance provisioned behind an ALB and ASG with min:1 des:1 max:1 configuration, is this a valid architecture for handling "bursty" workloads than using Lambda?
Can we combine the use of EC2 and Lambda at the same time for the same web server? I'm very new to AWS so I don't have an in-depth knowledge about these services yet. Thanks in advance.
@Marcus Erectus for me doesn't make sense to have max to 1 if you really want to scale but you can set rules to scale up say up to 5 or whatever number is depends on your case.
for 2nd question, yes we used EC2 with lambda in some use cases
You talk about ease of hooking up API gateway and lambda, and standing up a quick restful API, can you make a video on that?
Hi darkruby,
Check out the playlist here: ruclips.net/p/PL9nWRykSBSFjHhg11falLLKxVExFnt1_c
Cheers!
@@BeABetterDev thanks,!
Nice
Thanks
You're very welcome bhasker!
You are awesome
Thanks Subhashis, so are you!
Amazing to the point explanation.
Thanks Kya! Glad you enjoyed.
Developing a image sharing website,
And adding mobile phone apps to it,
Is it better to use ec2 or lambda?
I dont know a out server security...
I use ec2 now, and as for websites, it's quite good.
Another important question :
If I have lambda, and later want to move everything onto my own server /s, is that easily possible (migration)?!
Thanks!
Hey Andy,
I'm more of a 'if it ain't broke, don't fix it' kind of guy. If you're getting good performance and are happy with using EC2, I would stick with what you know. I would say for websites, EC2 is a better choice though. For API development (REST, HTTP, etc), Lambdas are a great option. There is room in this world for both!
Regarding your second question about migration, I would say that if you anticipate needing to migrate to your own server in the future, leverage Docker + Lambda configuration. This will make it super easy to port over later since the runtime environment is containerized and easily portable to any hardware type. I have a video on Docker + Lambda at this link if you are interested in learning more: ruclips.net/video/q7Zo9I5vhrg/видео.html
Hope this helps!
Daniel
@@BeABetterDev thanks, helped a lot!!
@BeABetterDev
Thank you for your video. However, it's not complete. There are plenty of cases where it is best not to use lambda. Example: Cold Function (If your lambda application with very simple code there will have no problem. Lambda will be more faster than EC2 but If your lambda application requires multiple modules [eg. load Layer], it will be slower than EC2).
Can I use Lambda with MongoDb, because I did not like dynamoDb ? 🤔🤔🤔🤔🤔🤔🤔😚
I'm still a bit confused. Your EC2 example was to host websites while your Lambda example was about a REST API. How would you host your (dynamic) website using Lambda? Is that possible?
Hi, it's the same concept - your ec2s can also host rest APIs by using a web server. The ec2 example was not to host to just host websites - it was to build a distributed web application.
Lambda accomplishes restful APIs by using API gateway as a dependency. You can host your raw html/CSS/js using something like S3 + cloudfront.
Can we talk on technology, I wish to learn more from you, please reach me at messenger id- amoltofi
Insta I'd - amoldhaygude 👍
I always find it a bit hard to properly test all my Lambda functions. Is there somehow a service to "unit test" Lambda functions?
Hi Jo,
Great question. Check out this video for a way to test our your lambda functions locally before pushing your code: ruclips.net/video/AUQRyl1SNcU/видео.html
In terms of unit tests, the Lambda is just a function at the end of the day, so you can unit test its functionality like normal in your code base.
Hope this helps.
Daniel
Lambda functions don't have a sleep right, So the first invocation won't be slow?
Hi Rohan,
Lambda functions suffer from a phenomenon called Cold Start. Cold start is the initial provisioning of the function's code (and dependencies) that need to be loaded prior to execution.
You didn't talk about cold startup in AWS Lambdas
2056 MB or 2048 MB (2GB) max for lambda functions? 2056 is a strange number in computer parlance. 2048 (2^11) is not.
So, serverless didn't mean without servers, instead, it means that the logic from the servers set up is abstracted away from you and managed by AWS. Thank you!
I don't think the cost comparison is really fair here. On a per-instance basis, EC2 "rent" is based on whether it's on-demand, reserved, or spot, as well as the enormous list of possible choices for resources. Then, if you're using autoscaling (which you probably should), EC2 costs depend on traffic and compute time as well, but in a much less transparent way because it's not as granular as Lambda. Because EC2 is more flexible, there are so many more levers when it comes to adjusting and calculating costs. Lambda is based on just 3 numbers: 1 you choose and the other 2 you can get directly from metrics.
You teach like sal khan, from khan academy 😺 (good thing)
Thats what I was going for :) Thanks!
@@BeABetterDev no problem. I just wanted to say that your vids have helped me with some aws tasks at work! (I’m an intern)
Actually it's Elastic Compute Cloud
Thanks for pointing this out! I always get this mixed up.
EC2 is elastic compute cloud. Not cloud compute
Thanks DaFaGe! I always get this point mixed up.
serverless is a misguide word..... it should be "manageless server"
Very good point lucky
How does anyone love lambdas? Deployment takes forever
But still, using lambda really like doing drugs. They get very expensive real quick. Unless your company has endless money or you work for Amazon, the budget is gonna be insane.
Hi Jude. Cost really depends - if you have consistent invocations on your application, then I 100% agree with you - Lambdas will *probably* end up costing more. However, if you have bursty or unpredictable invocations, you can save quite a bit of money using Lambdas.
I've personally found I was able to shave off ~30% of my infrastructure cost by switching from EC2 to Lambda. Again, this is very use case dependent.
Great video, thanks so much!
You're very welcome Matthew!