Top 5 AWS Lambda Anti Patterns

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ส.ค. 2024
  • In this video, learn about my Top 5 AWS Lambda Anti Patterns. These are based on my personal experiences and are pitfalls that developers fall into the most often.
    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...
    📚 My Courses 📚
    AWS Lambda - A Practical Guide - www.udemy.com/course/aws-lamb...
    🎉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 Driven 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
    🌎 Find me here:
    Twitter - / beabetterdevv
    Instagram - / beabetterdevv
    Patreon - Donations help fund additional content - / beabetterdev
    #SoftwareEngineer
    #SoftwareDeveloper

ความคิดเห็น • 45

  • @BeABetterDev
    @BeABetterDev  ปีที่แล้ว +3

    Like this video? Check out my course, AWS Lambda - A Practical Guide - www.udemy.com/course/aws-lambda-a-practical-guide/?referralCode=F6D1A50467E579C65372

    • @JMa-cg1ks
      @JMa-cg1ks ปีที่แล้ว +1

      Can you chain lambdas if you don't expect a response?

  • @user-yj7um6hv1d
    @user-yj7um6hv1d ปีที่แล้ว +6

    I'd like to add a note about lambda batch processing: in some cases, message can fail over and over again. This can create an endless loop, so always use a dead letter queue with maxReceiveCount parameter.

  • @shashank_rajak
    @shashank_rajak ปีที่แล้ว +5

    I am new to lambdas and I was going to design my lambda with the very first anti pattern, thanks for saving me haha

  • @srinivasreddydanda1777
    @srinivasreddydanda1777 ปีที่แล้ว +6

    Thanks a ton, Daniel!! I've learnt lot of AWS components from your channel. Especially lot of stuff around Lambda like this.
    Your playlists are super helpful & i've kept a target to watch at least one playlist of yours per week to complete 343 videos that you uploaded till date

    • @BeABetterDev
      @BeABetterDev  ปีที่แล้ว +2

      Thanks so much Srinivas! The 343 videos may take a while haha :D

  • @madrag
    @madrag ปีที่แล้ว +2

    Would love to see episode on this lambda logging

  • @princechhabra9342
    @princechhabra9342 ปีที่แล้ว +1

    Thank you for making this video.. I learnt a lot from your AWS videos

  • @djaniel4028
    @djaniel4028 ปีที่แล้ว +1

    hello. recently started working at the same place as you and finding it particularly helpful on your videos and its funny i could tell you worked at this place before i even checked due to the strong and obvious values presented. Thanks for the vids

    • @BeABetterDev
      @BeABetterDev  ปีที่แล้ว

      Thanks Djaniel. Glad this resonated with you and you find it helpful :)

  • @youngsea89
    @youngsea89 ปีที่แล้ว +3

    your video content is AWS some! keep it up bro

  • @pfrieden1
    @pfrieden1 ปีที่แล้ว +1

    Thanks for bringing up metrics from Lambda - I may need that soon!

  • @JamesSmith-cm7sg
    @JamesSmith-cm7sg ปีที่แล้ว

    very good, thanks

  • @sercantor1
    @sercantor1 ปีที่แล้ว +1

    great video I'm guilty of putting runtime exceptions and 5XX errors into the metric API, I'll look into creating a metricfilter to catch them for the alarms.

  • @Atpugtihsrah
    @Atpugtihsrah ปีที่แล้ว +1

    Great video. Thanks!

  • @TheLostBijou
    @TheLostBijou ปีที่แล้ว

    BABD, you run an amazing channel. Thanks!

  • @LeandroSantos-bt1lg
    @LeandroSantos-bt1lg ปีที่แล้ว +2

    Very helpful content.

  • @rickharold7884
    @rickharold7884 ปีที่แล้ว

    Good ones!

  • @ighsight
    @ighsight ปีที่แล้ว +1

    Excellent.

  • @itsme1587
    @itsme1587 ปีที่แล้ว

    Please please make some videos on real time projects, you have a huge experience on the serverless. Project will help us to grow fast

  • @Atpugtihsrah
    @Atpugtihsrah ปีที่แล้ว +1

    4:43 Are log streams really independent of the Lambda functions? In my experience, log streams are created, one for each lambda function.

  • @mandarkulkarni9525
    @mandarkulkarni9525 ปีที่แล้ว

    Do you have any solution video on Pitfall2. emitting line to cloud-watch and creating metric filter out of it. Would really appreciate it.

  • @PankajSingh-kq2gj
    @PankajSingh-kq2gj ปีที่แล้ว

    Wow!

  • @jonzezk.4495
    @jonzezk.4495 ปีที่แล้ว +4

    For emitting metrics it’s much easier to use Embedded Metrics Format

    • @BeABetterDev
      @BeABetterDev  ปีที่แล้ว

      I've heard about this from peers but never tried it myself. Is it easy to set up and use?

    • @natenez
      @natenez ปีที่แล้ว

      I was planning to say the same thing. Yes it is trivial to do, and Lamdba Powertools provides some extra features on top like cold start metrics

    • @haakonness
      @haakonness ปีที่แล้ว

      Thanks, I didn't know about this. This is so great!

    • @roach_iam
      @roach_iam ปีที่แล้ว +1

      @@BeABetterDev Would love a video on this!

  • @seeingblind2
    @seeingblind2 ปีที่แล้ว

    *what what are you doing step-function?*

  • @Atpugtihsrah
    @Atpugtihsrah ปีที่แล้ว

    For the last pitfall, another caveat would be: If your lambda function takes a lot of time in processing each SQS message, then it may take some time for the rest of your messages to be processed since it would be sequential iteration.
    Ex:
    Scenario 1: Each lambda processes 1 message each, so 5 messages and 5 lambda instances processing them in parallel. Each message take 10mins to run so everything done in 10-12mins (including invocation time).
    Scenario2: Each lambda processes 5 messages in a batch and then iterate over them processing them together. The whole flow will end up in 50-52mins so the last message will get processed in way more time here.

    • @mnathan18
      @mnathan18 ปีที่แล้ว

      Any alternative for such uses?

    • @katearcher8881
      @katearcher8881 9 หลายเดือนก่อน +1

      But in second case lambda will fail because max timeout is 15 minutes. Maybe you should use something else if you need process large chunks of data that take a long time. How about glue etl jobs?

  • @vijethkashyap151
    @vijethkashyap151 ปีที่แล้ว +1

    What will be solution for Pitfall 3? If we have lambda synchronously tied up? What is the better approach to this?

    • @karthikm3549
      @karthikm3549 ปีที่แล้ว +2

      Persist the state to database and do a call back.

  • @alejandrombc
    @alejandrombc ปีที่แล้ว +1

    Why is it better to process batch instead of single lambda processing?. The only downfall I think might be the amount of invoked lambdas, but I think it keep the process more clean

    • @cristiannechita2032
      @cristiannechita2032 ปีที่แล้ว

      One of the downside is scalability. In each region you can have only X lambdas running concurrently. If all of a sudden you have a huge influx of message you might hit the concurrency limit. You can keep the process clean when handling a batch of messages by splitting the handler function (which receives the messages) from the actual business logic processor.

    • @BeABetterDev
      @BeABetterDev  ปีที่แล้ว

      Basically what Cristian said is spot on. The other major factor is cost.

    • @alejandrombc
      @alejandrombc ปีที่แล้ว

      @@cristiannechita2032 thanks for the response!. But if you use sqs you will hit the concurrency limit, but no new event will be process from the queu right?. So when a lambda finish a new lambda will be triggered, so no message will be “lost”. Either way I get the point 👌.
      Also if you use batch, what if you have 1 event alone for a “long time”? it will not be process until you have the X amount of events?
      About pricing, is it really a factor?, if a lambda takes 2secs to process a message. What will be cheaper 5 parallel lambdas with 2sec each or 1 with 10 seconds? (The first scenario will be faster because of paralellism, but am not sure really).
      Thanks again for explaining me out the pitfall 🙌

    • @user-yj7um6hv1d
      @user-yj7um6hv1d ปีที่แล้ว

      Batch processing in some cases is more preferable, for example, when you need to process a bunch of URLs. So doing multiple requests in parallel such as axios.all is much efficient than doing single requests, such as axios.post or axios.get.