How To Build a CRUD (TO-DO) App on AWS using FastAPI and Python

  Рет қаралды 15,471

pixegami

pixegami

Күн бұрын

In this tutorial, you'll learn how to build and deploy a CRUD application (a "To-Do List" API) using Python, FastAPI and AWS. The application will be hosted serverlessly on the cloud, and will persist "to-do" (task) data for different users. We'll also write integration tests for our API using PyTest.
🛠 Essential Links
🔗 Code: github.com/pixegami/todo-list...
📚 Resources
🔗 AWS: aws.amazon.com
🔗 AWS CLI: aws.amazon.com/cli
🔗 AWS CDK: docs.aws.amazon.com/cdk/v2/gu...
🔗 Boto3 (Python AWS SDK): boto3.amazonaws.com/v1/docume...
💡 Related Videos
FastAPI with AWS Lambda: • Deploy FastAPI on AWS ...
Using AWS Lambda with DynamoDB: • AWS Lambda Python func...
PyTest Tutorial: • How To Write Unit Test...
📽 Chapters
00:00 CRUD app architecture
01:40 What are we building?
03:13 Infrastructure with AWS CDK
05:45 Creating the DynamoDB table
09:56 Create the AWS Lambda function
14:09 Creating a Lambda function URL
16:04 Deploying our CDK infrastructure
18:52 Python FastAPI application code
20:44 Package our Python dependencies for Lambda
24:49 Implement CRUD operations
36:45 Testing our CRUD API by hand
38:37 Writing integration tests with PyTest
43:22 Wrapping up
📷 Image by starline on Freepik
#fastapi #aws

Пікірлер: 45
@pixegami
@pixegami Жыл бұрын
What type of app do you want to learn to build next? Let me know!💡
@dragonballseriesepisodes3755
@dragonballseriesepisodes3755 Жыл бұрын
It would be great if you could build more fullstack saas applications like the AI driven saas application that you posted a while ago.
@ruslanskira
@ruslanskira Жыл бұрын
FastAPI + DynamoDB + admin dashboard aka Dajnago admin.
@rajuveerla9352
@rajuveerla9352 Жыл бұрын
It would be helpful, one complete python project by using technologies like Python + FastAPI + Dynamo DB + GraphQL + Pytest amd Postman for API testing
@gustavojuantorena
@gustavojuantorena Жыл бұрын
Thank you! Another great video
@khandoor7228
@khandoor7228 Жыл бұрын
Awesome thank you! This is gold!!!
@user-eq8in2xw6y
@user-eq8in2xw6y Жыл бұрын
Wow im blown away by how helpful these tutorials are. Clear speaking, insightful instruction. Insane these dont have 1m views
@pixegami
@pixegami Жыл бұрын
Thanks! I appreciate your command and I'm glad you found it clear and helpful. I plan to stay focused on quality, consistency and value for my viewers so I think we'll get to 1m views eventually :)
@user-eq8in2xw6y
@user-eq8in2xw6y Жыл бұрын
@@pixegami appreciate it man, just know your content is really helping us learn; easy to tell by the production quality you really care as well. I found you though AWS content might be an avenue to lean into
@biyenioseonyeagwu5736
@biyenioseonyeagwu5736 Жыл бұрын
10/10, awesome vid !!
@md.musfiqurrahaman8612
@md.musfiqurrahaman8612 Жыл бұрын
You are creating amazing contents man...Subscribed!❤❤
@pixegami
@pixegami Жыл бұрын
Thanks and welcome!
@jesusperdomo8388
@jesusperdomo8388 Жыл бұрын
Gracias!!!!!
@aamirm5117
@aamirm5117 Жыл бұрын
This was an excellent video and very helpful in getting up and running with FastAPI and Lambda. Perhaps you could do a follow-up video that makes the code ready for a production setup. Maybe additional error handling, user management, API authn, etc?
@pixegami
@pixegami Жыл бұрын
Thanks! Those are great suggestions, but I think to make something fully production-ready is going to be a LOT more than just one video :D I still have more to learn about that myself.
@aamirm5117
@aamirm5117 Жыл бұрын
@@pixegami Fair point, and maybe a full prod setup is a bit much. It would be nice to see this project iterated on a bit - maybe authn and error handling would be good next steps. For one, they help me achieve my own goals :-) and those additional changes build on something already established. I know the hate ToDo apps get, so maybe there is room to expand it to be something a bit more than a standard ToDo list, which would give you an excuse to show how you can extend the “Dyanamo DB schema” or whatever it’s called in DDB land. That might illustrate why it’s important to properly model the database before hand and could highlight some of the pain points devs encounter when modifying it later? Just spitballing, whatever you choose to make, I think your approach and cadence are just right, so please keep it up. Glad to be a new subscriber!
@odanilomedeiros
@odanilomedeiros 6 ай бұрын
How to set the version of pydantic I want to install on lambda? My deploy goes well but the API does not work, when I test on lambda it shows the message "Runtime.ImportModuleError: Unable to import module 'todo': No module named 'pydantic'" thank you bro
@pixegami
@pixegami 6 ай бұрын
Usually you can set it in your requirements.txt when you prepare your code for deployment. However, with issues like that, it's quite possible your Lambda is using a different architecture to the machine you are coding on (e.g. x64_86 vs arm64) so you have to make sure they match as well.
@pacoluna7969
@pacoluna7969 Жыл бұрын
Hi Pixegami! I'm looking a way to host a SPA made with react, I don't want to manage all the server related things and put it in a EC2, I see that i can do it from a S3 bucket or Amplify, which option you will recomend? (Even other not mention)
@pixegami
@pixegami Жыл бұрын
For hosting a static site (SPA), I think your main options are AWS (S3 bucket or Amplify), Firebase (Google), or Vercel. I personally prefer Vercel just for a SPA, because they are the easiest to use. AWS and Firebase have more features, but also more complex to learn. In terms of AWS, S3 is the technology you want to use. I'm pretty sure Amplify uses S3 behind the scenes. But you can use Amplify as well if it makes it easier (it just uses S3 anyway).
@pacoluna7969
@pacoluna7969 Жыл бұрын
@@pixegami Thanks a lot! I've seen a lot of your videos about Lambdasand FastAPI, this is the best way to host a FastAPI right? So i can connect it to my SPA
@snap-reviewsdotcom
@snap-reviewsdotcom 8 ай бұрын
@pixegami Great Tutorial, thanks but...Lambda is restricted to 6MB of data per function. So if you have an endpoint that has to return a lot of data, won't this fail? Would your other video where we just run FastApi on an EC2 instance be preferable (even though we have to manage scaling ourselves etc)
@pixegami
@pixegami 8 ай бұрын
Hmm, 6MB sounds like a lot of data to return from an API call. It might not be suitable for Lambda. Is this something that should be downloaded by the user instead? (e.g. via S3)
@snap-reviewsdotcom
@snap-reviewsdotcom 8 ай бұрын
​ @pixegami Thanks for responding. Thankfully I learned that FastAPI supports streaming, so we use that and not Lambda.@@pixegami
@tayfunslife
@tayfunslife Жыл бұрын
Can you make a video about EC2, ASG , LB, Target Group etc configurations by coding or yaml. Because ı always see console or ui page configurations but in enterprise life we need to create all these configuration with deployment script.
@pixegami
@pixegami Жыл бұрын
Ah yes I know what you mean. For my larger projects I actually do use infrastructure code. It's better to use an SDK for it rather than YAML or JSON, because it's type-safe and more powerful. For AWS you can use AWS CDK. I have a small tutorial about it here: kzbin.info/www/bejne/pWTWZYmnobKmipo
@JKhalaf
@JKhalaf Жыл бұрын
Nice video! What colour scheme are you using please?
@pixegami
@pixegami Жыл бұрын
For VSCode I’m using Monokai Pro. For the terminal, I used a custom theme which I explain in this video: My terminal setup (theme and plugin) on Ubuntu Linux 💻 kzbin.info/www/bejne/i6e8ZpR8fbOie9k
@chillvibes71
@chillvibes71 2 ай бұрын
Do we have to pay for any service ?? I would like to know before I start the project or I have to leave it in between . 😭.
@pixegami
@pixegami 2 ай бұрын
AWS Lambda has a free tier, so it shouldn't cost you until you use millions of requests.
@idcarlos
@idcarlos Жыл бұрын
Take a look over AWS SAM to automatize the process of upload the python code to AWS Lambda instead of create the .Zip by hand
@pixegami
@pixegami Жыл бұрын
Thanks for the suggestion, I'll definitely take a look.
@montecristo31
@montecristo31 Жыл бұрын
what distribution are you using?
@pixegami
@pixegami Жыл бұрын
In this video I am using Ubuntu Linux (probably 2020?) But nowadays I use a Mac M1, just because I use quite a lot of Adobe programs (which doesn’t run on Linux).
@durgeshpatil1344
@durgeshpatil1344 Жыл бұрын
Instead of typesrcipt language I choose to go with python , but I'm getting the error of my unzipped file size is large and exceeds the limit of lambda so It is not able to run the application , I have tried deleting If there are unnecessary libraries I'm zipping and uploading, as well I have also tried first uploading the file as asset to S3 and then using S3 bucket for lambda function ,still getting the same ,Please guide me I have been stuck at this problem from 1 week, will wait for you reply, Thankyou Great content!
@Bee-ib1pb
@Bee-ib1pb 11 ай бұрын
Have you tried using a lambda layer?
@RuslanSkiraUkraine
@RuslanSkiraUkraine 6 ай бұрын
I have the same and am stuck. I will try to return to simpler python code without FastAPI.
@rohitkrsingh
@rohitkrsingh Жыл бұрын
Can not see above 360p
@pixegami
@pixegami Жыл бұрын
The video might still be processing. Please try again soon!
@pradeeppawar3622
@pradeeppawar3622 Жыл бұрын
Build gpt3 powered app
@pixegami
@pixegami Жыл бұрын
I did something like that here: kzbin.info/www/bejne/r6ncqoyDjNpkkKM But I'm happy to do more of them! I love GPT-3.
@vivizhao2351
@vivizhao2351 Жыл бұрын
Thank you! Another great video
@pixegami
@pixegami Жыл бұрын
Glad you enjoyed it!
How to Run a Python Docker Image on AWS Lambda
13:08
pixegami
Рет қаралды 28 М.
Pydantic Tutorial • Solving Python's Biggest Problem
11:07
pixegami
Рет қаралды 254 М.
A clash of kindness and indifference #shorts
00:17
Fabiosa Best Lifehacks
Рет қаралды 133 МЛН
A little girl was shy at her first ballet lesson #shorts
00:35
Fabiosa Animated
Рет қаралды 14 МЛН
Задержи дыхание дольше всех!
00:42
Аришнев
Рет қаралды 3,6 МЛН
RAG + Langchain Python Project: Easy AI/Chat For Your Docs
16:42
Top 5 High Paying Tech Skills to Learn in 2024
16:10
pixegami
Рет қаралды 13 М.
This is apparently the most loved CRUD app of 2023
19:38
Dreams of Code
Рет қаралды 129 М.
Python FastAPI Tutorial: Build a REST API in 15 Minutes
15:16
PyTest • REST API Integration Testing with Python
37:24
pixegami
Рет қаралды 79 М.
How To Write Unit Tests in Python • Pytest Tutorial
35:34
pixegami
Рет қаралды 135 М.
How to Publish a Python Package to PyPI (pip)
11:38
pixegami
Рет қаралды 15 М.
A clash of kindness and indifference #shorts
00:17
Fabiosa Best Lifehacks
Рет қаралды 133 МЛН