I have an webpage(UI) which is hosted in EC2 instance ( In private subnet) and accessible only in RDP (created in the same VPC) using IP address of the instance and port no (IP address:port no.). Now I want to make the webpage public ( anyone can access it )… without opening the ports to public….
Any method to do it…pls help.
For backend services am using network load balancer and API gateway for accessing it locally
Question posted in Amazon Web Sevices
The official Amazon Web Services documentation can be found here.
The official Amazon Web Services documentation can be found here.
2
Answers
To access a user interface (UI) deployed on a private EC2 instance from your local machine, you can set up a secure remote connection using SSH tunneling. Here’s a general outline of the steps involved:
Replace
<path-to-private-key>
with the path to your private key file,<username>
with the appropriate username, and<EC2-instance-IP>
with the IP address or hostname of your EC2 instance.This command forwards the local port 8080 to the EC2 instance’s port 8080.
http://localhost:8080
. The request will be forwarded through the SSH tunnel to the EC2 instance, allowing you to view the UI.Note: Make sure the UI service is running on the specified port (8080 in the example) on the EC2 instance, and any necessary firewall or security group rules are configured to allow inbound connections to that port.
Remember to replace
<path-to-private-key>
,<username>
,<EC2-instance-IP>
, and the port number (8080
in the example) with the appropriate values based on your setup.Additionally, if your EC2 instance is located in a private subnet and does not have direct internet access, you may need to set up a bastion host or VPN connection to establish a secure connection to the private network before following the steps above.
You need an application load balancer here. Create an application load balancer in your public subnet and route traffic from the application load balancer to your web UI (EC2 instance in a private subnet). You will also need to point your DNS to the load balancer’s FQDN.