无法在AWS EC2 – Linux实例中打开公共IPv4 DNS。

huangapple go评论52阅读模式
英文:

Unable to open Public IPv4 DNS in AWS EC2 - Linux instance

问题

我有一个Spring Boot项目,我想在AWS-EC2实例上托管它。我能够使用Git-hub、Jenkin和Docker创建它的镜像。我还成功地在我的AWS-EC2实例的Linux控制台中拉取并运行了这个镜像。

根据我遵循的教程,我现在应该能够使用公共IPv4 DNS打开项目,但我得到的响应是拒绝连接。

我知道这通常与入站规则有关,所以我添加了一条规则以允许所有流量,但这并没有帮助。

对于任何想了解的人:
GitHub仓库:https://github.com/SalahuddinShayan/telecom
Docker Hub仓库:https://hub.docker.com/repository/docker/salahuddinshayan/telecom
我在AWS中使用的运行镜像的命令:

docker run -p 8081:8081 --name final-app --link docker-mysql:mysql salahuddinshayan/telecom

安全组:无法在AWS EC2 – Linux实例中打开公共IPv4 DNS。

网络详细信息:
无法在AWS EC2 – Linux实例中打开公共IPv4 DNS。

这是错误信息:无法在AWS EC2 – Linux实例中打开公共IPv4 DNS。

我完全被困扰了。有人有什么想法来修复这个问题吗?

英文:

I have a Spring boot project which I want to host on an AWS-EC2 instance. I was able to create its image using Git-hub, Jenkin and docker. I was also able to successfully pull and run this image in the Linux console of my AWS-EC2 instance.

According the tutorial I was following I should have been able to open the project now using the public IPv4 DNS but the response I got was that it refuse to connect.

I know that this usually has to do with Inbound rules so I added a rule to allow all traffic but it didn't help.

For anyone who wants to know:
Git-hub repository: https://github.com/SalahuddinShayan/telecom
Docker-Hub repository: https://hub.docker.com/repository/docker/salahuddinshayan/telecom
Command I used to run the image in AWS:

docker run -p8081:8081 --name final-app --link docker-mysql:mysql salahuddinshayan/telecom  

Security Groups:无法在AWS EC2 – Linux实例中打开公共IPv4 DNS。

Networking Details:
无法在AWS EC2 – Linux实例中打开公共IPv4 DNS。

Here is the Error:无法在AWS EC2 – Linux实例中打开公共IPv4 DNS。

I am completely stumped by it. Does anyone an idea on what to do to fix this?

答案1

得分: 2

请检查您的客户端是否调用了正确的协议,例如 http 与 https。

英文:

Please check if your client is calling the right protocol, e.g. http vs https.

答案2

得分: 1

你正在使用8081端口传输。从EC2端来看,http://3.110.29.193:8081/运行正常。出现了404状态,这意味着这是客户端的错误,而不是服务器端的错误。

这意味着没有防火墙阻止流量,而且找到了一个进程(你的应用程序)监听的IP:端口,这是你需要的。问题在于遇到的进程(你的应用程序)只发送一个白标签错误页面,这是一个通用的Spring Boot错误页面,当没有自定义错误页面时显示。因此,问题出在Spring应用程序本身,而不是EC2或连接。换句话说,流量可以到达你的Spring应用程序,但你的Spring应用程序没有响应。

另外一点,部署应用程序后,我建议优化入站流量规则,只允许你想要的流量,不需要允许所有端口的所有流量。

英文:

You are transmitting on port 8081. http://3.110.29.193:8081/ works fine from the EC2 side. 404 status is raised, so this is a client side error, not a server side error.

It means that no firewall is blocking traffic and a process (your app) was found that listens on IP:Port that you require. The problem is that the process it encountered (your app) is sending only a WhiteLabel Error Page, which is a generic Spring Boot error page that is displayed when no custom error page is present. So the issue is with the Spring app itself and not with EC2 or with connection. In other words: the traffic can reach your Spring app, but your Spring app has nothing to say in response.

As a side note, after deploying your app I would advise to refine the inbound traffic rules to allow only the traffic you want. There is no need of allowing all traffic on all ports.

huangapple
  • 本文由 发表于 2023年2月18日 21:29:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/75493669.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定