Securely storing MySQL credentials accessed from a Docker container

Viewed 105

without revealing it inside my docker PHP container.

My index.php file looks like the following. now I need to store the password in a secret file and use it in my code. The mysql I'm using is a RDS instance in AWS.

<?php
define('HOST', "");
define('DBUSER', "root");
define('PASS', "stored in AWS secret manager");
define('DB', "db");
define('PORT', 3306);

$link=mysqli_connect(HOST,DBUSER,PASS,DB,PORT);

// Check connection
if (mysqli_connect_errno($link)){
    echo "Failure to connect: " . mysqli_connect_error();
}
?>

Any help would be appreciated, thank you

1 Answers
Related