DVA-C02 · Question #277
DVA-C02 Question #277: Real Exam Question with Answer & Explanation
The correct answer is B: Create an AWS CloudFormation template that contains a custom resource to create the users in. A CloudFormation custom resource invokes a Lambda function during stack operations, enabling CloudFormation to execute arbitrary logic such as creating database users as part of a repeatable, infrastructure-as-code deployment across multiple accounts.
Question
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?
Options
- ACreate an AWS CloudFormation template. Declare the users in the template. Attach the users to
- BCreate an AWS CloudFormation template that contains a custom resource to create the users in
- CWrite a script that creates the users. Deploy an Amazon EC2 instance in each account to run the
- DImplement an AWS Lambda function that creates the users in the database. Provide the function
Explanation
A CloudFormation custom resource invokes a Lambda function during stack operations, enabling CloudFormation to execute arbitrary logic such as creating database users as part of a repeatable, infrastructure-as-code deployment across multiple accounts.
Common mistakes.
- A. Declaring IAM users in a CloudFormation template creates AWS IAM users, not database-level users within an RDS instance; CloudFormation does not have native resource types for creating users inside a database engine.
- C. Deploying EC2 instances in each account solely to run a script is operationally expensive and introduces infrastructure that must be maintained; it does not leverage CloudFormation's idempotent, repeatable deployment model.
- D. While a Lambda function could create database users, deploying it independently without a CloudFormation template means there is no consistent, version-controlled mechanism to ensure the same user configuration is applied uniformly across all three accounts during future updates.
Concept tested. CloudFormation custom resources for database user provisioning
Reference. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html
Community Discussion
No community discussion yet for this question.