2

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?

Ask
  • 3,076
  • 6
  • 30
  • 63

1 Answers1

0

It is pretty hard to troubleshoot fargate container out of the box. The first things you should check:

  • Are RDS and the Containers in the same VPC?
  • Does the RDS security group have the correct port open to the container's security group?

A few options for troubleshooting:

  • The quickest option, deploy an EC2 instance in the same subnet as your container and troubleshoot the connection with that
  • In a dev environment only, install SSH on your container via the entrypoint script.
    • Alternatively, have a separate task which launches a container running only SSH for networking troubleshooting
  • Use a container host for Dev so you can use docker exec
Chart96
  • 430
  • 4
  • 5