I'm most familiar with AWS EC2 (ubuntu linux box) and MySQL (RDS via AWS) databases; I'd like to update my development stack to a React setup. Is it possible to run a React app hosted on an EC2 and utilize a MySQL database? I have a free tier micro EC2 instance running with SSH admin access (connected via PuTTY), and credentials to connect to my RDS MySQL instance. Any best-practice advice on how to wisely proceed is appreciated.
1 Answers
3
votes
Your are mixing up frontend development and backend development.
React is more often than not used in a 3 tier architecture. Where there are 3 components:
- The presentation layer:
- Your react app
- A bunch of static files served by S3 or CloudFront
- Sends request to the application layer
- Never access the database directly
- The application layer:
- Your application server (PHP, Nodejs, etc)
- Takes requests from the untrusted client, verify it's validity and updates the database accordingly
- In your case, running on EC2
- The database layer:
- Your RDS MySQL instance
- Is only accessed by your application server
Please have a read here for more details: