Тёмный

AWS API Gateway to Lambda Tutorial in Python | Build a REST API 

Be A Better Dev
Подписаться 221 тыс.
Просмотров 332 тыс.
50% 1

API Gateway is a powerful AWS service that allows you to host a REST endpoint that is backed by an AWS service (in this case, Lambda). In this video, I show you how to create a REST Endpoint using API Gateway. Requests are served by a Lambda Function (as opposed to a traditional server). I start by creating a Lambda function and coding up a basic handler using Python (code below). From there, I create a API Gateway resource that acts as a publicly facing REST Endpoint. I continue to hook up the endpoint to the previously created Lambda function. Finally, I test the configuration by invoking the REST endpoint through my browser and verify my Lambda was serving the content back.
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...
00:16 Example Overview
01:35 Create a Lambda Function
06:55 Create an API Gateway
08:00 Connect API Gateway to Lambda
🎉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 Driver 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
📚 References / Resources:
Secure your REST API with Lambda Authorizer - • Secure your API Gatewa...
Lambda Beginner Overview - • AWS Lambda Introduction
Getting started with AWS: • Introduction to AWS | ...
Lambda function code - gist.github.com/djg07/678f7ae...
☁Topics covered include:
- Lambda Function Creation
- Lambda Function API Gateway Handler
- API Gateway Resource
- RESTful GET Endpoint
🌎 Find me here:
Twitter - / beabetterdevv
Instagram - / beabetterdevv
Patreon - Donations help fund additional content - / beabetterdev
#ApiGateway
#Lambda
#REST
#AWS
#Serverless

Хобби

Опубликовано:

 

25 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 338   
@BeABetterDev
@BeABetterDev 2 года назад
Looking to become an expert on AWS Lambda? Check out my new course: AWS Lambda - A Practical Guide www.udemy.com/course/aws-lambda-a-practical-guide/?referralCode=F6D1A50467E579C65372
@Venkat28s
@Venkat28s 2 года назад
Sorry this Course is not available in udemy. :)
@AlvinC-sz3li
@AlvinC-sz3li 3 года назад
As an AWS engineer I have to say, very good tutorial video. Why such a channel only has 21k sub??? For begineers, your videos are better than our official ones.
@santhoshinfo
@santhoshinfo 2 года назад
Thanks for your support . The subscribe count jump to 53k+ ...👍
@jasper5016
@jasper5016 Год назад
Now its 117K. Super fast.
@nikhilsingh7165
@nikhilsingh7165 Год назад
now its 149k
@ZachDTravels
@ZachDTravels Год назад
254k 😮
@ymahtab
@ymahtab Год назад
@@ZachDTravels subs, not views
@faithinverity8523
@faithinverity8523 4 года назад
Wow. Short, complete, accurate and useful. You are remarkably good at making instructional videos. Thank you.
@BeABetterDev
@BeABetterDev 4 года назад
Thanks for the kind words Faithin!
@vojtechkaiser2525
@vojtechkaiser2525 3 года назад
Great work! Appreciate you showing the event structure right at the beginning which is usually skipped by many.
@richard_franks
@richard_franks 3 года назад
Thanks a ton for your tutorial here. I just needed a quick rundown and this is exactly what I needed. Quick and concise.
@BeABetterDev
@BeABetterDev 3 года назад
Glad it helped!
@mrrobot6320
@mrrobot6320 4 года назад
Short and Simple. Best tutorials. Keep Teaching :). Thank you
@BeABetterDev
@BeABetterDev 4 года назад
You are very welcome!
@learndevtech
@learndevtech 2 месяца назад
This is the best exemplification I have ever seen so far. I could not find any other resources better than this channel.
@kishor777
@kishor777 3 года назад
I love 10 mins tutorial and this one is perfect 10 min tutorial. Thanks.
@BeABetterDev
@BeABetterDev 3 года назад
Thanks so much kishor!
@davidk7212
@davidk7212 10 месяцев назад
Very efficient, straight to the point, extremely helpful. Thank you.
@dileepdamodaran5573
@dileepdamodaran5573 3 года назад
No stories , to the point , Thank you ! Subscribed
@BeABetterDev
@BeABetterDev 3 года назад
Thanks dileep! And welcome to the channel :)
@vladventura1928
@vladventura1928 3 года назад
Man but like how good is this video?? You're insane! Thanks a lot! I was looking for something like this for a small learning project I have in mind with flutter and aws (just to learn aws because tbh its pretty daunting to me). Thanks a lot again!!
@BeABetterDev
@BeABetterDev 3 года назад
Thank you so much for such a kind comment, I really appreciate it!
@BilalAhmed-nt9gi
@BilalAhmed-nt9gi 3 года назад
This dude is way more Good then actual AWS guys. And video is super sharp to the point (Y) Loved it
@BeABetterDev
@BeABetterDev 3 года назад
Thank you so much for your kind words!
@WesDoyle
@WesDoyle 4 года назад
Great video! Thanks for demonstrating API Gateway + Lambda integration
@BeABetterDev
@BeABetterDev 4 года назад
Glad you enjoyed Wes.
@didismit1766
@didismit1766 4 года назад
Wow, everything I needed put together in one video!! Thanks alot bro!
@BeABetterDev
@BeABetterDev 4 года назад
You are very welcome didi!
@musejama8684
@musejama8684 3 года назад
Thank you bro for keeping it clean and simple. I love it.
@BeABetterDev
@BeABetterDev 3 года назад
Thanks Muse! Really appreciate the kind words.
@geodezix
@geodezix 4 года назад
get this ...{"transactionId": "5", "transactionType": "'PURCHASE'", "transactionAmount": "500", "message": "xyz says HELLO"} .... finally understand what api gateway/lambda is doing....great job AWS Simplified!
@BeABetterDev
@BeABetterDev 4 года назад
Great to hear I was able to help!
@tekken-pakistan2718
@tekken-pakistan2718 3 года назад
dude this is literally really simplified, thank you so much
@BeABetterDev
@BeABetterDev 3 года назад
Glad you liked it!
@praveendumpala5672
@praveendumpala5672 3 года назад
It was great to see and understand the basic flow with API Gateway + Lambda, thanks.
@BeABetterDev
@BeABetterDev 3 года назад
Glad it was helpful!
@rkumarjay
@rkumarjay 3 года назад
thanks. simple enough to get started with API gateway and integration points
@amitkarmakar6418
@amitkarmakar6418 3 года назад
Best Tutorial. You made it so simple. Thank You
@ajith_e
@ajith_e 11 месяцев назад
Simple and Effective, as always!!
@st3114rr
@st3114rr 2 года назад
Thanks so much for this awesome tutorial! Really clear and well-paced.
@BeABetterDev
@BeABetterDev 2 года назад
You're very welcome!
@humayunakhtar9515
@humayunakhtar9515 3 года назад
Amazingly great and simple to get point. Salute
@BeABetterDev
@BeABetterDev 3 года назад
Thank you so much for your kind words!
@phen2841
@phen2841 Год назад
What a fantastic tutorial! Great job!
@BeABetterDev
@BeABetterDev Год назад
Thank you! Cheers!
@sanrise27
@sanrise27 4 года назад
Great stuff!! Thanks a lot for the overview!!👍🏼
@BeABetterDev
@BeABetterDev 4 года назад
Thanks sanket!
@shivammpandey4503
@shivammpandey4503 2 года назад
Clear & Concise. Thanks
@prasadbelthur
@prasadbelthur 3 года назад
Good one. To the point. Simple. Best way to dive in.
@BeABetterDev
@BeABetterDev 3 года назад
Thanks Prasad!
@Hackenbaker
@Hackenbaker 2 года назад
Very well explainations. Good for a starting point. Thanks a lot.
@philipackerley5775
@philipackerley5775 3 года назад
Superb intro to using the API gateway, good tutoring skills!
@BeABetterDev
@BeABetterDev 3 года назад
Thanks phillip!
@SabbirAhmed-ev4rz
@SabbirAhmed-ev4rz Год назад
thanks man for this amazing video it helped me in completing my internship task keep up the good work
@zrqx
@zrqx Год назад
That was a concise tutorial. Thank you
@liochon4417
@liochon4417 3 года назад
to-the-point. Thx. Keep up the good work!
@BeABetterDev
@BeABetterDev 3 года назад
Thanks Lio!
@geostrategicinsights6801
@geostrategicinsights6801 3 года назад
Thank you so much! This was tremendously helpful!
@BeABetterDev
@BeABetterDev 3 года назад
You're so welcome!
@zhongdaochen8221
@zhongdaochen8221 2 года назад
Fantastic video, many thanks!
@devprakash5320
@devprakash5320 2 года назад
very well explained . Thanks for the video
@legoman01
@legoman01 Год назад
Good tutorial. Tested and it works
@arunelangovan7222
@arunelangovan7222 3 года назад
Well Explained. Simply Awesome. :)
@BeABetterDev
@BeABetterDev 3 года назад
Thanks a lot 😊
@kashif3683
@kashif3683 4 года назад
Wow! It was simple! Thanks.
@BeABetterDev
@BeABetterDev 4 года назад
Glad it helped!
@parthapaul1249
@parthapaul1249 2 года назад
Thanks a lot🙏🙏 Before watching this, I watched a couple of videos on lambda function, but still I couldn't understand what the hell lambda function is, you made it very clear...
@heikg
@heikg 3 года назад
Love this video. If only they gave examples like that in the official documentation, instead of just dry theory
@BeABetterDev
@BeABetterDev 3 года назад
Thanks for the kind words heikg. I'm glad you found it helpful :)
@andressapatanga9481
@andressapatanga9481 3 года назад
Gracias, me has salvado la vida compadre, desde Ecuador.
@BeABetterDev
@BeABetterDev 3 года назад
Thanks Andres!
@ashokgVideo
@ashokgVideo 3 года назад
To the point video. Appreciate it.
@BeABetterDev
@BeABetterDev 3 года назад
Glad it was helpful!
@TheLostBijou
@TheLostBijou 3 года назад
It could use updating, as AWS has changed its API Gateway UI substantially. GREAT WORK, THANKS!
@BeABetterDev
@BeABetterDev 3 года назад
Thanks for pointing this out Kent! Time for a new video :)
@TheLostBijou
@TheLostBijou 3 года назад
Go for it! If you need any help, I volunteer!
@samjones4327
@samjones4327 Год назад
Excellent tutorial! Thank you very much! I am enjoying your channel a lot. I'm just starting out with AWS but I'm super curious about how things work and you're becoming my one stop shopping channel! Cheers!
@franktumminello9166
@franktumminello9166 Год назад
Great video!
@rahulmarkonda
@rahulmarkonda 2 года назад
Nice and fast. Thanks.
@BeABetterDev
@BeABetterDev 2 года назад
You're very welcome Raul!
@nitesh2k6
@nitesh2k6 4 года назад
Woow it is very nice explanation with example .. it help me to understand API with Lambda.. Thanks
@BeABetterDev
@BeABetterDev 4 года назад
You are most welcome
@Bigshotdata
@Bigshotdata Год назад
Great video super insightful thanks!
@gopalakrishnanp2046
@gopalakrishnanp2046 Год назад
Great explanation and good demo
@alaaeddinekolli4178
@alaaeddinekolli4178 Год назад
Magnifique ! thanks for this tutorial
@jiyongwang2459
@jiyongwang2459 2 года назад
Great tutorial. Helped me on how to handle event with python. I am using a Lambda function to perform Geocode and REST API for client to invoke the API
@BeABetterDev
@BeABetterDev 2 года назад
Glad it helped Jiyong!
@marco114
@marco114 2 года назад
Thanks for the tutorial. This helped me resolve an error I was getting.
@BeABetterDev
@BeABetterDev 2 года назад
Glad it helped!
@theascendcommerce
@theascendcommerce 2 месяца назад
Thank you for this one
@joedunder4439
@joedunder4439 Год назад
Thanks! Very helpful.
@BeABetterDev
@BeABetterDev Год назад
You're welcome!
@morenoaf
@morenoaf 11 месяцев назад
Great explanation
@BeABetterDev
@BeABetterDev 10 месяцев назад
Glad it was helpful!
@vijay3107
@vijay3107 2 года назад
Wow wow wow, made it very easy and understandable. thanks
@BeABetterDev
@BeABetterDev 2 года назад
You are welcome 😊
@hasmize
@hasmize 2 года назад
Thanks man. I am new to Cloud but somehow I managed to secure somewhat senior position as AWS DevOps Engineer and now facing the music. I came across a similar requirement, Thanks for the help Sir
@sateeshkumarchillakuru4222
@sateeshkumarchillakuru4222 3 года назад
Let me try ,..happy to get this video
@BeABetterDev
@BeABetterDev 3 года назад
Thanks Sateesh. Were you able to create your API?
@beatalert123
@beatalert123 5 месяцев назад
Awesome video..!! I am planning to create ETL data pipes using lambda + API gateway and then use step functions or MWAA to orchestrate the Lambda.
@paulking1796
@paulking1796 3 года назад
Thanks a lot, this was really helpful!!!!! Have a nice day :)
@BeABetterDev
@BeABetterDev 3 года назад
You're very welcome paul, and you too!
@mustaphag
@mustaphag 3 года назад
Excellent work
@BeABetterDev
@BeABetterDev 3 года назад
Thank you! Cheers!
@TomerBenDavid
@TomerBenDavid 4 года назад
Splendid 👌more videos please
@BeABetterDev
@BeABetterDev 4 года назад
Coming soon!
@cheribgh275
@cheribgh275 3 года назад
Awesome!!!! thanks a lot.
@branstark3622
@branstark3622 4 года назад
Great video, no only this but all the others in the channel too. I dont like the sounds with the mouth when starting new words, but anyway best AWS channel in youtube so far.
@BeABetterDev
@BeABetterDev 4 года назад
Thanks for the feedback!
@sachinpc702
@sachinpc702 4 года назад
Great job with the video
@BeABetterDev
@BeABetterDev 4 года назад
Thanks!
@shraddhasable5416
@shraddhasable5416 2 года назад
thanks for sharing...it was really helpful.
@BeABetterDev
@BeABetterDev 2 года назад
You're very welcome
@gordonbrown3716
@gordonbrown3716 3 года назад
NIce tutorial on api and lamda function
@BeABetterDev
@BeABetterDev 3 года назад
Thanks Gordon!
@whchi9252
@whchi9252 8 месяцев назад
nice video, thanks
@kono163
@kono163 4 года назад
Great tutorial! this is just memo for other beginners. ●can't test in lambda console? try something like this ↓ { "queryStringParameters":{ "transactionId": "5", "type": "purchase", "amount": "100" } } ●internal server error? you need equal in line 25 ↓ responseObject['headers'] = {} and check typos . Thanks!
@BeABetterDev
@BeABetterDev 4 года назад
Thank you for the catch!
@reddylakshmi8071
@reddylakshmi8071 2 года назад
Really ur videos r so good
@BeABetterDev
@BeABetterDev 2 года назад
Thank you so much 😀
@denizbalc8685
@denizbalc8685 4 года назад
Youre great person thanks for help
@BeABetterDev
@BeABetterDev 4 года назад
Happy I could help!
@chilld3666
@chilld3666 4 года назад
Very helpful!!
@BeABetterDev
@BeABetterDev 4 года назад
Glad I was able to help!
@jorgeluishernandez7964
@jorgeluishernandez7964 3 года назад
good video, thank you so much.
@BeABetterDev
@BeABetterDev 3 года назад
Glad you liked it!
@cstanleyhns
@cstanleyhns Год назад
Well presented. Would be good to see the API Gateway raise an event to Event bridge and then Event bridge match to the Lambda and return the same way.
@gamblerau
@gamblerau 4 года назад
Thanks!
@jasper5016
@jasper5016 Год назад
Thanks so much.
@BeABetterDev
@BeABetterDev Год назад
You're welcome!
@hhhhhhhhhhhhhhhh3484
@hhhhhhhhhhhhhhhh3484 2 года назад
Great tutorial. Explained better than even AWS official ones. One suggestion: Next time show how you debug the error also. I get that you use cloud trail here but it'll still be useful to newcomers
@BeABetterDev
@BeABetterDev 2 года назад
Thank you Harsha for the kind words and the feedback!
@timothyle4820
@timothyle4820 Год назад
@@BeABetterDev What was the fix to that error anyway?
@ladynobug8759
@ladynobug8759 2 года назад
Thanks, great content!
@BeABetterDev
@BeABetterDev 2 года назад
Thanks no bug!
@ladynobug8759
@ladynobug8759 2 года назад
@@BeABetterDev 😆
@vijeandran
@vijeandran 2 года назад
Nice video
@BeABetterDev
@BeABetterDev 2 года назад
Thank you!
@kyleesposito6672
@kyleesposito6672 3 года назад
OMG, thank you sooooo much for this video!!! Building a simple website for my wedding in a few months and wanted to be able for folks to RSVP online and the data loaded to a dynamoDB server to keep everything organized. Spent literally all day yesterday going thru guides and documentation with no success. Would just be curious if you would need to do anything differently for a post method instead of get. Web design is not my forte, which is why I wanted this project to challenge myself. Thanks again!!!
@BeABetterDev
@BeABetterDev 3 года назад
Hi Kyle! Thanks for watching and congratulations on your wedding. I'm also getting married soon and hope you're able to have a happy day despite covid. In terms of your question, the only difference is that you would select the POST method during the api creation in API gateway. Also, the location of the parameters being passed into your lambda function will change (they will likely no longer be in the query param's field, but instead in the 'body'). The quickest way to find out where is just to console.log the input object (event) and find out where in the object the param's are being passed. Hope this helps and feel free to reach out if you have any followup Q's.
@blessyRelatable
@blessyRelatable 2 года назад
Thank you
@BeABetterDev
@BeABetterDev 2 года назад
You're very welcome manasa!
@sanfilmstudio
@sanfilmstudio 3 года назад
thanks a lot bro!
@BeABetterDev
@BeABetterDev 3 года назад
You're very welcome Alex!
@sagarsinghrajpoot6788
@sagarsinghrajpoot6788 4 года назад
Nice Video :)
@BeABetterDev
@BeABetterDev 4 года назад
Thanks for the visit
@rajathkunder5162
@rajathkunder5162 21 день назад
You saved me
@bradchellingworth2002
@bradchellingworth2002 3 года назад
Very nice tutorial. New subscriber here :)
@BeABetterDev
@BeABetterDev 3 года назад
Thanks Brad! Welcome to the channel :)
@julianjneuss
@julianjneuss 3 года назад
Thanks a lot m8
@BeABetterDev
@BeABetterDev 3 года назад
You're very welcome Shorsh!
@InfantGerald
@InfantGerald Год назад
Thanks
@BeABetterDev
@BeABetterDev Год назад
Thank you so much for your generosity!
@felixvanderspek1293
@felixvanderspek1293 3 года назад
a cool little trick to use if you want to print a variable name and its value is to do (with transaction_id as example): print(f'{transaction_id=}')
@BeABetterDev
@BeABetterDev 3 года назад
Thanks for this cool tip Felix!
@OmprakashYadavIIT
@OmprakashYadavIIT 3 года назад
nice video..
@BeABetterDev
@BeABetterDev 3 года назад
Thanks!
@prannoyroy5312
@prannoyroy5312 Год назад
Great video. One doubt I faced at work. How do you choose between having one big lambda function with Flask Python code internally handling all the routing for different endpoint v/s one seperate Python lambda(without Flask) for each Api gateway resource? Which is a better design and better performing?
@egehanyorulmaz4965
@egehanyorulmaz4965 11 месяцев назад
Straight to the point. Thank you. I was wondering how we could add an authentication to the request as well. My request returns Missing Authentication Token. I don't want to make the API public as it is sending a separate request to a paid API.
@biniyammengiste7413
@biniyammengiste7413 3 года назад
good job
@BeABetterDev
@BeABetterDev 3 года назад
Thank you! Cheers!
@squirrel1620
@squirrel1620 2 года назад
In our use case, we built an API Gateway to call a collection of microservices, from lambda(new code) & HTTP (legacy code). It works well, but I'd advise anyone working on a serverless architecture to look into how to keep lambdas "warm"
@BeABetterDev
@BeABetterDev 2 года назад
Good advice Derek, Provisioned Concurrency is a life saver!
@xammocoloniax
@xammocoloniax Год назад
As others already mentioned --- what's the fix for the line 25 syntax error that you said you'd get back to?
@go_sh4627
@go_sh4627 4 месяца назад
I love this, this is very straight forward. But as a beginner in the field of AWS I just want a clarification. The method you used, why GET and not POST method?
@drazaie
@drazaie Год назад
Great video! Looks like queryStringParameters doesnt work in AWS with the new Python 3.10. Any ideas how to correct this?
@venkatbubly
@venkatbubly 3 года назад
Great start, thank you for the video. Just asking, how did it worked for you without a = in responseObject['headers'] = {}?
@BeABetterDev
@BeABetterDev 3 года назад
Hi Venkatesh, You have a very fine eye :) I believe I corrected this during the video editing process. The code link should contain the corrected code. Daniel
@prasaianooz
@prasaianooz 3 года назад
brilliant! are you using vim keybindings in sublime ? I would love to see some vim tuts aswell
@kameronwong6754
@kameronwong6754 3 года назад
does anyone know how to get vim in sublime???
@taekhwanoh4268
@taekhwanoh4268 3 года назад
When I go to url, it only shows me the message which is "Hello from Lambda!" instead of showing all the json. Does anyone know how to fix this?
@funnychannel6975
@funnychannel6975 3 года назад
Can we query or insert data using a flask microframework? Please help me
Далее
Kim bo’ldi bu qiz?
00:17
Просмотров 1,7 млн
AWS Lambda Python functions with a database (DynamoDB)
25:12