最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

AWS Elastic Beanstalk docker compose services network issue - Stack Overflow

programmeradmin2浏览0评论

I am deploying my microservices to Elastic Beanstalk and faced some issues. My API Gateway service is working as I performed the /healthcheck endpoint and managed to receive response. However, when trying the /login endpoint to my authentication service, I receive 500 Internal Server Error because the API gateway service is unable to connect to the authentication service. This is the error received from logs:

api-gateway_1             | 2025/03/09 13:56:29 HTTP Error: Internal Server Error | Details: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial tcp: lookup authentication-service on 127.0.0.xx:53: no such host"

I even hardcoded the connection string to authentication-service:50051 but it still failed. I pushed 2 images to ECR and then ran eb init and eb create. The following is my docker-compose.yml file that was used to deploy my application.

version: '3.8' # Or another supported version
services:
  api-gateway:
    image: '<AWS_ACCOUNT_ID>.dkr.ecr.ap-southeast-1.amazonaws/my-repository:api-gateway'
    ports:
      - '80:80'
    environment:
      MODE: production
    deploy:
      resources:
        limits:
          memory: 512M
  authentication-service:
    image: '<AWS_ACCOUNT_ID>.dkr.ecr.ap-southeast-1.amazonaws/my-repository:authentication-service'
    ports:
      - '50051:50051'
    environment:
      MODE: production
      POSTGRES_USER: FROM_ENV
      POSTGRES_PASSWORD: FROM_ENV
      POSTGRES_HOST: FROM_ENV
      POSTGRES_PORT: 5432
      POSTGRES_DB: mydb
    deploy:
      resources:
        limits:
          memory: 512M

Does anyone know why? I will upvote if problem is fixed

发布评论

评论列表(0)

  1. 暂无评论