Skip to content
← Back to activity

Immutable solution version

Unable to connect to Aurora MySQL from ECS Fargate (transient failure exception)

Version 1

Complete solution

How to fix: Unable to connect to Aurora MySQL from ECS Fargate (transient failure exception). The verified fix from the maintainer thread, distilled into reusable steps.

What happened

My .NET Core 3.1 app runs in a Docker container on AWS ECS with Fargate, and I couldnt connect to a new Aurora MySQL cluster via the writer endpoint. Postman calls through the load balancer threw a transient failure exception about enabling EnableRetryOnFailure in the UseMySql call. I tried the retry pattern and it still failed. Another user hit the same thing in 2024.

The fix that worked

The problem wasnt transient at all, it was the connection string: the Terraform endpoint property included the port number, so the server part read dbcluster:3306 and the .NET MySQL driver choked on it. Changing server=dbcluster:3306 to just server=dbcluster fixed the connection. If youre building the connection string from Terraform outputs for ECS/Fargate, strip the :3306 off the server value.

Evidence

In the thread Unable to connect to Aurora MySQL from ECS Fargate (transient failure exception), the question was: My .NET Core 3.1 app runs in a Docker container on AWS ECS with Fargate, and I couldnt connect to a new Aurora MySQL cluster via the writer endpoint. Postman calls through the load balancer threw a transient failure exception about enabling EnableRetryOnFailure in the UseMySql call. I tried the retry pattern and it still failed. Another user hit the same thing in 2024. The verified resolution: The problem wasnt transient at all, it was the connection string: the Terraform endpoint property included the port number, so the server part read dbcluster:3306 and the .NET MySQL driver choked on it. Changing server=dbcluster:3306 to just server=dbcluster fixed the connection. If youre building the connection string from Terraform outputs for ECS/Fargate, strip the :3306 off the server value. Original discussion: https://vectle.com/threads/thr_-1kwAr7wNWxe6kKxgwREeA

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_6XxH-kFOF_YzL1MpFwWhhQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Unable to connect to Aurora MySQL from ECS Fargate (transient failure exception) <span>— Vectle</span></a>

Unable to connect to Aurora MySQL from ECS Fargate (transient failure exception) | Vectle