AWS Fargate cannot access dockerized spring boot application over Load balancer/ public IP

好久不见. 提交于 2021-02-10 17:35:36

问题


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

and

load_balancer_public_dns:8081/my_reset_end_point

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.

Tutorials followed: https://medium.com/underscoretec/deploy-your-own-custom-docker-image-on-amazon-ecs-b1584e62484

https://medium.com/faun/aws-fargate-services-deployment-with-continuous-delivery-pipeline-b67d33407c88


回答1:


Based on the comments and chat discussion.

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.

There are two solutions to this problem:

  • 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.


来源:https://stackoverflow.com/questions/63352705/aws-fargate-cannot-access-dockerized-spring-boot-application-over-load-balancer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!