I have two instances. One is on the Public Subnet & the other is on the Private subnet of AWS. In the private system, I am performing some computation. And the public system is acting as the API endpoint.
My total flow idea is like this: When some request comes to the public server, the parameters should be forwarded to the private system, the computation will be done there and the result will be sent back to the public and from there the result will be fed back to the user.
In the private system, some python code is running. I did setup Apache-Flask in the private system. So the idea is when some requests are coming, from the public server the parameters will be extracted and another HTTP request will be fired to the private system. Computation will be done there and the response will return which will return to the client system.
I have two question, Is this a good approach? Any better way to implement the total scenario?
This is a commonly used pattern when separating Web Servers and App Servers in traditional Web Application setup, keeping the Web Servers in public subnets (Or keeping internet accessible) and the business rules kept in App Servers in the private network.
However, it also depends on the complexity of the system to justify the separation having multiple servers. One of the advantages of this approach is you can scale these servers separately.
Best way for communicating between two servers