Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect laravel 5 to AWS RDS with SSL

I was reading this question and this article.

'your_connection' => array(
  'driver'  => 'mysql',
  'host'    => $host,
  'database'  => $database,
  'username'  => $username,
  'password'  => $password,
  'charset'   => 'utf8',
  'collation' => 'utf8_unicode_ci',
  'prefix'  => '',
  'options' => array(
    PDO::MYSQL_ATTR_SSL_KEY => $cert_base . '/client-key.pem',
    PDO::MYSQL_ATTR_SSL_CERT => $cert_base . '/client-cert.pem',
    PDO::MYSQL_ATTR_SSL_CA => $cert_base . '/ca-cert.pem'
  ),
),

From what I understand, PDO::MYSQL_ATTR_SSL_CA, is can be downloaded from here

I am not sure PDO::MYSQL_ATTR_SSL_KEY and PDO::MYSQL_ATTR_SSL_CERT

I read something like this

openssl genrsa 2048 > ca-key.pem
openssl req -sha1 -new -x509 -nodes -days 3650 -key ca-key.pem > ca-cert.pem

It seems that is what I need to do, could anyone confirm?

like image 502
kenpeter Avatar asked Dec 03 '25 21:12

kenpeter


1 Answers

To connect to AWS RDS via SSL in Laravel you only need to do a few things.

Download the rds-combined-ca-bundle.pem file from:

Download pem from the following link: https://www.amazontrust.com/repository/AmazonRootCA1.pem

Then place it in your configuration like this:

'options' => array(    
    PDO::MYSQL_ATTR_SSL_CA => $cert_base . '/AmazonRootCA1.pem'
 ),

Remember to enable SSL/TLS on your RDS instance.

like image 128
Ryan Lavelle Avatar answered Dec 06 '25 11:12

Ryan Lavelle



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!