Cloud arquitecture for web system

0

Hi, we have a system developed in python, the system is for answer questions about pdf legal text files using chatgpt api, works like this: User logins (mysql for validate and store user data), then the user make querys in natural language (we use chatgpt api, FAISS for vector embeddings), the system reads text pdf files stored in S3, and chatgpt answers in text and cite the corresponding pdf files with a link; for now we have all in a single ec2 instance (is for about 20 concurrent users), but what is the best aproach to publish this system?, please consider cost, availability and eficient.

Thanks C.

asked 10 days ago87 views
2 Answers
1

Hi,

You don't specify if you use a specific Python application framework like Flask.

So, here is an AWS-proposed architecture for a Flask-based application: https://github.com/aws-samples/three-tier-web-application-flask

Enter image description here

It is quite thorough with muliple AZs, Load Balancer, etc.

Best,

Didier

profile pictureAWS
EXPERT
answered 10 days ago
  • It looks very complete, we will discuss with developer, we are consider app runner for this too. Thanks for your answer.

0

If the usage level is fairly constant and you want to keep it on EC2 then right-size the instance type so you're only paying for the compute that you need. And consider a reserved instance to reduce costs over the longer-term.

If usage level varies the consider putting the EC2 instances into an auto-scaling group that grows and shrinks as required.

Although as EC2 can take a while to provision on-the-fly, you may want to containerise the application to mitigate this, and improve the user experience.

As your code is already written in Python it could be a good candidate for Lambda function, and implement the whole thing using a fan-out architecture. Caution here that a Lambda function has a maximum run time of 15 minutes, so each discrete invocation of the function would have to be less than this (if it's longer you could consider a Step Function, although it's probably better off on EC2 or containers in that case).

profile picture
EXPERT
Steve_M
answered 10 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions