unable to access localhost URL of AWS from local machine - amazon-web-services

I have a AWS EC2 instance running and I am supposed to access the localhost URL of the instance. Whenever I try the localhost:port/index.html URL I get a server not responding error. I tried using the public IP of the instance instead, but that failed. I configured AWS by exposing the particular port number for the inbound traffic (IP : 0.0.0.0/0) that did not work either. How should I configure so that I can access the URL?

If a service is running at localhost:45984 on an EC2 instance, you cannot access that server from your browser on your local machine unless you employ port forwarding.
Here's a good article that explains the different concepts:
https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding
I believe what you want is local port forwarding, where you set up a tunnel so that you can access "localhost:45984" on your EC2 instance from some port you specify on your Mac.

Related

Can't reach to an AWS EC2 instance website

I just launched a instance on AWS and I'm trying to open the website. So I copy the Public IPv4 address and paste it on my page. But it always returns This site can’t be reached 35.78.183.239 took too long to respond.
I've changed my firewall setting to access google chrome and set security groups HTTP, HTTPS. I can't figure out where the problem is. Any suggestions?
You didn't specify what webserver or AMI is on your EC2 instance.
You need to setup an AMI or manually install and setup a webserver for anything to show, otherwise the EC2 instance, while reachable, will not respond.
Make sure that ssh access is enabled and try ssh into the machine. If you can successfully login, then you know the instance is reachable and the problem is with your webserver software. This will help you debug.
What port is your application running on? When you enable HTTP and HTTPS it only allows ports 80 and 443 on the security group. This won't help if your application runs on a different port, so you'll need to add that to your security group to allow inbound traffic.

Connection refused error with AWS + Hashicorp Vault

I have configured a Hashicorp Vault server on a EC2 instance. When trying to use postman to test transit secret engine API I keep getting a error connection refused on postman, I went full ape mode and opened all ports on the security group inbound rule and it didn't work, I attached an elastic IP to the instance and didnt work either, im just trying with a simple GET and I just keep getting the same connectionrefused error.
When I use cUrl on the ssh connected session i have no issues though. The specified hosted adress is 127.0.0.1:8200, in postman I replaced that localhost with the public adress of the instance that i obviously censored in the screencap, in the headers theres the token needed to access vault, for simplicity I was just using the root token.
Postman screecap if it helps
#Emilio Marchant
I have faced similar issue (not with postman, but with telnet), Let's try to understand problem here.
The issue is with 127.0.0.1 IP. This is loopback IP and When you (or your computer) call an IP address, you are usually trying to contact another computer on the internet. However, if you call the IP address 127.0.0.1 then you are communicating with the localhost – in principle, with your own computer.
Reference link : https://www.ionos.com/digitalguide/server/know-how/localhost/
What you can try is below.
Start vault dev server with --dev-listen-address parameter.
Eg:
vault server -dev -dev-listen-address="123.456.789.1:8200"
in above command replace '123.456.789.1:8200' with '<your ec2 instance private IP : 8200'>
Next set VAULT_ADDR and VAULT_TOKEN parameter as below
export VAULT_ADDR='http://123.456.789.1:8200'
export VAULT_TOKEN='*****************'
Again replace 'http://123.456.789.1:8200' with 'http://[Your ec2 instance private IP]:8200'
For Vault_token : you should get a root token in console, when you start vault server , use that token
Now try to connect from postman or using curl command. It should work.
Reference question and solution :
How to connect to remote hashicorp vault server
The notable thing here is that the response is "connection refused". This error means that the connection is getting established and it found that there are no processes running on that port. This error means that there is no issue with firewall. A firewall will cause the connection to either drop (reject) or timeout (ignore), but won't give "Econnrefused".
The most likely issue is that the vault server process is not bound to the correct network interface. There must be a configuration in hashicorp-vault to setup the IP on which to bind. Most servers, by default, bind only on loopback address which is accessible only from 127.0.0.1. You need to bind it to "all" network interfaces by changing that to 0.0.0.0. I am not aware of the specific configuration option of hashicorp vault, but there has to be something to this effect.
Possible security issue:
Note that some servers expect you to run it behind a reverse proxy so that you can setup SSL (https) and other authentication if needed. Applications like vault servers should not be publicly accessible on http without SSL.

publicly access app from aws ec2 instance

I have just started with aws ec2.
I have deployed a simple web app on ec2 which listens on port 12345.
After SSH-ing into the instance from my windows machine using putty and once connected using curl for the apps endpoint and using either localhost, private IP address as well as public Dns (IPv4) it works fine.It does not work with IPv4 public ip though.
I now want to make that app accessible from the internet via browser. But, when I use public Dns or even Ipv4 Public ip along with the port , and try to access , it is not accessible. I only get the message , "This site can’t be reached" from chrome.
I have Inbound rule setup for the security group associated with the instance,
which allows ,
all trafic, via all protocol , via all ports (0-65535), and also I have given the Source as Custom, with IP range of 0.0.0.0/0.
I also have added another rule with same attributes, except for Source a Custom with IP range of , ::/0.
Can someone advise me on the right way to do this.

I cannot connect my web server via public IP in AWS instance

I'm studying AWS.
But I have a problem that I cannot connect to my web server on my AWS instance
AWS instance is Windows Server 2012
this is my instance status
I want to connect my web server via public ip 52.78.47.142 outside the AWS instance
if I connect to the private ip 172.31.15.206 inside the instance, home page showed up.
But if I connect to the public ip 52.78.47.142 inside the AWS instance and outside the AWS instance, home page didn't show up both.
although I set a new rule for http protocol at port 80, it doens't work
any helps? thanks a lot...
open up tcp:80 port in the security group(Inbound) for the IP address of the machine from where your accessing the website( In this case your Desktop or Laptop IP address).
If you are trying to access the web server from another AWS Instance open the port for that particular Instance IP. For troubleshooting case you can open up All traffic and test it(Though this is not recommended)

Unable to access portal using IP address from Amazon EC2 windows instance

I deployed a Liferay portal on Amazon EC2 windows instance how to access that on client browsers, as I am trying using public IP address but it is giving message it can't be reached.
In order:
Make sure the service is working (telnet locally on 127.0.0.1 8080)
Make sure your instance has a public IP address
Modify the local instance firewall to allow traffic on 8080 (or disable the local firewall)
4.Configure the instance's security group to allow traffic on 8080
If all of above conditions are met, then it MUST work :)
There Few Things Which You Can Check and I think Can be Issue for Windows EC2 Instance.
1) Allow Specific Port In Security Group in AWS .
2) Then You Must allow that port in Windows Firewall ( Create a Rule )
Refer : https://technet.microsoft.com/en-us/library/cc753558.aspx