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.

已提问 1 个月前281 查看次数
2 回答
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
专家
已回答 1 个月前
  • 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
专家
Steve_M
已回答 1 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则