Description
Pass the DocumentDB cluster’s MasterUserPassword through a NoEcho parameter without a default. To have Secrets Manager manage it, omit MasterUserPassword and enable ManageMasterUserPassword.
Potential impact
An exposed master password can let someone with network access to the cluster read, modify or delete data.
Remediation
If the password is exposed, replace it on the cluster, update applications that use it and test their connections. Keep the value out of logs and outputs.
Examples
For this new cluster, supply an existing subnet group and supported engine version. Configure the DB instances and access rules separately. ParentMasterPassword must be 8–100 printable ASCII characters, excluding /, " and @.
Before
yaml
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
DBSubnetGroupName:
Type: String
EngineVersion:
Type: String
Resources:
NewAmpApp:
Type: AWS::DocDB::DBCluster
Properties:
BackupRetentionPeriod: 8
DBClusterIdentifier: sample-cluster
DBSubnetGroupName: !Ref DBSubnetGroupName
EngineVersion: !Ref EngineVersion
DeletionProtection: true
MasterUsername: docdbadmin
MasterUserPassword: "asDjskjs73!!"
Port: 27017
PreferredBackupWindow: 07:34-08:04
PreferredMaintenanceWindow: sat:04:51-sat:05:21
StorageEncrypted: true
After
yaml
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
ParentMasterPassword:
Type: String
NoEcho: true
MinLength: 8
MaxLength: 100
DBSubnetGroupName:
Type: String
EngineVersion:
Type: String
Resources:
NewAmpApp:
Type: AWS::DocDB::DBCluster
Properties:
BackupRetentionPeriod: 8
DBClusterIdentifier: sample-cluster
DBSubnetGroupName: !Ref DBSubnetGroupName
EngineVersion: !Ref EngineVersion
DeletionProtection: true
MasterUsername: docdbadmin
MasterUserPassword: !Ref ParentMasterPassword
Port: 27017
PreferredBackupWindow: 07:34-08:04
PreferredMaintenanceWindow: sat:04:51-sat:05:21
StorageEncrypted: true