How do you connect an amazon rds to a django app - django

I have added the correct name, engine, user, password etc. Then I modified the inbound security rules to give my computer access to the database and I still cant connect the postgres database to the django app does anyone know what could cause this?
I keep getting this error
port 5432 failed: Connection timed out
Is the server running on that host and accepting TCP/IP connections?

Related

Sails.js app failed to connect to MySql database in AWS RDS database, works with localhost(MySql)

I am new to sails. I have created an app with Sails. I have deployed the app to AWS. App works with localDiskDb. When I try connecting to RDS, I get the following error. I have set up connection URL in sails.config.datastores.js. When I see my error message, my feeling is that Sails still trying to connect to localhost. But I did not find any other place to replace that settings. I hope it's enough to change only connection URL. I am running Sails app with developmenet environment locally.
adapter: require('sails-mysql'),
url: 'mysql://USERNAME:PASSWORD#.................amazonaws.com:3306/DATABASE_NAME'
Error message
You have to open the 3306 port in your EC2 instance.
Do this in Security Groups by editing the Inbound Rules and adding a new TCP rule for the 3306 port AND specify your IP (where the app connects from) in order to not allow everyone access this service.
I fixed this issue. I had used a '#' in my password. It ruined this all.

How to connect to Postgres RDS through Postico or other client

I've been reading this very basic tutorial from AWS: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ConnectToPostgreSQLInstance.html#USER_ConnectToPostgreSQLInstance.Troubleshooting
I opened up my Postico, copy/pasted the endpoint for my RDS database in the server field: xxxxxxx.xxxxxx.eu-west-1.rds.amazonaws.com, chose port 5432, configured my username and password, and hit connect. Elas:
Is the server running on host "xxxxxxx.xxxx.eu-west-1.rds.amazonaws.com" (123.456.789.12) and accepting
TCP/IP connections on port 5432?
Great question, is it? Well I configured the security group to accept inbound connections from my IP on 5432, so it should be? Or am I missing something?
The RDS is created on a VPC, but I still don't understand what role it plays for my RDS instance. Isn't defining the white list for my ip enough to accept connections? What other things should I configure?
Thanks

Tableau desktop not connecting to DB server on AWS instance

My postgres DB is in AWS instance running windows server 2012.
My tableau desktop is in local machine.
While connecting to the DB using external instance IP and default postgres PORT 5432 , it shows the error
Unable to connect to the ODBC Data Source.
Check that the necessary drivers are installed and that the connection properties are valid.
Unable to connect to the server "ec2-xx.xx.xx.xx.ap-south-1.compute.amazonaws.com".
Check that the server is running and that you have access privileges to the requested database.
I have made sure that:
AWS security group is configured for all incoming ports
Windows server 2012 firewall is accepting all inbound traffic.
My local desktop is allowing to send traffic to remote server.And I can telnet hostIP/hostname PORT successfully.
Postgres service is running on 5432 port.
Going by the points you mentioned, I would suggest to see if you have the required drivers installed for postgres. Also, if possible for you for the time being you can install any client temporarily like sqldeveloper(later you can remove this) on the tableau desktop.
Now because you are able to telnet Ip 5432, you can test your connection from the client, If this doesnt work u know that the problem is in configuration else we need to dig more into that.
It seems like I have not set the pg_hba.conf file correctly for postgres. Allowing the connection request from all external IPs let me resolve the issue.
Adding the line at the end of the file,
host all postgres 0.0.0.0 md5

Unable to open redis 6379 for inbound on AWS EC2

I have two servers on EC2. One hosting my php application and other hosting my redis server. I am managing my php session and data on redis server. So on my php server I gave the ip:port as session save path and got the error FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught exception 'RedisException' with message 'Connection closed'
So I search on the web and came to know that I need to open port 6379 on my redis instance for inbound traffic. I opened it by setting a custom TCP setting in AWS security group but still the port is coming closed to outside world. But I am able to listen to the port on redis server itself. Am i Missing anything in the process? Do I need to make any other change somewhere. Please guide me on this. I am very much new to AWS management
On Instance 1: I am using php-fpm, nginx and phpredis
On Instance 2: Using Redis

Restarted Database Server can no longer be accessed by webserver

I had to stop then start my ec2 database server running postgresql. Now after it is started, i get the following error message from my django web server
could not connect to server: Connection refused Is the server
running on host "54.235.119.193" and accepting TCP/IP connections on
port 5432?
However because I use elastic IPs and reassigned the same IP (54.235.119.193) I don't think that is the issue. I also am using the same security groups as before, which allow 5432.
I think the only thing that changes when you start/stop is the internal IP but I don't remember using that anywhere in configuration
Any Ideas?
Are you using iptables or selinux? These usually get in the way on restart if not configured properly.