AMIMOTO Database Credentials for Single AMI, RDS, and Amazon Aurora How to check and modify user name, password, host name, database and table prefix on your instances. Tomohyco Tsunoda
We have three types of database on our products
- MySQL (Percona Server)
- Amazon RDS
- Amazon Aurora
MySQL (Percona Server)
This database type runs on Single AMIs and it's local to the WordPress installation.
For example; a few products using this database type is WordPress powered by AMIMOTO or WooCommerce Powered by AMIMOTO (Apache)
Amazon RDS on CloudFormation JIN-KEI
This database type is created when launching an AMIMOTO CloudFormation Product such as WordPress powered by JIN-KEI (Simple Stack HVM) or WordPress powered by JIN-KEI (Auto-Scaling)
Amazon Aurora on Aurora-ready instances
Amazon Aurora is the most powerful database option for AMIMOTO, it's available on product such as WordPress by JINKEI (Simple Stack HVM Aurora) or WordPress by JINKEI (SimpleStack MOD_PHP Aurora) .
Managing for MySQL (Percona Server)
If you're using Single AMI, you can find database's credentials in /var/www/vhosts/example.com/local-config.php
You need to SSH or SFTP access to the server to check it.
$ ssh -i ~/.ssh/example_com.pem ec2-usr@example.com
$ cat /var/www/vhosts/example.com/local-config.php
<?php
// ** MySQL settings - You can get this info from your web host ** //
[......]
if ( !$db_data ) {
$db_data = array(
'database' => 'YOUR-DATABASE',
'username' => 'YOUR-DATABSE-USERNAME',
'password' => 'YOUR-DATABASE-PASSWROD',
'host' => 'localhost',
);
}
Managing for RDS and Amazon Aurora
If you're running CloudFormation, JIN-KEI or Simple Stack user, you can find database's credentials (database name, username, password, endpoint and port number) in /opt/aws/cloud_formation.json.
You have already set MySQLPassword as Aurora or RDS' password while you were setting up the stack.
You can also check it on the server through SSH or SFTP access.
$ ssh -i ~/.ssh/example_com.pem ec2-user@YOUR-INSTANCE-IP-ADDRESS
$ cat /opt/aws/cloud_formation.json
{
"rds" : {
"database" : "YOUR-RDS-DATABASE",
"username" : "YOUR-USERNAME",
"password" : "YOUR-RDS-PASSWORD",
"endpoint" : "your-rds-endpoint-rdscluster-4fndeaauf9dg.cluster-c8jcval3u4pp.us-east-1.rds.amazonaws.com",
"port" : 3306
}
}
When launching an AMIMOTO CloudFormation or Simple Stack product the database information is generated automatically with the password you've selected during launch and stored in the following JSON file.
https://github.com/amimoto-ami/jin-kei/blob/master/include/ec2/metadata-for-rds.rb#L1-L38