DOP-C02 exam dumps

DOP-C02 practice question 84 of 411

AWS Certified DevOps Engineer - Professional. Professional level, Amazon Web Services. Free question with the correct answer and a full explanation.

DOP-C02 Question 84

Single answer

Your organization uses AWS CloudFormation to manage infrastructure as code (IaC). A new requirement mandates that application configurations must dynamically adjust based on the deployment environment (e.g., dev, staging, production). You need to ensure that your CloudFormation templates can handle this requirement with minimal duplication of code and without hardcoding values. Which approach should you take?

  1. A

    Use CloudFormation Parameters to define environment-specific values and reference them in the template.

  2. B

    Create separate CloudFormation templates for each environment with hardcoded values specific to dev, staging, and production.

  3. C

    Use AWS Lambda-backed custom resources to dynamically generate configurations based on the environment.

  4. D

    Leverage CloudFormation Conditions to include or exclude specific resources based on the environment.

Show answer and explanation

Correct answer: A

Explanation

CloudFormation Parameters are specifically designed to handle dynamic configuration needs across different environments. By defining parameters for environment-specific values and passing the appropriate values at stack creation, you can reuse a single template for multiple environments without duplication or hardcoding. This makes Parameters the most efficient and scalable approach for this scenario.

  • A. Correct.

    This is the correct answer. CloudFormation Parameters allow you to define environment-specific values that can be provided at runtime. This approach avoids hardcoding and supports reusability.

  • B. Incorrect.

    This is incorrect. Creating separate templates for each environment leads to code duplication and is not scalable. It violates the principles of DRY (Don't Repeat Yourself).

  • C. Incorrect.

    This is incorrect. While Lambda-backed custom resources could be used, this approach introduces unnecessary complexity for a requirement that can be fulfilled using built-in CloudFormation features like Parameters.

  • D. Incorrect.

    This is incorrect. CloudFormation Conditions are useful for resource inclusion/exclusion but are not designed for dynamically adjusting configurations across environments.

Timed practice exam

Take a DOP-C02 practice test under exam conditions

75 questions in 180 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam