Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Exam AWS Certified DevOps Engineer - Professional DOP-C02 topic 1 question 3 discussion

A company is adopting AWS CodeDeploy to automate its application deployments for a Java-Apache Tomcat application with an Apache Webserver. The development team started with a proof of concept, created a deployment group for a developer environment, and performed functional tests within the application. After completion, the team will create additional deployment groups for staging and production.
The current log level is configured within the Apache settings, but the team wants to change this configuration dynamically when the deployment occurs, so that they can set different log level configurations depending on the deployment group without having a different application revision for each group.
How can these requirements be met with the LEAST 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.
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Schubibubi
Highly Voted 1 year, 5 months ago
B. In the docs: https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html you'll find a Note: "The Start, Install, TestTraffic, AllowTraffic, and End events in the deployment cannot be scripted, which is why they appear in gray in this diagram." Thats why its not D.
upvoted 15 times
...
www_dumpsvibe_com_7
Highly Voted 1 week, 5 days ago
The correct answer is B.
upvoted 10 times
...
Gomer
Most Recent 4 months ago
Selected Answer: B
This reference specifies the exact scenario described in "B", so I have to go with that "Set the log level according to the deployment group." https://aws.amazon.com/blogs/devops/using-codedeploy-environment-variables/ cat install_dependencies.sh [...] if [ "$DEPLOYMENT_GROUP_NAME" == "Staging" ] [...] cat appspec.yml hooks: BeforeInstall: - location: scripts/install_dependencies
upvoted 1 times
...
c3518fc
4 months, 1 week ago
Selected Answer: B
version: 0.0 os: linux files: - source: / destination: /var/www/html/ hooks: BeforeInstall: - location: scripts/update_log_level.sh timeout: 300 runas: root
upvoted 1 times
...
thanhnv142
7 months, 3 weeks ago
B is correct
upvoted 2 times
thanhnv142
7 months, 1 week ago
B is correct: <without having a different application revision for each group> means A and C is incorrect. A and C: <place a script into the application revision> both mention this, indicating a revision of the app, which is contradicted to the question D: there is no Install lifecycle hook
upvoted 1 times
...
...
hoakhanh281
8 months, 3 weeks ago
Selected Answer: D
Answer D. You only need to consider options B and D which are the least complex ones. The option B gives the CodeDeploy environment variable DEPLOYMENT_GROUP_ NAME, but DEPLOYMENT_GROUP_ID is recommended because it's more reliable and less prone to changes or inconsistencies. Answer D with settings DEPLOYMENT_GROUP_ID environment variable, which contains the unique identifier for the deployment group. This allows you to identify the deployment group without relying on custom scripts or metadata services.
upvoted 3 times
...
zijo
9 months, 3 weeks ago
Answer B. You only need to consider options B and D which are the least complex ones. The option B gives the CodeDeploy environment variable DEPLOYMENT_GROUP_ NAME that points to different instances and gives the option to set different log-level configurations in the same script depending on the deployment group without having a different application revision for each group. Also, The BeforeInstall lifecycle hook in the appspec.yml file refers to a script that will run on the instance before the application revision files are installed.
upvoted 2 times
...
y0eri
10 months ago
Answer: B Read this blog. https://aws.amazon.com/blogs/devops/using-codedeploy-environment-variables/ if [ "$DEPLOYMENT_GROUP_NAME" == "Staging" ] then sed -i -e 's/LogLevel warn/LogLevel debug/g' /etc/httpd/conf/httpd.conf fi
upvoted 9 times
...
wem
10 months ago
Based on the analysis, Option B is the most efficient and straightforward approach. It uses the built-in DEPLOYMENT_GROUP_NAME environment variable provided by CodeDeploy and involves minimal management overhead. The script can easily read this variable to determine the deployment group and set the log level accordingly, eliminating the need for different script versions for each group. This method aligns well with the requirement of least management overhead and simplicity.
upvoted 1 times
...
Sazeka
10 months, 2 weeks ago
Selected Answer: B
B is correct. DEPLOYMENT_ID : This variables contains the deployment ID of the current deployment. DEPLOYMENT_GROUP_NAME : This variable contains the name of the deployment group. A deployment group is a set of instances associated with an application that you target for a deployment.
upvoted 2 times
...
SanChan
1 year, 3 months ago
B is the most straightforward and efficient solution to meet the requirements with the least management overhead and without requiring different script versions for each deployment group.
upvoted 2 times
Aja1
1 year, 1 month ago
https://aws.amazon.com/blogs/devops/using-codedeploy-environment-variables/
upvoted 1 times
...
...
mywogunleye
1 year, 3 months ago
Answer is B practical use case https://hassanmurtaza.medium.com/loading-configurations-based-on-environment-in-aws-codedeploy-8ddbd3b0b38e
upvoted 1 times
...
madperro
1 year, 3 months ago
Selected Answer: B
Running the hook during the Install or AfterInstall would make more sense but hooks for Install are not available (like in answer D) and AfterInstall is not included in answers so the best answer is B.
upvoted 2 times
...
vherman
1 year, 4 months ago
Selected Answer: B
B is the only correct answer
upvoted 4 times
...
alce2020
1 year, 5 months ago
B. Create a script that uses the CodeDeploy environment variable DEPLOYMENT_GROUP_NAME to identify which deployment group the instance is part of, and use this information to configure the log level settings. Reference this script as part of the BeforeInstall lifecycle hook in the appspec.yml file, would be the option with the least management overhead and without requiring different script versions for each deployment group
upvoted 3 times
...
jqso234
1 year, 5 months ago
Option B is the best solution for this use case. By using the CodeDeploy environment variable DEPLOYMENT_GROUP_NAME, the script can identify the deployment group that the instance is part of, without requiring any additional configuration or management overhead. The script can then dynamically configure the log level settings based on the identified deployment group.
upvoted 1 times
...
henryyvr
1 year, 5 months ago
B See: https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...