cannot connect from app container to db container on ECS

1

I use Service Connect to connect Laravel app container to db container on ECS. When I ecs exec to app container and run php artisan migrate, nothing happens (no output). In addition, now I use database (mysql) as laravel cache, queue and session drivers but originally use redis. With redis configured as the drivers and run php artisan migrate I got the error like

protocol error, got 'H' as reply type byte

Note both redis and mysql works properly in local docker-compose env. I want to know the solution or trouble shooting method to this problem. Any trivial advice is welcome.

Related part of cloudformation is the following. App server service

ServiceConnectConfiguration:
        Enabled: true
        Namespace: !Ref ClusterName
        Services:
          - PortName: app-server
            DiscoveryName: app-server
            ClientAliases:
              - DnsName: app
                Port: 9000
        LogConfiguration:
          LogDriver: "awslogs"
          Options:
            awslogs-group: !Ref ECSLogGroup
            awslogs-region: !Ref AWS::Region
            awslogs-stream-prefix: app-server-service

DB server service

ServiceConnectConfiguration:
        Enabled: true
        Namespace: !Ref ClusterName
        Services:
          - PortName: db-server
            DiscoveryName: db-server
            ClientAliases:
              - DnsName: db
                Port: 3306
        LogConfiguration:
          LogDriver: "awslogs"
          Options:
            awslogs-group: !Ref ECSLogGroup
            awslogs-region: !Ref AWS::Region
            awslogs-stream-prefix: db-server-service

Due to word limit, I cannot post everything here but I will try to provide necessary info as much as I can. Related stackoverflow post Thanks,

No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions