I'm new to AWS and trying to connect using PHP to a test RDS like this
$dbhost = 'xxxx.xxxxxxxxxxx.rds.amazonaws.com';
$dbport = 3306;
$dbname = 'xxxx';
$charset = 'utf8' ;
$dsn = "mysql:host={$dbhost};port={$dbport};dbname={$dbname};charset={$charset}";
$username = 'xxxx';
$password = 'xxxxxx';
try{
$pdo = new PDO($dsn, $username, $password);
}
catch(exception $e){
echo "error ".$e->getMessage();
}
But I get this in the log
[Warning] IP address 'xxx.xx.x.xxx' could not be resolved: Temporary failure in name resolution
[Update] And the page displays error 500 internal server error. The database security group allows connection from anywhere. I'm not using Elastic Beanstalk I just created instances, security policies, target groups, load balancers and need to get the application on the instance working by connecting it to the database.
How to fix this?