skip to Main Content

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

  1. can i deploy the Nginx webserver(ec2) in private subnet.
  2. in which case I should enable public IP to my nginx ec2 server

2

Answers


  1. You should not assign a public IP address to the nginx EC2 server because:

    • It should only be accessed via the Load Balancer, and
    • It is in a private subnet, so the Public IP address will not work (that is, traffic will not be routed to the instance)

    You should deploy the Load Balancer in the public subnet and the EC2 instance in the private subnet.

    Login or Signup to reply.
  2. can i deploy the Nginx webserver(ec2) in private subnet.

    Yes, you can. In ideal case the private webserver does not need any internet access.

    in which case I should enable public IP to my nginx ec2 server

    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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search