Q24 — AWS DOP-C02 Ch.2

Question 24 of 100 | ← Chapter 2

A company uses AWS CodeDeploy to automate deployments of a Java-Apache Tomcat application running on Apache web servers. The development team begins with a proof-of-concept, creating a deployment group for the development environment and performing functional tests in that environment. After successful validation, the team will create additional deployment groups for staging and production. Currently, log levels are configured in Apache settings, but the team wants to dynamically adjust this configuration during deployment so they can set different log levels per deployment group without requiring separate application revisions for each group. How can these requirements be met with minimal administrative overhead and without using different script versions per deployment group?

Correct Answer: B. Create a script that uses the CodeDeploy environment variable DEPLOYMENT_GROUP_NAME to identify which deployment group the instance belongs to. Use this information to configure the log level setting. Reference this script in the appspec.yml file as part of the BeforeInstall lifecycle hook.

Explanation

In this scenario, the team wants to dynamically configure Apache log levels based on the deployment group, without maintaining separate application revisions or script versions per group. Option B uses the CodeDeploy environment variable `DEPLOYMENT_GROUP_NAME` to identify the deployment group and configure log levels accordingly. This approach allows a single script and application revision to adapt across deployment groups, minimizing administrative overhead. Placing the script in the `BeforeInstall` lifecycle hook ensures log level configuration is applied before the application is installed—meeting the requirement. Thus, Option B is correct.