How do I connect my app to my AWS RDS instance from my AWS EC2 instance?
I can't seem to figure out. When I connect to my RDS instance from either my local server or my EC2 instance itself using the mysql client, it works just fine. It only stops working when I try and run php artisan migrate. I've been going at this for a few hours now and I'm running out of ideas so if anyone can point out what I'm missing, I'd really appreciate it.
Illuminate\Database\QueryException : SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known (SQL: select * from information_schema.tables where table_schema = mydb and table_name = migrations and table_type = 'BASE TABLE')
hi there, yes that is exactly what i meant by i can connect to it using the mysql client and the weird thing is after a few hours i tried again without any change and it just worked all of a sudden
it couldn't have been provisioning either since i was able to connect using the mysql client. it's really weird and it's really unsettling. i might just spin up a new ec2 and rds instance just to see if it happens again lol. anyway, thanks!
I had the same error and it was caused by a wrong DB_HOST value.
It worked well through HTTP requests but not from the console because the RDS environnements variables were not set. So I updated my .env file with the proper key/values and it worked.