0

Basically, I'm follow these two guides:

  1. Deploying Hasura on AWS with Fargate, RDS and Terraform
  2. Deploying Containers on Amazon’s ECS using Fargate and Terraform: Part 2

I have:

  • Postgres RDS Database deployed in 'Multi-AZ'
  • My python/flask app deployed in Fargate across multiple AZ's
  • I run a migration inside the task definition before the app
  • ALB Load balancing between the tasks
  • Logging for RDS, ECS and ALB into Cloudwatch Logs.
  • A NAT gateway with an Elastic IP for each private subnet to get internet connectivity
  • A new route table for the private subnets
  • NO certificates
  • I use terraform 0.12 for the deploy.
  • The repository is on ECR

But... My app can't connect to the RDS database:

sqlalchemy.exc.OperationalError
(psycopg2.OperationalError): FATAL:  password authentication failed for user "postgres"

These are the logs on pastebin-logs

I've already tried changing the password to a very simple one, before deploy, on the console directly, opening ports, turning access public, changing private to public subnet, etcetera, etcetera...

Please, I have a week with this error!!!

UPDATE

I inject the database credentials in this way:

pastebin-terraform

PulidoVPE
  • 23
  • 1
  • 10
  • It looks like your password is wrong. How are you injecting the database credentials into your service? Can you share your Terraform code for deploying the ECS service and the RDS database? – ydaetskcoR Nov 08 '19 at 09:41
  • The same password is used to create the RDS instance, make migrations and connect. Look at the new pastebin link. – PulidoVPE Nov 08 '19 at 14:19

1 Answers1

0

I cannot comment, but I mean this as a comment.

What does the security group egress look like on your ECS service that runs the task? You need to make sure it can talk to the RDS, usually on port 5432.

David Mattia
  • 409
  • 4
  • 5