Search code examples
amazon-web-servicesamazon-ec2

AWS Windows EC2 is in private subnet but website in IIS needs to be accessible from a public IP


On AWS, I have VPC containing public and private subnet. Internet Gateway and Routing Tables are configured. I have configured Windows AWS EC2 instance in private subnet. Necessary IAM role, System Manager and Session Manager is configured and working. Security group allows HTTPS requests from anywhere to port 443. I have hosted website in IIS on port 443. I want to access this website from any public IP through Public IPv4 DNS assigned by AWS. With above setup its not working.


Solution

  • Your EC2 instance is in a private network which means that it is not accessible from the Internet. This is the explicit purpose of using a private subnet.

    Your options are:

    • Put the EC2 instance in a public subnet, or
    • Put a Load Balancer in a public subnet (charges apply) and configure it to forward HTTP/S requests to the EC2 instance in the private subnet