cloudformation-coverage-roadmap
cloudformation-coverage-roadmap copied to clipboard
Include the reader host to the generated Aurora RDS cluster secret
Name of the resource
AWS::SecretsManager::SecretTargetAttachment
Resource name
No response
Description
Include the reader host to the generated Secrets Manager secret for an RDS Aurora cluster.
Currently, the JSON it looks like this:
{
"engine": "<engine type>",
"dbClusterIdentifier": "<cluster identifier>",
"host": "<cluster writer host>",
"port": "<port number>"
"username": "<username>",
"password": "<password>",
"dbname": "<database name>"
}
Use Case
It would be awesome to have the reader host in the secret, as we won't need to do string manipulation on our side:
// What else can we do!? 😅
const readerHost = secret.host.replace('.cluster-', '.cluster-ro-');
Proposed Solution
Just add a key conatining the readonly endpoint URL to the JSON (key name to your taste!), like so:
{
"engine": "<engine type>",
"dbClusterIdentifier": "<cluster identifier>",
"host": "<cluster writer host>",
"readerHost": "<cluster reader host>",
"port": "<port number>"
"username": "<username>",
"password": "<password>",
"dbname": "<database name>"
}
Other Details
Related AWS CDK issues: https://github.com/aws/aws-cdk/issues/11517 https://github.com/aws/aws-cdk/issues/22050
This would also be convenient if it worked for RDS read replica instances, instead of having to use text replacement to add -read to the host.