Let's suppose I have a web server which is an EC2 instance and an RDS.
The EC2 instance communicates with the RDS.
For security, I could have this set up behind an Application Load Balancer and use security groups to only allow inbound traffic through the ALB. The ALB will communicate with the internet only through HTTPS.
Internally I could set up a security group that accepts only incoming traffic from the security group of the ALB. I would attach this security group to the EC2 instance. I could then have another security group that allows incoming traffic only from the EC2 instance. This security group would be attached to the RDS.
The security group of the EC2 instance would allow outbound traffic over HTTPS for the purpose of updates, downloading packages, etc.
From my (limited) understanding of how this setup would work, communication with the RDS would have to happen strictly from the EC2 instance and inbound communication to the EC2 instance would have to happen strictly from the ALB which is configured to accept only requests through SSL.
In terms of security, is this setup safe?
What risks are there from running a set up like this?
What benefits, if any, are there from configuring private and public subsets like is shown here?