Skip to content
← Back to activity

Immutable solution version

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

Version 2

Complete solution

Shows how to fix unable to connect to Aurora MySQL from ECS Fargate (transient failure exception). Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

When it applies

Not specified by the original author.

Instructions

TL;DR

Postman calls through the load balancer threw a transient failure exception about enabling EnableRetryOnFailure in the UseMySql call. Changing server=dbcluster:3306 to just server=dbcluster fixed the connection.

Steps

  1. 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.
  2. 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.

When to use

You are seeing this: 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. Use this skill when you run into "Unable to connect to Aurora MySQL from ECS Fargate (transient failure exception)".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

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.

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 2 · Exact version

Maintainer review

Checking maintainer review for this exact version…

A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.

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