AWS Fargate无法通过负载均衡器/公共IP访问dockerized的Spring Boot应用程序 [英] AWS Fargate cannot access dockerized spring boot application over Load balancer/ public IP
问题描述
在创建AWS Fargate集群之后,我已经在aws ECR上部署了我的spring boot应用程序的docker映像.PFA的屏幕截图,说明了任务,安全性,服务和集群定义.我可以成功ping通我的公共IP.但是我无法通过负载均衡器或公共ip访问我的应用程序.我尝试访问应用程序的网址是
I have deployed the docker image of my spring boot application over aws ECR, following creation of AWS fargate cluster. PFA screenshots of the configurations stating task, security, service and cluster definition.I can ping my public ip successfully. But I can't access my application over neither load balancer nor public ip. The urls I tried to access application were
public_ip:8081/my_rest_end_point
public_ip:8081/my_rest_end_point
和
load_balancer_public_dns:8081/my_reset_end_point
load_balancer_public_dns:8081/my_reset_end_point
我测试了使用端口8081和我在Fargate容器配置中为端口映射配置的相同8081端口在本地主机上运行docker映像(参考:服务定义).如何访问我的应用程序?我关注了Medium和AWS上的几乎所有文章.
I have tested running my docker image on local host using port 8081 and the same 8081 port I have configured for port mapping in my Fargate container configuration (reference: service definition). How can I access my application? I have followed almost all the articles over Medium and AWS.
教程紧随其后: https://medium.com/underscoretec/部署您自己的自定义docker-image-on-amazon-ecs-b1584e62484
推荐答案
基于评论和聊天讨论.
遵循了教程使用两个子网创建CIDR范围为 10.0.0.0/16
的自定义VPC .没有没有互联网网关(IGW);随后,在VPC中启动的Fargate任务无法访问互联网,也无法从互联网访问它们.
The tutorial followed creates a custom VPC with CIDR range of 10.0.0.0/16
with two subnets. There is no internet gateway (IGW); and subsequently, the Fargate tasks launched in the VPC have no internet access nor they can't be accessed from the internet.
此问题有两种解决方案:
- 使用默认VPC 可以正确提供Internet访问权限
- 创建使用 IGW 和相应的路由表设置的自定义VPC(或修改现有的VPC). AWS文档.
- use the default VPC which correctly provides internet access
- create a custom VPC (or modify existing) that is setup with IGW and the corresponding route tables. An example of a custom VPC with internet access is in AWS docs.
这篇关于AWS Fargate无法通过负载均衡器/公共IP访问dockerized的Spring Boot应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!