r/flask • u/bee_aayy • Apr 14 '24
Tutorials and Guides Flask Deployment on AWS ECS
Hello! I have a fitness application that has around 3000 daily active users. Now, I want to scale it horizontally and I want to deploy it on AWS ECS and I am facing trouble with security groups, services, rules. Basically, I have never deployed on AWS before. Now, I want to deploy it on short notice for production. So, Kindly share any quick related helpful tutorial or guide. Thanks! PS: Currently It’s on digital ocean droplet and I have created docker image already and uploaded on amazon elastic registry. Image runs well on local. I have attached RDS with it. Having trouble connecting to Document Cluster.
3
u/baubleglue Apr 14 '24
I don't know an answer, but number of daily users means almost nothing. You need to look first for the number of concurrent users at pick time (active sessions) and max requests per second.
1
2
u/androgeninc Apr 14 '24
Cant help with guides, but are you sure you need to switch to AWS for scaling? What are the bottlenecks that AWS will solve?
1
u/bee_aayy Apr 14 '24
Need horizontal scaling for server, like our marketing team run campaigns and we got user load on server. According to the marketing team they said soon we will have around 8K daily active users. That’s why I thought to use containers for scaling. also my manager is getting on my nerves over this.
2
u/androgeninc Apr 14 '24
All right, understood. I'm not gonna tell you you're wrong, but keep in mind this: https://thmsmlr.com/cheap-infra
And wouldn't it be easier to just put a load balancer in front on DO, and add more droplets behind?
1
u/bee_aayy Apr 14 '24
I am new to this, however I tried implementing load balancer on DO droplet and It became slower.
2
u/androgeninc Apr 14 '24
Haha, backend architecture is the gift that keeps giving. AWS is great, but I would personally revisit load balancing on DO. Sounds overkill to need fancy AWS scaling solutions for an app with 8000 daily users. Know this doesn't help you. Just my 2 cents.
Edit: Also, the bottlenecks are kind of important.
1
u/bee_aayy Apr 14 '24
Checked APIs responses, they’re good. Structure wise, implemented Factory method pattern. Used ORMs for databases. Queries are pretty basic and simple ones.
1
1
1
u/caspii2 Apr 15 '24
My App has 10-20k visits per day. Single Flask instance running on Digital Ocean. I think you’re fine on DO. Sounds like a case of premature optimization
1
3
u/TollwoodTokeTolkien Apr 14 '24
You say your company wants it on AWS. Is EKS an option? Yes, it's another ~$72/month or so for the K8s control plane but IMO there are less issues with figuring out security groups and routing rules with EKS than ECS, especially with EKS managed node groups. Plus it's a lot easier to move your K8s manifests/Helm charts to AKS/GKE should your company decide to pull out of AWS.