I am going to deploy Nginx webserver to run my angular application in AWS ec2 and i have 2 subnets public and private. to reach my nginx web application I will use ALB which is in public subnet, now my question is
- can i deploy the Nginx webserver(ec2) in private subnet.
- in which case I should enable public IP to my nginx ec2 server
2
Answers
You should not assign a public IP address to the nginx EC2 server because:
You should deploy the Load Balancer in the public subnet and the EC2 instance in the private subnet.
Yes, you can. In ideal case the private webserver does not need any internet access.
The server does not require public IP. If you place it in a private subnet, and you want your server to access internet (e.g. to install packages or updates) you have to setup NAT gateway in a public subnet.