Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to Aurora MySql with Aws ECS fargate container #76

Open
junaid-ahmed92 opened this issue Mar 19, 2020 · 2 comments
Open

Comments

@junaid-ahmed92
Copy link

I have a .net core 3.1 application which is deployed as docker container on AWS Ecs with fargate. I'd created 2 new Aurora MySql dbs and tried to connect to one of the db cluster by using the writer endpoint. Now the issue is when I try to call the POST method through postman by calling load balancer DNS, I am getting the following exception:

"An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure()' to the 'UseMySql' call."

I'd also tried adding retry pattern as mentioned in the exception but no luck.
I've allowed Aurora/MySql on port 3306 from anywhere in my security group which I created for RDS. I'd also added Aurora/MySql on port 3306 for source "My cluster service security group and also load balancer security group" but even then no luck. Finally I added All traffic on all ports from anywhere but even then the error was same. So I suspect it's something different.
I've then tried running the application through the docker desktop on my windows but I still got the same error there.

An error occurred using the connection to database '' on server 'db-cluster.cluster-cqb2jskhx78p.us-east-2.rds.amazonaws.com'.

My connection string is:
"DefaultConnection": "Data Source=db-cluster.cluster-cqb2jskhx78p.us-east-2.rds.amazonaws.com;Initial Catalog=demodb;User ID=admin;Password=MyPassword;port=3306"

Any help?

@sikemullivan
Copy link

I have the same issue. Had any luck since you posted this?

@sikemullivan
Copy link

sikemullivan commented Aug 27, 2020

Yea, I feel stupid. The Terraform "endpoint" property that I was using to build the connection string for the container had the port number.

Failed
server=dbcluster:3306;user=sqluser;password=mypw;database=dbname;AllowLoadLocalInfile=true

Obviously works:
server=dbcluster;user=sqluser;password=mypw;database=dbname;AllowLoadLocalInfile=true

@junaid-ahmed92 Have you set the db server to be publicly accessible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants