简体   繁体   中英

aws ec2 public ip not at all working

I am very new to AWS. successfully launched EC2 windows 2012 r2 instance and i am able to login through remote desktop service. installed a nodejs app and it is successfully running on localhost:80. but, the problem is with public ip. i tried a lot of solutions posted around like adding inbound security rules and etc... i even terminated the instance and relaunched a new instance, but of no use.

server Details: AWS EC2 : Windows 2012 R2

when ever i try to access via public dns, it says "webpage not availabe". my public ip is http://ec2-54-169-173-68.ap-southeast-1.compute.amazonaws.com/

Here are the ping results:

C:\Users\srujan>ping ec2-54-169-173-68.ap-southeast-1.compute.amazonaws.com

Pinging ec2-54-169-173-68.ap-southeast-1.compute.amazonaws.com [54.169.173.68] with 32 bytes of data:
Reply from 54.169.173.68: bytes=32 time=51ms TTL=118
Reply from 54.169.173.68: bytes=32 time=51ms TTL=118
Reply from 54.169.173.68: bytes=32 time=49ms TTL=118
Reply from 54.169.173.68: bytes=32 time=43ms TTL=118

Ping statistics for 54.169.173.68:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:
Minimum = 43ms, Maximum = 51ms, Average = 48ms

What does the ping results show? Is the public ip working correctly?

Please let me know the solution. i was trying since many hours and left helpless. Let me know if any more details are required to solve the problem.

Thanks in advance.

EDIT:

Fiddler Result in browser:

[Fiddler] The connection to 'ec2-54-169-173-68.ap-southeast-1.compute.amazonaws.com' failed. 
Error: TimedOut (0x274c). 
System.Net.Sockets.SocketException A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 54.169.173.68:80

Fiddler Result in Fiddler window:

Request Count:   1
Bytes Sent:      413        (headers:413; body:0)
Bytes Received:  719        (headers:207; body:512)

ACTUAL PERFORMANCE
--------------
ClientConnected:    09:38:03.718
ClientBeginRequest: 09:38:03.735
GotRequestHeaders:  09:38:03.735
ClientDoneRequest:  09:38:03.735
Determine Gateway:  0ms
DNS Lookup:         0ms
TCP/IP Connect: 21007ms
HTTPS Handshake:    0ms
ServerConnected:    09:38:24.745
FiddlerBeginRequest:    00:00:00.000
ServerGotRequest:   00:00:00.000
ServerBeginResponse:    00:00:00.000
GotResponseHeaders: 00:00:00.000
ServerDoneResponse: 00:00:00.000
ClientBeginResponse:    09:38:24.745
ClientDoneResponse: 09:38:24.745

Overall Elapsed:    0:00:21.009

RESPONSE BYTES (by Content-Type)
--------------
text/html: 512
~headers~: 207


ESTIMATED WORLDWIDE PERFORMANCE
--------------
The following are VERY rough estimates of download times when hitting  servers based in Seattle.

US West Coast (Modem - 6KB/sec)
    RTT:        0.10s
    Elapsed:    0.10s

Japan / Northern Europe (Modem)
    RTT:        0.15s
    Elapsed:    0.15s

China (Modem)
    RTT:        0.45s
    Elapsed:    0.45s

US West Coast (DSL - 30KB/sec)
    RTT:        0.10s
    Elapsed:    0.10s

Japan / Northern Europe (DSL)
    RTT:        0.15s
    Elapsed:    0.15s

China (DSL)
    RTT:        0.45s
    Elapsed:    0.45s


________________
Learn more about HTTP performance at http://fiddler2.com/r/?HTTPPERF

Found the problem. its not with the port number or firewall. the problem is with the node.js program.

The error was:

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(80, '127.0.0.1');
console.log('Server running at http://127.0.0.1:80/');

I changed it to:

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen( 80 );
console.log('Server running at 80');

I just removed the localhost ip address. its working fine.

However, Thanks for your quick response and support.

ping only tells you that the instance is accepting and replying to icmp packets. Its helpful in determining if there are issues with the route, but does not help you identify all problems.

Your problem comes down to one of two likely options:

  1. A firewall is blocking the connection to port 80. This can include both the security group and windows internal firewall.
  2. Your web server is not bound to the network interface. Web servers can be configured to bind to a single IP provided by an interface, or listen to all of them. You can also bind a site to loopback which makes it only accessible to itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM