仅使用EC2实例时的EADDRNOTAVAIL [英] EADDRNOTAVAIL while using EC2 instance only

查看:91
本文介绍了仅使用EC2实例时的EADDRNOTAVAIL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的节点应用程序正在侦听端口8080.添加时

My node application is listening to port 8080. When I add

app.listen(port,'50.30.217.289');

我可以从浏览器访问该应用程序.但是,当我用EC2实例的弹性IP地址替换IP地址时,出现错误:

I can access the application from the browser. But when I replace the IP address with the Elastic IP address of my EC2 instance, I get an error :

EADDRNOTAVAIL

EADDRNOTAVAIL

我该如何解决?

推荐答案

您要尝试的不是它在EC2中的工作方式.

What you are trying to do is not how it works in EC2.

公用IP地址通过网络地址转换(NAT)映射到主要专用IP地址.

The public IP address is mapped to the primary private IP address through network address translation (NAT).

http://docs.aws.amazon. com/AWSEC2/latest/UserGuide/using-instance-addressing.html

如果检查计算机上的网络接口,则在它们上将找不到任何公共IP地址.公用IP地址在Internet网关上转换为专用地址.对于具有公共IP地址的实例,此操作无需配置即可自动完成.

If you examine your network interfaces on the machine, you won't find any public IP addresses on them. The public IP addresses are translated onto the private addresses at the Internet gateway. This is done automatically with no configuration needed, for instances with public IP addresses.

要将服务绑定到特定的公共地址,请将其绑定到实例本身上匹配的 private IP地址.

To bind a service to a specific public address, you bind it to the matching private IP address on the instance itself.

这篇关于仅使用EC2实例时的EADDRNOTAVAIL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆