Deploy a SpringBoot API on AWS Lambda in 10 minutes
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/jea...
AWS Serverless Java Container - github.com/aws...
AWS Lambda - aws.amazon.com...
AWS SAM - aws.amazon.com...
Web - jameseastham.c...
Twitter - / plantpowerjames
LinkedIn - / james-eastham
Пікірлер: 50
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
Жыл бұрын
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 :)
thanks for keeping it simple!
Thank you for wrapping up everything in such a short time and just show what is needed! Awesome!! 🙂
Thanks, great video!!
Awesome, great video.
pleaase do more videos about spring boot serverless architecture,dto to entity mapping etc ..thank youuuuuu
Wonderful video. Would you mind to explain how we can deploy it as native with GraalVM, PLEASE? 🥺
@serverlessjames
Жыл бұрын
Hey Mikhail, I certainly will look at doing that in the future. Thanks for reaching out 🎉☺️
thanks for this video, pretty clear n useful. new sub :)
@serverlessjames
Жыл бұрын
Glad it helped, there will be plenty more coming in this series over the next few weeks. Thanks for subscribing :)
thanks! great video
Thanks fort his video!!
Really nice vid thx
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
Жыл бұрын
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 😀
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
Жыл бұрын
Great feedback, thanks. I try to keep my videos short and to the point, but these would have been good additions.
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
Жыл бұрын
Sorry to hear that, and thanks for pointing it out, I'll update the source code.
@Likrant
Жыл бұрын
@@serverlessjames also $30 for NAT Gateway (VPC as I understood)
@ksdekamil
Жыл бұрын
@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
great video 👍
@serverlessjames
Жыл бұрын
Thanks Julio 😄
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
Жыл бұрын
Do you have a GitHub repository or something you could share?
@Diego-oe7fy
Жыл бұрын
@@serverlessjames my github repo link seems to have gotten deleted. Is there any other way to send this to you?
@serverlessjames
Жыл бұрын
@@Diego-oe7fy feel reach to reach out on social media? Twitter maybe. My username is @plantpowerjames
@Diego-oe7fy
Жыл бұрын
@@serverlessjames alright! I followed you
@serverlessjames
Жыл бұрын
@@Diego-oe7fy Great, feel free to drop me a direct message.
whats spins up springboot app ? is it main method of @Springbboot app or the one inside handler?
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
Жыл бұрын
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
Жыл бұрын
@@serverlessjames Perfect, thanks a mil for your response.
Can CodePipeline, Codecommit auto deploy(CICD) springboot to AWS Lambda ?
@serverlessjames
Жыл бұрын
Yes, absolutely!
@blockchain_bull
Жыл бұрын
@@serverlessjames Thank you, can you add a new video for that part?
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
Жыл бұрын
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
Thanks!
Thanks
Could you please give a way to deploy it through aws console as my organisation hasn't given me permission to use sam.
@serverlessjames
Жыл бұрын
Is there another tool you are allowed to use? Terraform, CDK etc?
@muneshwarsingh9474
Жыл бұрын
@@serverlessjames yes we are allowed to use terraform...but we can't use SAM. pls provide some solution..
waist of time.
@serverlessjames
5 ай бұрын
Could I ask why?
@rathoreias
5 ай бұрын
@@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
5 ай бұрын
@@rathoreias It's really great feedback, thank you for taking the time to reply :)