- Newest
- Most votes
- Most comments
When you're experiencing connection issues between Fargate and your RDS PostgreSQL instance despite having the security group inbound rule configured correctly, there are several potential causes for the "no pg_hba.conf entry" error.
This specific error indicates an authentication issue related to PostgreSQL's host-based authentication configuration. Here are some troubleshooting steps:
- SSL/TLS Configuration: The error message mentions "no encryption" which suggests an SSL/TLS issue. PostgreSQL might be requiring an encrypted connection. You can resolve this by:
- Setting
ssl: truein your application's connection configuration - Or downloading and using the RDS certificate when connecting
- Alternatively, you could modify the "rds.force_ssl" parameter in the RDS parameter group to 0 (though this is less secure)
- Network Configuration: Even with security groups properly configured, check:
- Network ACLs (NACLs) associated with your subnets to ensure they allow traffic on port 5432
- Route tables to verify proper routing between Fargate and RDS
- If your Fargate task is in a private subnet, ensure it has proper routing to reach the RDS instance
-
Connection String: Verify you're using the correct RDS endpoint in your connection string, not an incorrect IP address
-
Public Access Setting: If your Fargate task is in a different VPC or subnet arrangement, check if the RDS instance needs public access enabled
If you're still experiencing issues after checking these items, enabling enhanced logging on your RDS instance might provide more detailed error information to help diagnose the problem.
Sources
Troubleshooting connection issues to your Amazon RDS DB instance - Amazon Relational Database Service
Docker container running on an ec2 instance cant connect to RDS AWS | AWS re:Post
Connection timeout white connecting from fargate to document db | AWS re:Post
Hello.
The error is not a security group issue, but rather a problem with not using an SSL connection when connecting to PostgreSQL.
Therefore, please try enabling SSL when connecting on the application side as stated in the automatic response from re:Post Agent.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Concepts.General.SSL.html
When the rds.force_ssl feature is active … connection attempts that aren't using SSL are rejected with the following message:
FATAL: no pg_hba.conf entry for host "w.x.y.z", user "testuser", database "testDB", SSL off
```” :contentReference[oaicite:2]{index=2}
Here is the documentation link: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Concepts.General.SSL.html
- Ensure that SSL is enabled on your RDS PostgreSQL instance. From the AWS Console: In RDS, click on Databases, then select your database, and then click on the Configuration tab. Click the link for the Parameter group.
Look for the rds.force_ssl setting: If the value is 1, SSL is required. This is probably what is causing your connection problem.
- Get the AWS RDS CA Certificate You need the right AWS RDS certificate to connect over SSL. https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html
answered a year ago
Relevant content
asked 4 years ago
asked 2 years ago
