
Answer-first summary for fast verification
Answer: Create a script that uses the CodeDeploy environment variable DEPLOYMENT_GROUP_NAME to identify which deployment group the instance is part of. Use this information to configure the log level settings. Reference this script as part of the BeforeInstall lifecycle hook in the appspec.yml file.
The correct answer is B. The CodeDeploy environment variable DEPLOYMENT_GROUP_NAME can be used to identify the deployment group dynamically. By using this environment variable in a script, the log level settings can be configured based on the deployment group. This script can be referenced in the BeforeInstall lifecycle hook in the appspec.yml file, which allows the configuration to be applied before the application revision files are installed. This solution meets the requirements with minimal management overhead and does not require different script versions for each deployment group.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
A company is using AWS CodeDeploy to automate deployments of their Java-Apache Tomcat application with an Apache Webserver. They have successfully created a deployment group for a developer environment and conducted functional tests. The team plans to create additional deployment groups for staging and production environments. Currently, the log level is configured within the Apache settings, but the team wishes to dynamically adjust this configuration during deployments based on the deployment group, without needing separate application revisions for each group. How can they achieve this with minimal management overhead and without requiring different script versions for each deployment group?
A
Tag the Amazon EC2 instances depending on the deployment group. Then place a script into the application revision that calls the metadata service and the EC2 API to identify which deployment group the instance is part of. Use this information to configure the log level settings. Reference the script as part of the AfterInstall lifecycle hook in the appspec.yml file.
B
Create a script that uses the CodeDeploy environment variable DEPLOYMENT_GROUP_NAME to identify which deployment group the instance is part of. Use this information to configure the log level settings. Reference this script as part of the BeforeInstall lifecycle hook in the appspec.yml file.
C
Create a CodeDeploy custom environment variable for each environment. Then place a script into the application revision that checks this environment variable to identify which deployment group the instance is part of. Use this information to configure the log level settings. Reference this script as part of the ValidateService lifecycle hook in the appspec.yml file.
D
Create a script that uses the CodeDeploy environment variable DEPLOYMENT_GROUP_ID to identify which deployment group the instance is part of to configure the log level settings. Reference this script as part of the Install lifecycle hook in the appspec.yml file.