What's the best practice for storing database credentials for an auto scaling environment, yet also requiring the ability to update database information?
For instance I have an auto-scaling site on AWS. At present there is only one database, but at some point new database instances are going to be added (either for data sharding or readonlys)
I'm trying to figure out the best way to store database credentials in a way that also makes them easily updated. Although I've mentioned AWS here ideally i'd like something that is platform agnostic if possible.
It's obviously wrong to store the database credentials in source control so my initial thoughts are along the following (but even this seems wrong)
Use the same username and password on all database servers (there could be different users still depending if it's a write or readonly DB, but all users would be on the servers that need them). Then somehow store these securely on a webserver image. Though I've also read some posts arguing that environment variables should also not be used so wondering how to do this.
A separate config file could potentially live in source control that merely details the addresses and names of the database servers though I also think this should be secret. The issue then arises about getting an updated list of database servers to all the webservers easily.
The problem I'm facing is how to update x number of servers with details of y databases in a secure manner when x and y can both change. y would in theory be more stable than x if x was auto scaling. But at the same time when it does change it would have a greater impact.
This will most likely be on a Linux (Ubuntu) machine. I haven't listed a specific scripting language though as it would be good if there are solutions that can be used more widely
Thanks