Reputation: 10881
I am too new to the cloud and AWS. I am working on some web application where I need to store some data on RDS.
In AWS cloud I am using Beanstalk
for deploying my java code and MySQL
as DB via AWS-RDS
.
My question is - Is it a good practice to have beanstalk [EC2]
and RDS
instance inside a same VPC
?
P.S: In this link the scenario is explained as possible, but I want to know what would be the best practice.
Upvotes: 5
Views: 2837
Reputation: 78803
Best practice is for the RDS instance to be multi-AZ, in private subnets, without a public IP, and reachable only by those systems that need access (typically the RDS instance's inbound security group will only allow access from the app servers).
Whether or not the app and the DB should be in the same VPC depends entirely on your architecture (e.g. you may have multiple apps all connecting to the same DB) but, in general, most deployments have the RDS instance in the same VPC as the app, typically in different subnets, otherwise you introduce complexities such as VPC peering or VPN between VPCs.
Upvotes: 10
Reputation: 200850
Your VPC is your private network. It is definitely best practice to have both the web servers and the database servers inside the same private network.
Upvotes: 3