How to manage Amazon RDS database users consistently across multiple AWS accounts?

A developer manages three AWS accounts. Each account contains an Amazon RDS DB instance in a private subnet. The developer needs to define users in each database in a consistent way. The developer must ensure that the same users are created and updated later in all three accounts. Which solution will meet these requirements with the MOST operational efficiency?

  1. Create an AWS CloudFormation template. Declare the users in the template. Attach the users to the database. Deploy the template in each account.
  2. Create an AWS CloudFormation template that contains a custom resource to create the users in the database. Deploy the template in each account. Source Reference Answer
  3. Write a script that creates the users. Deploy an Amazon EC2 instance in each account to run the script on the databases. Run the script in each account.
  4. Implement an AWS Lambda function that creates the users in the database. Provide the function with the details of all three accounts.

Community Votes

B
100%

100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

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.

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.

Community Discussion (3 comments)

65703c1 👍 2 Selected: B
B is the correct answer.
KarBiswa 👍 2 Selected: B
https://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.
CrescentShared 👍 4 Selected: B
CloudFormation 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.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

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.
This approach aligns perfectly with Infrastructure as Code (IaC) principles and eliminates the need for separate scripts or manually managed EC2 instances.

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.
A Lambda function alone does not provide the same level of integration, state management, and consistency as a CloudFormation custom resource deployed in each account.

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

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.

Related Analysis

Practice All DVA-C02 Questions

Access 100 questions with complete answers and detailed explanations.

View Full DVA-C02 Practice Test →

← Back to DVA-C02 Study Guide