Intro to AWS Lambda with Python | AWS Lambda Python Tutorial

Поделиться
HTML-код
  • Опубликовано: 1 окт 2024
  • Join us in this video tutorial we walk through step-by-step how to write AWS Lambda functions in Python to interact with S3 and DynamoDB.
    Topics covered include: AWS Lambda functions, Python, Python Boto3 SDK, DynamoDB, S3
    Intro to AWS Lambda (NodeJS / Javascript version):
    • AWS Lambda & DynamoDB ...

Комментарии • 195

  • @heretolearnn
    @heretolearnn 4 года назад +133

    I really appreciate that you made a video with errors and fixed those errors in your video. That is far more important then making a clean video where everything goes fine. Half the people watching your video like myself are learning and to see that even those in the know get errors and have to work through them is good to see. So appreciate you keeping that in the video, kudos to you sir!

  • @studentlearner1453
    @studentlearner1453 5 лет назад +290

    14:00 - Really great to see you receiving multiple errors one after another and then fixing it one by one - please do not edit out such step-by-step learnings from your videos and simply show the final ‘working code’ (as many instructors do).

    • @BlockExplorerMedia
      @BlockExplorerMedia  5 лет назад +69

      yep, I like to leave mistakes, etc. in the videos because it helps illustrate real world development and how to go about solving problems as they come up.

    • @renyirish
      @renyirish 4 года назад +1

      Exactly...well agreed!

    • @KalyaElisha
      @KalyaElisha 4 года назад +3

      Very true. Those errors getting fixed as you watch is really the way to go since learners will most likely run into the same errors.

    • @PaulJamesOnGoogle
      @PaulJamesOnGoogle 4 года назад +1

      @@BlockExplorerMedia Yup, very helpful, thanks!

    • @injrav7160
      @injrav7160 4 года назад

      The best instructions on lamda and Python

  • @studentlearner1453
    @studentlearner1453 5 лет назад +3

    General question on code version control. In this example, it looks like the actual python code is stored within the lambda console. However in projects i’ve been working on, we store all the source code in a purpose built Version Control System (VCS) such as Github or BitBucket etc. In the AWS world, I understand the equivalent to be CodeCommit. Can Lambda be made to fetch /refer the code from CodeCommit? (Instead of the code sitting inside a lambda function directly where there is a risk of losing the code if the lambda function gets deleted). How do you recommend storing/versioning/referencing source code in a lambda/AWS context?Thanks.

    • @BlockExplorerMedia
      @BlockExplorerMedia  5 лет назад +1

      great question. i don't do any kind of organizing within the AWS console itself but I do store all of my lambdas in GitHub, the same way I would any other project. as far as fetching the code from GitHub and applying directly to AWS Lambda - I haven't explored that yet. i can possibly look into that and queue it up for a video as time permitts.

  • @ashwindhage7305
    @ashwindhage7305 3 года назад +2

    That's a very easy and simplest way to explain any beginner, thanks for making such videos.

  • @studentlearner1453
    @studentlearner1453 5 лет назад +2

    7:15 - Hi, does aws publish what python libraries are included by default? E.g. you mention that boto3 is included by default. How do we verify if any other library of our choice is included by default? Also, if a library that we like is not included by default, how does one make that available for the lambda function to use? (E.g. in desktop IDEs i think you can download the libraries and add it to PATH or something......?)

    • @jonathanspruance4502
      @jonathanspruance4502 5 лет назад

      boto3 is an AWS SDK for Python. all AWS SDKs and libraries are available in Lambda and elsewhere. other 3rd party libraries are not included. if you want to include external lbraries you would have to archive your project in a zip file and upload it to Lambda like that.

  • @studentlearner1453
    @studentlearner1453 5 лет назад +4

    9:20 Also - how do you know that you had to use s3.buckets.all() ? I.e. from line 4, i understood that “s3” was a variable. But how did you come to learn/know that you then had to specify “.buckets.all” after that to get the list of all buckets?

    • @jonathanspruance4502
      @jonathanspruance4502 5 лет назад +1

      hi Aravind. I got all of that by reading the AWS boto3 documentation which can be found here: boto3.amazonaws.com/v1/documentation/api/latest/reference/core/collections.html

    • @studentlearner1453
      @studentlearner1453 5 лет назад

      Jonathan Spruance Brilliant thank you.

  • @tHcnunz
    @tHcnunz 3 года назад +3

    As everyone is saying here, love that you have left in all the errors you encountered and worked through them. Troubleshooting 101. Great job mate!

  • @kesterbelgrove818
    @kesterbelgrove818 3 года назад +2

    I see you haven't posted in a year. Hope you have plans to produce more videos in the future. You are an important resource please don't stop

  • @cesarmostacero
    @cesarmostacero 4 года назад +5

    Great tutorial, it's a nice getting started with aws-lambda, everything clear and awesome that you included error-fix process and not only the happy path, I think that was the best part of this video!
    Few recommendations:
    1 - You might also use an example to re-use already existing role on different lambdas (it was implicitly, but still it helps new people on aws).
    2 - Maybe the only one missing part was include a lambda with both services (dynamodb and s3)
    3 - For putItem function, you could take it to explain how to make it dynamic instead of hardcoded using arguments.
    4 - Sample of test different of the default one.
    Anyways those 4 points could be taken as next steps for audience to practice the learnings from this video.
    Again, great tutorial!

    • @BlockExplorerMedia
      @BlockExplorerMedia  4 года назад +2

      hi Cesar - thanks a lot for the feedback. i hope to do some new aws tutorials soon and will integrate your suggestions.

  • @MrTheAnt
    @MrTheAnt 4 года назад +4

    Subbed, a good and honest walk through. Really helped me with Lambdas thanks :)

  • @rahulkmail
    @rahulkmail 3 года назад +1

    Excellent tutorial. But there is a question. In the code I have seen we are importing json library through "import json", but we are not using any method out of it. So, is there any need to import json library in the code ?

  • @studentlearner1453
    @studentlearner1453 5 лет назад +3

    10:49 - Is ‘statusCode’ and ‘body’ something that lambda expects that we return as part of every lambda function? Or are you returning it because in this instance you wanted to fetch/print/display the bucket list?

    • @jonathanspruance4502
      @jonathanspruance4502 5 лет назад

      i think this is more of a REST convention than anything Lambda specific. although API Gateway does expect a format like this - see my Lambda - API Gateway integration video for more details.

    • @studentlearner1453
      @studentlearner1453 5 лет назад

      Jonathan Spruance Thank you.

  • @david2358
    @david2358 3 года назад +1

    Thank you for this video, for the first time now, i am starting to understand where/how lambda can be used. 👍

  • @ForsakePariah
    @ForsakePariah 5 лет назад +3

    Really liked the video! As a side note, I wouldn't focus so much on zooming in and out. So long as your resolution is good, we can see it.

  • @windowspowershellawscloudv8591
    @windowspowershellawscloudv8591 2 года назад +1

    Excellent session. Very helpful. I have done everything along with you and learnt a lot. Thank you so much

  • @DopeHub
    @DopeHub 3 года назад +1

    Thank you for this.really helped me.
    please upload new videos

  • @moiacolucci
    @moiacolucci 4 года назад +1

    Decent walkthrough of Lamdba. Would appreciate explanations of the components of Lamdba though, i.e., handlers, context, events...

  • @studentlearner1453
    @studentlearner1453 5 лет назад +3

    Hi, great video. What resources do you recommend for learning python for a complete beginner to programming (no prior JavaScript experience)? (Ones that you used yourself). Please do more such videos on python+lambda combination.

    • @jonathanspruance4502
      @jonathanspruance4502 5 лет назад

      i used a lot of different online resources to learn Python - too many to list. but a combination of found tutorials after Googling Python and also here on RUclips. i will be making more Python videos in the future - stay tuned!

    • @parthapaul1249
      @parthapaul1249 2 года назад

      Mosh

  • @noahbroyles8828
    @noahbroyles8828 4 года назад +4

    "I'm missing my colon"

  • @srivanipatchava6172
    @srivanipatchava6172 3 года назад +1

    i needed in python...thnakssss a lott

  • @RavindraKumar-to4zl
    @RavindraKumar-to4zl 4 года назад +1

    just because of this video i'm subscribing your channel.. great work.

  • @lynzapalac6483
    @lynzapalac6483 3 года назад +1

    Thanks So Much for making a REALISTIC video of your process. It is such a relief to see someone go through the process of not doing it perfectly the try and going through the troubleshooting process. I learned so much. You are teaching us "How to Fish" instead of just giving us the fish to eat :-)

  • @studentlearner1453
    @studentlearner1453 5 лет назад +2

    Hi, could you pls explain what are the “event” and “context” for? Are they incoming parameters into the function and if so of what use are they? Are they mandatory to be defined in each and every lambda function?

  • @virtualvessel0
    @virtualvessel0 Год назад

    Hi, I receive "[ERROR] Runtime.MarshalError: "Unable to marshal response: Object of type s3.Bucket is not JSON serializable"
    Any ideas? Thanks.

  • @StarsTogether
    @StarsTogether 11 месяцев назад

    Top-drawer content! If you're keen on this subject, a related book is a must-read. "AWS Unleashed: Mastering Amazon Web Services for Software Engineers" by Harrison Quill

  • @Van-pf2or
    @Van-pf2or Год назад +1

    I really loved this video with errors and fixes. Its 1000% times better than an usual video with no errors. As a developer, I really love it.

  • @sraj7284
    @sraj7284 3 года назад

    Hello,
    Can the function definition be altered? In other words can you execute your own custom function or does it need to match what AWS has provided? Just as an example, can this be coded in as below? (Meaning, I changed the paramaters)
    def lambda_handler(a, b, c):
    # TODO implement
    return a+b*c
    }

  • @sourceschaudes9587
    @sourceschaudes9587 5 лет назад +1

    Hi, how to deal with Conda environment ? is it possible to include it in the lambda function?

  • @dgillies5420
    @dgillies5420 7 месяцев назад

    22:00 I used the following bit of code so that I could just append the dynamodb code to the existing lambda function to list all the s3 buckets AND run the dynamodb query, so both bits of code run in the same lambda function.
    bucket_list.append(table.get_item(
    Key={
    'id': 'mercury'
    }
    ))

  • @amitvlog-viralnews
    @amitvlog-viralnews 3 года назад

    import json
    import boto3
    dynamodb = boto3.resource('dynamodb')
    table = dynamodb.Table('planets')
    def lambda_handler(event, context):
    response = table.get_item(
    Key={
    'id': 'venus'
    }
    )
    print(response)
    return {
    'statusCode': 200,
    'body': response
    }

  • @Rickety3263
    @Rickety3263 3 года назад

    If youre a certified solutions architect, but dont know node.js OR python, which would you recommend learning 1st??

  • @zacharyrgonzales
    @zacharyrgonzales 4 года назад +2

    Thank you for uploading this tutorial. This has given me the confidence to go forth and learn python by creating lambda functions!

  • @studentlearner1453
    @studentlearner1453 5 лет назад +1

    Hi, question around organizing (visually grouping lambda functions - lets say over a period of multiple weeks or months you have been continuously developing lambda functions - wont the lambda functions UI get cluttered? I.e. how does one organize lambda functions into a “folder” or even a “common program” in the AWS Console for Lamdba?

    • @BlockExplorerMedia
      @BlockExplorerMedia  5 лет назад

      see my other answer below - i don't see a way within the AWS Lambda console to organize by folder, but I effectively do this in GitHub - I'll save project-related lambdas in separate repos for organizational purposes - here's an example: github.com/jspruance/hexal-lambda-functions

    • @studentlearner1453
      @studentlearner1453 5 лет назад

      Cloud Path Ok thanks. It does seem like an extra step to push code into github and then copy paste into lambda code editor IDE. I think aws should find a way to integrate codecommit with lambda such that code changes pushed into codecommit are immediately available in lambda (if the developer so chooses),

  • @MaDkiLLaV2
    @MaDkiLLaV2 6 месяцев назад

    Very good. I like your teaching style, where you troubleshoot basic errors without editing them out. Do you have any videos on how to import external libraries from python into lambda?

  • @anfedres
    @anfedres 5 лет назад +1

    Dude, best tutorial ever. I have found several of them where they just talk and talk and the tutorial takes 40 - 60 minutes. I mean... why! yours instead... it was clear and straight to the point. Do you have a tutorial based on IAM? If not... it would be great if you could make one... thanks!

    • @BlockExplorerMedia
      @BlockExplorerMedia  5 лет назад

      Thanks Andres, glad you found it useful! I have been thinking about doing one on IAM...it's definitely on my list.

  • @lakshmimaha5716
    @lakshmimaha5716 2 года назад +1

    Highly satisfied with the demo in a simple and clean way

  • @Alexander-ns9yv
    @Alexander-ns9yv Месяц назад

    A simple yet comprehensive guide how NOT to build your backend

  • @rickhehe
    @rickhehe 2 года назад

    Thanks for the instruction. I appreciated it very much. BTW, in relation to the last example, string worked for me.

  • @hamids2065
    @hamids2065 3 года назад +1

    Nice video:)

  • @veaarthur3655
    @veaarthur3655 5 лет назад +2

    awesome video! I hope you are going to make some more?

    • @BlockExplorerMedia
      @BlockExplorerMedia  5 лет назад +4

      thanks. yes, I have a few new ones in flight right now. i am also working 2 jobs at the moment so it's been a challenge to find enough time for making RUclips tutorials. hopefully I'll be able to pick up the pace soon : )

  • @alexd7466
    @alexd7466 3 года назад

    Having to use their editor to code something seems really backwards. Isn't there a way to just develop locally?

  • @namanv3214
    @namanv3214 2 года назад

    How do I give inputs to a lambda function written in python while configuring the test event. I need to give 3 inputs to 3 variables. How do I do that?

  • @pavansingara9408
    @pavansingara9408 3 года назад +1

    Really good explanation , I wanted to learn how coding actually works in a cloud this was awesome.

  • @trevorw2681
    @trevorw2681 2 года назад +1

    Amazing tutorial for a complete noob like me. I love how raw this video is.

    • @BlockExplorerMedia
      @BlockExplorerMedia  2 года назад

      Thanks Trevor. Yeah most my videos are on the raw side and rough around the edges lol glad to hear that's a good thing!

  • @Youdude2
    @Youdude2 3 года назад

    How can I version control my lambda code in GitHub and have it update the lambda function everything a branch is merged to main?

  • @douniam.a.8694
    @douniam.a.8694 11 месяцев назад

    This is a wonderful video, i learned a lot, I love it. I also like that you had errors and fixed them. Thank you very much for your efforts.

  • @sampyism
    @sampyism 9 месяцев назад

    Thank you, I appreciate this video. Introduced me to Lambda in an easy to understand manner.

  • @Gorbachul
    @Gorbachul Год назад

    Agree with comments here that keeping and explaining the errors in this tutorial adds much educational value.

  • @ayencoscolfield3312
    @ayencoscolfield3312 Год назад

    this was cool thanks even though i have a bit of experience but i still appreciate your work

  • @psychobuddha5379
    @psychobuddha5379 4 года назад +1

    Awesome tutorial! I recently started learning AWS, and I will need to combine it with Python, so this really helped. I am just curious why do have to pass event and context every time, if we're not using it? Also, do we must return a dict with statusCode and body, why we just don't return the content?

  • @phillertora7564
    @phillertora7564 3 года назад

    Awesome video. Though, coming from visual studio with a very powerful IDE (type ahead, debugging with breaks and the ability to change values, on and on), this feels like such a huge step backward. Having to remember syntax? Test to see errors and get little information? Is this progress??? Clearly I'm too old!

  • @benweaver6544
    @benweaver6544 4 года назад +1

    This is one of the best tutorials I have seen in a long time. It was candid and practical. It started with a very simple example that nevertheless showed most of the many setup details for lamdas. These details of setup are not obvious to the newcomer, but the tutorial explained them very clearly. Then it moved on to other very useful examples, like accessing a database also in AWS. Along the way, the author courageously showed, and then very well explained, what kind of mistakes python newbies like myself might make. Excellent.

  • @grimonce
    @grimonce 3 года назад

    Great thing about Python is that it is bloated and it helps (most of the time).
    Wow I got 3 years of experience in Python and LabVIEW and recruiters of a few companies didn't let me go to the 2nd part of the interview (technical part) because I didn't have AWS on my CV.
    It turns out it i just a bigger juypter notebook. Great... just as I assumed, gotta tell them you know everything.
    That's pretty sad, for the company, for me and the recruiter doesn't care I guess.

  • @adrestrada1
    @adrestrada1 3 года назад

    nice tutorial guy. :) I would like see this work with scala . :)

  • @lifting_and_coding
    @lifting_and_coding 2 года назад

    Lambda + API Gateway is clutch

  • @moglimogify
    @moglimogify 9 месяцев назад

    Concise and easy to understand, Thank you :)
    WARNING: for dynamoDB, make sure your table is created in the same region as your function. For some reason dynamoDB window defaulted to a different location. I had to recreate it in the same region.

  • @chaitanyakumar979
    @chaitanyakumar979 4 года назад

    I enjoyed troubleshooting which is unconventional content creation...sub'ed instantly. Looking forward to see more videos on Boto3/python and AWS combination. way to go.

  • @srikarthallada6307
    @srikarthallada6307 3 года назад

    Excellent Video. I'm waiting for new videos on AWS Lambda with python

  • @ba-en1io
    @ba-en1io 4 года назад

    hey, Im getting an error, s3.Bucket(name='test283393') is not JSON serializable, can you help me resolve it.

    • @ba-en1io
      @ba-en1io 4 года назад

      hey, i resolved the error, it was a slight typo in the code, thank you so much for the wonderful tutorial, it is perfect! :)

  • @palashs1
    @palashs1 4 года назад +1

    I like your style wherein you encounter issues and solve them on the fly. Thank you..

  • @VivekKBangaru
    @VivekKBangaru 2 года назад

    Really Great demonstration with Lambda Function. Thank you so much.

  • @dukegaming2231
    @dukegaming2231 4 года назад

    Cheers .. my troubleshooting skills got better due to this video😁
    And literally this video is informative 👍..thanks

  • @retheeshandrews5798
    @retheeshandrews5798 Год назад

    Excellent video, thanks much for keeping the errors in the video and showing how you fixed them.

  • @SaiKiran-kd6cq
    @SaiKiran-kd6cq 3 года назад

    I am on half way but this video is damn useful unlike some who advertise more and have less content. This is exactly the opposite of that .Very Impressive .

  • @uppalaadarsh3261
    @uppalaadarsh3261 3 года назад

    all these we can perform under free tier , or these costs to aws account ??

  • @chinarquality
    @chinarquality 3 года назад

    Super thanks for wonderful lambda lab

  • @arig2519
    @arig2519 3 года назад

    Very nice video, especially explaining the errors! Do you have any reference (document or video) for working with Lambda and EC2? I have tried using basic Lambda functions such as describe.ec2 and so on but I am not sure what I should setup as Trigger in the AWS Console?

  • @neohubris
    @neohubris 3 года назад

    yo you're not making any more videos?

  • @fccorno
    @fccorno 3 года назад

    How to handle error inside lambda? Thanks

  • @prabhatpal1153
    @prabhatpal1153 4 года назад

    Really its great explanation error with solution.

  • @dillipsahu8306
    @dillipsahu8306 Год назад

    excellent course with super explanation.

  • @aritra8820
    @aritra8820 2 года назад

    in my S3 there are 3 buckets but it is returning only one

  • @tuberyou2058
    @tuberyou2058 3 года назад

    could you show us how to use aws cli with lambda and python

  • @deepthirj7610
    @deepthirj7610 Год назад

    Please make videos on flask, Hadoop like that

  • @nirojdeb6615
    @nirojdeb6615 3 года назад

    Hello can you open a discord server or do you have one already?

  • @dyroblesmercedes
    @dyroblesmercedes 4 года назад

    liked just because of minecraft

  • @samanehghafouri5743
    @samanehghafouri5743 3 года назад

    Thank you it was perfect! I realized whenever you get errors and you see your code looks fine, you just need to go back and save your code again, and it will work fine! I think there is a delay for aws to execute code in lambda.

  • @JuniorShepherd
    @JuniorShepherd 2 года назад

    Excellent tutorial and I appreciate your honesty in showing us your errors and how you fixed them. That enhances the learner's experience. :)

  • @peterlom6160
    @peterlom6160 4 года назад

    Very nice tutorial! Non-sarcastic comment: your tiny hiccups made this EXCELLENT because you showed us how to locate errors.

  • @vinaykumar-qq9wq
    @vinaykumar-qq9wq 3 года назад

    Definitely a good tutorial including debugging stuff, Keep up good work.,

  • @viniciushenrique8211
    @viniciushenrique8211 Год назад

    Great tutorial! Thanks, bro

  • @JulioSerratos
    @JulioSerratos 2 года назад

    I love this tutorials where the speaker commits errors and debbugs on real time. Just like all humans do. Just like me

  • @andresgutierrez3965
    @andresgutierrez3965 2 года назад

    Great video, thanks for sharing

  • @Oumayma_essarhi
    @Oumayma_essarhi Год назад

    Thank you it was very useful

  • @lavakumar5181
    @lavakumar5181 2 года назад

    Please do more videos on python and lambda

  • @febinmohammed6160
    @febinmohammed6160 4 года назад

    Please continue doing videos with pyton. Thaknx👍🏻

  • @swetasingh4404
    @swetasingh4404 3 года назад

    It's really helpful for beginners ...thanks 👍

  • @NateG459
    @NateG459 4 года назад

    How does it know to put an item for put_item and to return an item for get_item, are they functions?

  • @sridharb8154
    @sridharb8154 4 года назад

    Awesome video , please upload more videos on Lambda with Python

  • @subhajitmishra8597
    @subhajitmishra8597 4 года назад

    That helped me a lot. Thanks for he video and also can you please make a video on how to get data from a form or any dynamic page and store it in dynamodb using lambda and apigateway ! Also if possible please make a video abt how to use boto3 commands(u know the aws boto3 documents)

  • @mhashmi3593
    @mhashmi3593 4 года назад

    Good one. Please add more complex Lambda functions for some realistic application or based on something microservices in Python.

  • @kesterbelgrove818
    @kesterbelgrove818 3 года назад

    Thank you, thank you , thank you. I was looking for a beginners course in lambda and you did it. The errors in it were super helpful also as it helps with finding and resolving issues that I may have in the future. Keep up the good work and again.... thank you

  • @KundanKumar-uu9ws
    @KundanKumar-uu9ws 4 года назад

    Great job...keep up the good work. It was really helpful. Your content was very good.

  • @susajsn3314
    @susajsn3314 2 года назад

    why not 2 times neptune added?

  • @anthonygonsalvis121
    @anthonygonsalvis121 4 года назад

    @Cloud Path, Very nice, step-by-step explanation without any mindless cliche typical of the industry. Thank you and please keep up the good work.

  • @franciscogustavomotamunoz7077
    @franciscogustavomotamunoz7077 3 года назад

    Congratulations, a natural and great tutorial, you make it seem simple, thakyou

  • @swathinr4286
    @swathinr4286 4 года назад

    Exactly what I was looking for. Brilliant video!! Liked, subscribed :)

  • @rossbrook9182
    @rossbrook9182 2 года назад

    great video, thanks

  • @nisarg5345
    @nisarg5345 3 года назад

    Why status code 200?

  • @sameerforyou01
    @sameerforyou01 4 года назад

    can i run curl commands from aws lambda? please share!!