How to manage Amazon RDS database users consistently across multiple AWS accounts?
Short answer
B Create an AWS CloudFormation template that contains a custom resource to create the users in the database. Deploy the template in each account.
Question
Key Takeaways
This question tests the understanding that CloudFormation cannot natively manage RDS internal database users, requiring a custom resource to bridge that gap while maintaining Infrastructure as Code best practices.
AWS CloudFormation does not natively support managing Amazon RDS database users. Using a CloudFormation custom resource to provision and update users ensures consistent, operationally efficient management across multiple accounts.
Common mistake: Many candidates choose Option A, assuming CloudFormation can directly declare and attach RDS database users as native resources, not realizing that RDS database users are not supported as CloudFormation resource types.
Expert Analysis
Why Option B is Correct
The key requirement here is to define and manage database users consistently across three AWS accounts with the most operational efficiency. Amazon RDS does not expose database-level user management (such as CREATE USER or GRANT statements) as native AWS CloudFormation resource types. Therefore, a standard CloudFormation template cannot directly create or update users inside the database engine.
A CloudFormation custom resource allows you to execute custom logic (typically via an AWS Lambda function) during stack creation, update, or deletion. By embedding a custom resource in the CloudFormation template, you can:
- Run arbitrary code (e.g., SQL commands) to create or update database users.
- Keep the entire infrastructure definition—including database users—in a single CloudFormation template.
- Deploy the same template across all three accounts, ensuring consistency and operational efficiency.
- Automatically handle updates when the template changes.
Why Option A is Incorrect
Option A suggests declaring users directly in the CloudFormation template and "attaching" them to the database. However, CloudFormation does not support RDS database users as a native resource type. You can create the AWS::RDS::DBInstance resource, but you cannot define internal database users (like MySQL or PostgreSQL users) within the template. This makes Option A technically invalid.
Why Option C is Incorrect
Option C involves writing a script and deploying an Amazon EC2 instance in each account to run it. While this would technically work, it introduces significant operational overhead:
- You must manage, patch, and monitor three additional EC2 instances.
- Scheduling and ensuring the script runs correctly adds complexity.
- It violates the principle of operational efficiency by introducing unnecessary infrastructure.
Why Option D is Incorrect
Option D suggests using a single AWS Lambda function with details of all three accounts. While Lambda is a valid execution environment for the custom logic, this approach lacks the Infrastructure as Code benefits of CloudFormation. You would need to:
- Manually manage the Lambda function's deployment and configuration.
- Handle cross-account permissions and secrets separately.
- Lose the ability to track database user state as part of a CloudFormation stack.
Community Consensus
The community overwhelmingly agrees that Option B is correct (100% of votes). Commenters correctly point out that CloudFormation itself does not natively manage database users within RDS, and a custom resource is required to bridge this gap while maintaining IaC best practices.
Official Reference
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html
This link opens the official vendor documentation in a new tab.
Exam Strategy
When a question asks for the 'MOST operational efficiency' in AWS, prioritize fully managed, Infrastructure as Code solutions like CloudFormation over manual scripts or additional EC2 instances. Always verify whether the resource in question is natively supported by CloudFormation before assuming it can be declared directly in a template.
Community Votes
100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 3 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 3
-
CrescentShared 👍 4 Answered BCloudFormation itself does not natively manage database users within RDS. You would need a custom resource or some additional automation to create users within the RDS instance.
-
KarBiswa 👍 2 Answered Bhttps://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html#:~:text=For%20example%2C%20you%20might%20want%20to%20include%20resources%20that%20aren%27t%20available%20as%20AWS%20CloudFormation%20resource%20types.%20You%20can%20include%20those%20resources%20by%20using%20custom%20resources.%20That%20way%20you%20can%20still%20manage%20all%20your%20related%20resources%20in%20a%20single%20stack.
-
65703c1 👍 2 Answered BB is the correct answer.
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →