Say my app backend on AWS consists of:
- a VPC containing a public subnet and an internet gateway
- In the subnet is a single EC2 instance running a web server
- an RDS MySQL DB (running on port 3306)
I understand that I will need to configure the subnet with a network ACL to only allow traffic on the web server's port (80). I also understand that I will need to configure the EC2 instance to be managed by a security group that will also only allow port 80 traffic.
Now then, I have the following needs:
- I need a way to point requests to my web server's public DNS (say, http://myapp.example.com) to the EC2 instance, and ensure there are traffic routes in place for that
- I need a way to allow my web server to communicate with RDS/MySQL over port 3306
I understand I will need a routing table to accomplish all of this (possibly multiple routing tables), and that I will need to add routes (traffic rules) to this table. But I am unsure of which resources to associate with the routing table to make this all happen, and why?
Do I create a routing table and associate it with the internet gateway, the VPC or the subnet (or something else)? Which routes do I add to this table? Thanks for any help here.