Deploy a SpringBoot API on AWS Lambda in 10 minutes

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 มิ.ย. 2024
  • SpringBoot is the most widely used application framework in Java, but did you know you can run your SpringBoot applications on AWS Lambda in as little as 10 minutes without changing a single line of code.
    In this video we dive into taking an existing Spring API and deploying that to AWS Lambda in 10 minutes using the AWS Serverless Application Model.
    00:00 - Introduction
    00:35 - The Deployed API
    01:40 - The Serverless Java Container
    02:10 - Add a Lambda Handler
    05:00 - AWS SAM Templates
    07:20 - Compile your application
    08:00 - SAM Deploy
    10:00 - API in Action
    Links
    GitHub Repo - github.com/jeastham1993/java-...
    AWS Serverless Java Container - github.com/awslabs/aws-server...
    AWS Lambda - aws.amazon.com/lambda/
    AWS SAM - aws.amazon.com/serverless/sam/
    Web - jameseastham.co.uk
    Twitter - / plantpowerjames
    LinkedIn - / james-eastham
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @nebur43
    @nebur43 ปีที่แล้ว +7

    Excelent video. Thank you very much. For those who use free tier, some tips for no cost.
    1 - for ddbb (DatabaseStack), change machine and use: InstanceClass.T4G, InstanceSize.MICRO
    2 - dont use NAT gateway (NetworkingStack)
    3 - Dont use awsSecret. Instead, use user/password directly (only for testing purpose)

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

      I really appreciate the comment, and I've updated the GitHub repo to have the first 2. My preference is to keep the secret in place, purely to demonstrate the best practices. But The DB and Nat Gateways are done :)

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

    Thank you for wrapping up everything in such a short time and just show what is needed! Awesome!! 🙂

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

    thanks for this video, pretty clear n useful. new sub :)

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

      Glad it helped, there will be plenty more coming in this series over the next few weeks. Thanks for subscribing :)

  • @RahulSingh-cl3wm
    @RahulSingh-cl3wm 6 หลายเดือนก่อน

    Awesome, great video.

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

    Thanks fort his video!!

  • @miguelmallqui9472
    @miguelmallqui9472 10 หลายเดือนก่อน +1

    thanks! great video

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

    Really nice vid thx

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

    pleaase do more videos about spring boot serverless architecture,dto to entity mapping etc ..thank youuuuuu

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

    great video 👍

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

    great video thanks, just so I understand, when the lambda is invoked is it starting up the spring boot application every time? seems like that would be pretty slow, so I hope not.

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

      Thanks! Whenever a new Lambda execution environment is created then yes Sprint Boot needs to startup up every time. I have another video in the same playlist on Lambda SnapStart which prevents this though, its well worth checking that out as well 😀

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

    Wonderful video. Would you mind to explain how we can deploy it as native with GraalVM, PLEASE? 🥺

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

      Hey Mikhail, I certainly will look at doing that in the future. Thanks for reaching out 🎉☺️

  • @EduardoMatoso-bx8if
    @EduardoMatoso-bx8if 9 หลายเดือนก่อน

    Thanks!

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

    Thanks

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

    whats spins up springboot app ? is it main method of @Springbboot app or the one inside handler?

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

    Excellent vid. 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.

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

      You can set budgets on your account so that you get notified when your spend goes over a certain level. Link below.
      You can also use things like reserved concurrency in Lambda to control the scaling behaviours. If this is a personal AWS account you're using for learning you can also delete all of your infrastructure when you're not using it. Serverless resources are quick to spin up and tear down, so deleting them when you're not using them removes the risk completely.
      aws.amazon.com/aws-cost-management/aws-budgets/

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

      @@serverlessjames Perfect, thanks a mil for your response.

  • @Likrant
    @Likrant ปีที่แล้ว +4

    Please be care with sources for this video. It set up with xlarge2 database, which consumed from me $200 in several days without any usage!

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

      Sorry to hear that, and thanks for pointing it out, I'll update the source code.

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

      @@serverlessjames also $30 for NAT Gateway (VPC as I understood)

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

      @Likrant Good to know. What a kind of DB it was? I plan to use DynamoDB which is free up to 25 GB so I hope that I will avoid such problems

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

    Good video but I feel it lacks few explanations, for example, all pom.xml dependencies used, postgres configuration and its integration with lambda etc.

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

      Great feedback, thanks. I try to keep my videos short and to the point, but these would have been good additions.

  • @Diego-oe7fy
    @Diego-oe7fy 11 หลายเดือนก่อน +2

    Hi James! I've really appreciated your videos for learning about AWS Lambda. I've got an application on SpringBoot 3 that follows the aws-serverless-container, but for whatever reason the Lambda function keeps returning blank response body and headers. When I set it up to run locally (without AWS Lambda function), everything works perfectly. Could you please help me troubleshoot?

    • @serverlessjames
      @serverlessjames  11 หลายเดือนก่อน +1

      Do you have a GitHub repository or something you could share?

    • @Diego-oe7fy
      @Diego-oe7fy 11 หลายเดือนก่อน

      @@serverlessjames my github repo link seems to have gotten deleted. Is there any other way to send this to you?

    • @serverlessjames
      @serverlessjames  11 หลายเดือนก่อน

      @@Diego-oe7fy feel reach to reach out on social media? Twitter maybe. My username is @plantpowerjames

    • @Diego-oe7fy
      @Diego-oe7fy 11 หลายเดือนก่อน +1

      @@serverlessjames alright! I followed you

    • @serverlessjames
      @serverlessjames  11 หลายเดือนก่อน

      @@Diego-oe7fy Great, feel free to drop me a direct message.

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

    Im assuming you have lamba apigw proxy set up which requires very particular set up as response like status code, body, 64endcoding.
    Do you have send it back as httprespond type from springboot?

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

      There's no manual configuration of the API Gateway. AWS SAM configures all of the API Gateway resources and then the serverless Java container manages the translation from API GW to Spring and back again

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

    Can CodePipeline, Codecommit auto deploy(CICD) springboot to AWS Lambda ?

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

      Yes, absolutely!

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

      ​@@serverlessjames Thank you, can you add a new video for that part?

  • @muneshwarsingh9474
    @muneshwarsingh9474 11 หลายเดือนก่อน

    Could you please give a way to deploy it through aws console as my organisation hasn't given me permission to use sam.

    • @serverlessjames
      @serverlessjames  11 หลายเดือนก่อน

      Is there another tool you are allowed to use? Terraform, CDK etc?

    • @muneshwarsingh9474
      @muneshwarsingh9474 11 หลายเดือนก่อน

      @@serverlessjames yes we are allowed to use terraform...but we can't use SAM.
      pls provide some solution..

  • @fit.rathore
    @fit.rathore 2 หลายเดือนก่อน

    waist of time.

    • @serverlessjames
      @serverlessjames  2 หลายเดือนก่อน

      Could I ask why?

    • @fit.rathore
      @fit.rathore 2 หลายเดือนก่อน +1

      @@serverlessjames waist of time for beginners. You didn't explain about some configuration like sam file some dependency and all. How can a beginner figure it out what happened in background. And how dependency is relevant to which part.
      And please this is only feedback not a hate about you.

    • @serverlessjames
      @serverlessjames  2 หลายเดือนก่อน

      @@fit.rathore It's really great feedback, thank you for taking the time to reply :)