Develop Lambdas Locally in VS Code Using AWS SAM | AWS Lambda Tutorial

Поділитися
Вставка
  • Опубліковано 25 лис 2024

КОМЕНТАРІ • 63

  • @Jonathan.Davies
    @Jonathan.Davies  2 роки тому +11

    Pssst be sure to subscribe. It’s free 😁

  • @Krokodil986
    @Krokodil986 Рік тому +3

    Thank you so much! Some feedback on the video: the video was very clear on what to do, very well-spoken, very calm, the format was amazing as well.
    However one small thing that may help future viewers: I actually created a lambda function before watching this video and made the first few changes in the in-built code editor on the aws website. Which was a bad experience.
    So I did not have a template.yaml, which meant i could not use the "sam build" command, as it would throw an error. Instead what I realised I could do is:
    thru the aws extension in vs code, click on "Lambda" to expand it, find my lambda function, right click on it and select "upload lambda". Then select "Directory", then "Yes", choose the folder containing your js script, and select ok/confirm. This will update the code in the backend to match the code in your VS Code instance.

  • @nickwaters8464
    @nickwaters8464 9 місяців тому +1

    thanks for your mic investment, we can hear and understand very clearly

  • @normanluismadrid422
    @normanluismadrid422 Рік тому

    short, concise, and super helpful, thank you so much for this!

  • @jaimemenendezalvarez5796
    @jaimemenendezalvarez5796 2 роки тому +3

    Wow, that tutorial was awesome! Simple and clear! A similar one but with CDK would be great. Thank you very much! I hope you get many more subscribers. The content, video format, quality and explanation are incredible.

    • @Jonathan.Davies
      @Jonathan.Davies  2 роки тому +1

      Thank you Jaime! It's made me very happy to hear you enjoyed it, so that's kind of you to say. Good idea with CDK too. Thanks for watching 👍

  • @DaveTheDeveloper
    @DaveTheDeveloper Рік тому

    very concise tutorial. helped a lot!

  • @janaeshkrish
    @janaeshkrish 2 роки тому +1

    great tutorial man! Expecting more contents in SAM-AWS

  • @clivejefferies
    @clivejefferies Місяць тому

    Awesome intro, thanks.

  • @xavierromerocarrion1369
    @xavierromerocarrion1369 7 місяців тому

    Great content you put it through.
    Keep it up

  • @ankitagoyal4211
    @ankitagoyal4211 Рік тому +1

    Great video to begin with. I am having a small issue, after running the san build command, I am not able to see HelloWorld function under .aws-sam. I am doing my runtime in Python3.8, so is that because of this?

  • @modoulaminceesay9211
    @modoulaminceesay9211 3 місяці тому

    wonder why theres no content hosted my website thanks to your tutorial and now learning lamda thanks to your channel.

  • @raginig_27
    @raginig_27 2 роки тому +2

    Great explanation, Thank you.🙂
    Please make a video on "How to create serverless application by using AWS-SAM, LAMBDA, API-Gateway, any DB(like dynamoDB or mongoDB etc..) and it also includes swagger file by using nodeJS.

    • @Jonathan.Davies
      @Jonathan.Davies  2 роки тому +3

      Thanks Ragini - that's nice of you to say. Good idea 👍

  • @JeffersonRequina
    @JeffersonRequina Рік тому +4

    Great video mate. Earned a sub :) BTW, please make a video on how to locally debug an existing Lambda functions and bring it to VSCode. Cheers!

  • @ricardoespana3766
    @ricardoespana3766 Рік тому

    great vocalization!

  • @koduje
    @koduje Рік тому

    Great stuff man :)

  • @mandheermaan
    @mandheermaan 2 роки тому +1

    Perfectly Demonstrated !!!

  • @kazanjyan
    @kazanjyan Рік тому

    good work, thank you for the intro

  • @vitaliishemetov609
    @vitaliishemetov609 Рік тому

    Thanks. Good explanation

  • @Gustavo-uc9rr
    @Gustavo-uc9rr 6 місяців тому

    awesome man, thanks a lot!

  • @jgreene9999
    @jgreene9999 Рік тому

    Jon, really excellent tutorial. I have one question. In my code I used a fetch function to HTTP Post to another server. Testing and run worked great locally. When I deployed --guided, I am getting error of needing global fetch in aws console. At one point you talk about zipping build file and uploading. Would this help getting away from functionality not support in the lamba node.js 18.x base image? Thank you.

  • @coderlicious6565
    @coderlicious6565 Рік тому +1

    Excellent vid, thank you.
    Do you know if there is a way to configure your AWS lambda account, to tell Amazon a max dollar amount you want to spend, and then if you accidentally exceed that amount with your resources, they either immediately notify you, or just simply shut down your site? I'd prefer it works that way.
    I'd hate to get a big surprise bill from amazon, because I didn't know my code was very inefficient, and the code was spending too much time during a function invocation.

    • @Jonathan.Davies
      @Jonathan.Davies  Рік тому +2

      Thanks @coderlicious6565. Yes, AWS Budgets is what you want - docs.aws.amazon.com/cost-management/latest/userguide/budgets-managing-costs.html. Will be doing a video on it in future. You'll get an notification if you exceed your budget, which is a good idea because I've forgotten about some stuff and had to pay £35 😁

    • @coderlicious6565
      @coderlicious6565 Рік тому +1

      @@Jonathan.Davies Thank you, much apprec

  • @eugeniosp3
    @eugeniosp3 Рік тому +1

    nice video quality Jon. underrated channel in youtub'e shit algorithm

    • @Jonathan.Davies
      @Jonathan.Davies  Рік тому

      @eugeniosp3 haha cheers bro 👊

    • @eugeniosp3
      @eugeniosp3 Рік тому +1

      @@Jonathan.Davies hey i man i know this might be a pain in the ass but if u could add chapters that would be amazing. after watching 4-5 of thes tutorials i just want to skip to the parts i need. just $0.02

    • @Jonathan.Davies
      @Jonathan.Davies  Рік тому

      @eugeniosp3 yeah that’s fair enough, will leave more detailed chapters in future vids 👍

  • @alexbigar9769
    @alexbigar9769 2 роки тому

    Great work! Thank you.

  • @GlenStarrett
    @GlenStarrett Рік тому

    Thanks for the super helpful introduction! I have a question: How do you get your local copy updated if you make a change in the AWS console UI? E.g. someone just made a "quick fix", is there a resync operation or pull from AWS?

    • @GlenStarrett
      @GlenStarrett Рік тому

      Actually further to my first question -- is there a way to capture the metadata you set up in the AWS console (e.g. permissions, triggers) back into the local yaml (I assume that's where the permissions and triggers would go)?

  • @dorongol
    @dorongol Рік тому

    Thanks for the great video! This is very helpful... but I do have one question I couldn't find an answer to, and I'll be happy to see a video that covers it: Is it possible to create multiple lambda functions within the same project (and deploy them)? If so - how? I have an API with multiple endpoints, and it does not make sense to create a new project for each endpoint... or is it?

    • @Jonathan.Davies
      @Jonathan.Davies  Рік тому

      Thanks for watching Doron. You can create multiple lambdas in the same project by just defining as many AWS::Serverless::Function's as you need in the template.yml (and making sure there is a corresponding codeUri link to to the code for the new lambda - the original function's code lives in hello-world/, you'd need to create ... - for example - ... hello-world-1/ and write the Lambda code in there ). This would allow you to have multiple lambdas in same project and deploy them. As for the multiple endpoints and multiple projects, without seeing your API or knowing your requirements, I'd agree that you don't need multiple projects. My HTTP API video (ua-cam.com/video/7u1p5dieIh8/v-deo.html) shows how you can have an API with multiple endpoints but this is only backed by one lambda. Will try and touch on this in more detail in future video 👍

  • @l.e.nichols9382
    @l.e.nichols9382 8 місяців тому

    how can i send a request to this from postman? the request doesnt return anything

  • @vinsonyung537
    @vinsonyung537 2 роки тому

    Great job man👍

  • @arleyyap99
    @arleyyap99 2 роки тому

    Thanks. I have a question about how the template.yaml configuration would be if instead of using api gateway use alb ?

    • @Jonathan.Davies
      @Jonathan.Davies  2 роки тому

      No worries Arley. Alb isn't supported as an Event Source under SAM (docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-property-function-eventsource.html), you'll most likely need CloudFormation. People have been asking for the same thing here though - github.com/aws/serverless-application-model/issues/721, so maybe we will see it in a future release. Thanks for watching

  • @wesmckean1443
    @wesmckean1443 2 роки тому

    nice tutorial. much appreciated. do I need to delete everything to prevent any charges?

    • @Jonathan.Davies
      @Jonathan.Davies  2 роки тому

      Thanks Wes. Yes I'd clean it up once you're finished 👍

  • @XboxPlayerPL
    @XboxPlayerPL 4 місяці тому

    what glasses are you wearing Jonathan? They look nice.

    • @Jonathan.Davies
      @Jonathan.Davies  3 місяці тому

      They are some Ray Ban frames. I'd defo recommend

  • @hgiangphan
    @hgiangphan Рік тому

    Great video!!
    Questions:
    1) I want to implement least privilege and am currently adding the permissions one by one according to the CloudFormation error logs outlining whatever permissions are still missing. Is there a way to figure out which permissions are required to deploy this CloudFormation stack (i.e., sam for lambda)?
    2) The "outputs" section of template.yaml states that an API gateway endpoint will be created along with the Lambda instance and IAM role. Is it possible to change the default outputs, say, not creating an API Gateway endpoint since I want to invoke Lambda using the functional URL instead of the API Gateway?

    • @Jonathan.Davies
      @Jonathan.Davies  Рік тому +1

      Thanks Kristen.
      1) The SAM CLI prompt to create the IAM role during deployment etc doesn't create anything extraneous but if you are taking extra effort to understand least privilege, this is probably your best approach to know exactly what's going on under the hood.
      2) Yes, if you remove the API Gateway section and add a FunctionURLConfig under the function definition in the template.yml - you can then reference the FunctionURL in the outputs section. See this link for examples of both: docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-property-function-functionurlconfig.html

    • @kumarayyappa1667
      @kumarayyappa1667 10 місяців тому

      It took me a while to figure out on adding policies one by one by checking the clod formation error logs, I was scraching my head

  • @modoulaminceesay9211
    @modoulaminceesay9211 3 місяці тому

    Wonder why we have no new videos

  • @karthikkarthik100
    @karthikkarthik100 2 роки тому

    Wow!!

  • @dhanushkagimhanDG
    @dhanushkagimhanDG 2 роки тому

    Thanks bro ❤

  • @proterotype
    @proterotype 2 роки тому

    New sub here. Could you cover grabbing data from an http site then bringing it in through lambda into an S3 bucket? (I’m thinking metrics from a site like Prometheus)

    • @Jonathan.Davies
      @Jonathan.Davies  2 роки тому +1

      Thanks for subbing and commenting Nate. I've got a video on API Gateway coming soon - part of that shows how you can inject a http request into the event that your Lambda receives (which could apply to part of your scenario). Either way - sounds like a good idea. I'll look into it

    • @proterotype
      @proterotype 2 роки тому

      @@Jonathan.Davies Love it. See you there

  • @zozoro9377
    @zozoro9377 Рік тому +1

    Can we run locally without docker?

  • @victormendoza3295
    @victormendoza3295 2 роки тому

    My worry is this is extra steps that the cicd pipeline should take care of.

  • @user-ov1ps7go4m
    @user-ov1ps7go4m Місяць тому

    4:05

  • @user-ov1ps7go4m
    @user-ov1ps7go4m Місяць тому

    5:15