2 Answers
- Newest
- Most votes
- Most comments
1
Hi,
Yes, you can do that: see https://docs.aws.amazon.com/secretsmanager/latest/userguide/create_database_secret.html
Example via CLI below
For Secrets Manager to be able to rotate the secret, you must make sure the JSON matches the JSON structure of a secret.
aws secretsmanager create-secret \
--name MyTestSecret \
--secret-string file://mycreds.json
Contents of mycreds.json:
{
"engine": "mysql",
"username": "saanvis",
"password": "EXAMPLE-PASSWORD",
"host": "my-database-endpoint.us-west-2.rds.amazonaws.com",
"dbname": "myDatabase",
"port": "3306"
}
Best,
Didier
0
Hello,
To resolve the issue of RDS service creating its own username, password and instead use your own custom secret. Set the parameter ManageMasterUserPassword to false and then The MasterUserSecret property should be properly formatted to reference the secret ARN.
rdsCluster:
Type: "AWS::RDS::DBCluster"
Properties:
MasterUsername: {
"Ref": "dbUsername"
}
DBClusterIdentifier: {
"Fn::Sub": "${projectName}"
}
Engine: "aurora-postgresql"
DatabaseName: {
"Fn::Sub": "${databaseName}"
}
DBSubnetGroupName: {
"Fn::Sub": "${projectName}-subnetGroup"
}
EnableCloudwatchLogsExports:
- "<value>"
EnableIAMDatabaseAuthentication: true
ManageMasterUserPassword: false # Set this to false
StorageEncrypted: true
MasterUserSecret:
SecretArn: {
"Ref": "secretArn"
}
Relevant content
- asked 3 years ago
- asked 2 years ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 2 years ago