“Secure Architecture on AWS ( Hosting WordPress on Public and Database on Private Subnet )” by Raktim Midya - https://link.medium.com/7R7TZnmfbab
So, we use WordPress software with dedicated database server.Database should not be accessible from the outside world for security purposes. We only need to public the WordPress to clients.
-
- Write an Infrastructure as code using terraform, which automatically create a VPC.
-
- In that VPC we have to create 2 subnets:
-
- public subnet - Accessible for Public World!
-
- private subnet - Restricted for Public World!
-
- Create a public facing internet gateway for connect our VPC/Network to the internet world and attach this gateway to our VPC.
-
- Create a routing table for Internet gateway so that instance can connect to outside world, update and associate it with public subnet.
-
- Create a NAT gateway for connect our VPC/Network to the internet world and attach this gateway to our VPC in the public network
-
- Update the routing table of the private subnet, so that to access the internet it uses the NAT gateway created in the public subnet
-
- Launch an ec2 instance which has WordPress setup already having the security group allowing port 80 so that our client can connect to our WordPress site. Also attach the key to instance for further login into it.
-
- Launch an ec2 instance which has MYSQL setup already with security group allowing port 3306 in private subnet so that our WordPress vm can connect with the same. Also attach the key with the same.