- Ready to go database driver for AWS secret manager
$ composer require dcotelo/aws-secret-dbdriver
Naming convention: <env>/<appname>/<conn_name>
Ex: stage/Blog/mysql
Database configuration config/database.php
.
'connections' => [
'mysql' => [
'driver' => 'secret-db',
],
{
"database": "blog_database",
"driver": "mysql",
"host": "127.0.0.1",
"password": "*******",
"port": "3306",
"username": "mysql_user"
}
Default configuration keep the credentials in cache for 5 minutes customizable in .env
file.
DB_CACHE_TIME=<minutes>
In order to consume saved secrets aws credentials must be configured in .env
Ex:
AWS_ACCESS_KEY_ID=<KEY>
AWS_SECRET_ACCESS_KEY=<SECRET>
AWS_REGION=<REGION>