Laravel "SQLSTATE[HY000] [1045] Access denied for user [email protected]" for VPC peering on AWS?

42 Views Asked by At

I followed this tut and AWS's docs and yet I still can't connect my EC2 instance to my RDS aurora cluster with VPC peering enabled. I've double checked my host, user, port, password from my .env file many times. I've cleared the cache and config every time I make a change. I can run netcat while ssh'd on the ec2 instance with a successful response:

nc -zv sxyz-cluster.cluster-ro-xyzlksajdf.theregion.rds.amazonaws.com 3306
Connection to sxyz-cluster.cluster-ro-xyzlksajdf.theregion.rds.amazonaws.com (172.31.0.xxx) 3306 port [tcp/mysql] succeeded!

I'm running Laravel 10.13.5. My EC2 instance is on CIDR 10.0.0.0/16 and my RDS is on 172.31.0.0/16. I've added these to the route tables pointing to the peering connection and also added mysql tcp to the security groups. My expectations if there was a connection is would be to see Access denied for user [email protected] not Access denied for user [email protected]. This makes me think that Laravel is not setting the host correctly. I've tried hardcoding the DB_HOST to be 172.31.0.xxx in the database config file with no luck, same error with the 10.0.0.xxx ip error.

Any thoughts?

0

There are 0 best solutions below