I have a repository here. I am currently struggling with deploying it to AWS ECS. The repository is configured to use Github Actions to build the two containers and then ship them to ECR, then update an ECS task definition to pull the most recent image commit.
I am using ECS Fargate, and am therefore on awsvpc for the network mode.
I tried changing the hostname to localhost. When I do so, I get this error: MySQLdb.OperationalError: (2002, "Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)")
According to comments so far, setting it to localhost will work. However, I still get this error. I have double checked that my settings.py and .env file have localhost as the DB_HOST.
What I've tried is visible at the repository here
No that is incorrect. When you are using
awsvpcnetwork mode for your containers, which is the only option on Fargate, then theDB_HOSTsetting should belocalhostor127.0.0.1.