DVA-C02 · Question #210
A company wants to automate part of its deployment process. A developer needs to automate the process of checking for and deleting unused resources that supported previously deployed stacks but that a
The correct answer is B. In the central AWS CDK application, write a handler function in the code that uses AWS SDK. Note: The answer choices in this question are truncated, so I'll reason from the distinguishing details that are visible and standard AWS exam patterns for this topic. Option B is correct because it likely uses the AWS CDK AwsCustomResource construct (from the aws-cdk-lib/custom-
Question
A company wants to automate part of its deployment process. A developer needs to automate the process of checking for and deleting unused resources that supported previously deployed stacks but that are no longer used. The company has a central application that uses the AWS Cloud Development Kit (AWS CDK) to manage all deployment stacks. The stacks are spread out across multiple accounts. The developer's solution must integrate as seamlessly as possible within the current deployment process. Which solution will meet these requirements with the LEAST amount of configuration?
Options
- AIn the central AWS CDK application, write a handler function in the code that uses AWS SDK
- BIn the central AWS CDK application, write a handler function in the code that uses AWS SDK
- CIn the central AWS CDK, write a handler function in the code that uses AWS SDK calls to check
- DIn the AWS Lambda console, write a handler function in the code that uses AWS SDK calls to
How the community answered
(49 responses)- A8% (4)
- B76% (37)
- C12% (6)
- D4% (2)
Explanation
Note: The answer choices in this question are truncated, so I'll reason from the distinguishing details that are visible and standard AWS exam patterns for this topic.
Option B is correct because it likely uses the AWS CDK AwsCustomResource construct (from the aws-cdk-lib/custom-resources module), which allows you to make SDK calls directly within the CDK application lifecycle - no separate Lambda deployment or external tooling required. Since the company already uses CDK centrally across accounts, this approach slots directly into the existing workflow with the least additional setup.
Why the distractors are wrong:
- Option A likely uses a CDK
CustomResourcebacked by a manually-provisioned Lambda Provider, which requires more boilerplate and wiring compared to the built-inAwsCustomResourceshorthand. - Option C likely uses CDK Aspects or a similar mechanism that checks resources but may not handle deletion or cross-account scenarios as cleanly within the same CDK lifecycle.
- Option D is wrong because writing the function in the Lambda console is entirely outside the CDK workflow, requires manual maintenance, and adds significant configuration overhead - the opposite of "least configuration."
Memory tip: When an AWS exam question says "integrates seamlessly" + "least configuration" + "already using CDK," think CDK Custom Resources (AwsCustomResource). It's CDK's built-in way to call any AWS SDK operation as part of a stack deployment without manually managing Lambda functions.
Topics
Community Discussion
No community discussion yet for this question.