DOP-C02 Question 102
Single answerYour company uses AWS OpsWorks for managing application configurations across multiple environments. A new requirement mandates that application servers must automatically register themselves to a centralized monitoring system during deployment. How should you implement this in AWS OpsWorks to ensure the configuration occurs during deployments?
- A
Create a custom recipe and assign it to the Deploy lifecycle event in the OpsWorks layer.
- B
Use AWS Systems Manager Run Command to execute the registration script on all instances after deployment.
- C
Manually execute the registration script on each instance after deployment.
- D
Update the stack's user data to include the registration script and re-launch all instances.
Show answer and explanation
Correct answer: A
Explanation
AWS OpsWorks provides lifecycle events that allow you to automate configuration tasks during specific stages of an instance's lifecycle. Assigning a custom recipe to the Deploy event ensures that any required configuration, such as registering to a monitoring system, is executed automatically during deployments. This approach adheres to DevOps best practices of automation and repeatability.
- A. Correct.
This is correct. AWS OpsWorks uses lifecycle events such as Setup, Configure, Deploy, and Shutdown. Assigning a custom recipe to the Deploy event ensures the registration script runs automatically during deployments.
- B. Incorrect.
This is incorrect. While AWS Systems Manager Run Command can execute scripts on instances, it is not an automated or integrated approach specific to lifecycle events in OpsWorks.
- C. Incorrect.
This is incorrect. Manually executing scripts is error-prone and does not align with DevOps principles of automation and repeatability.
- D. Incorrect.
This is incorrect. Updating user data and re-launching instances is unnecessary and does not leverage OpsWorks lifecycle events, which are designed for such configuration tasks.