Learn how to use AWS CodeDeploy hooks to customize the deployment lifecycle of your applications. Find out the correct run order of the hooks for in-place deployments.
Table of Contents
Question
For a deployment using AWS Code Deploy, what is the run order of the hooks for in-place deployments?
A. BeforeInstall -> ApplicationStop -> ApplicationStart -> AfterInstall
B. ApplicationStop -> BeforeInstall -> AfterInstall -> ApplicationStart
C. BeforeInstall -> ApplicationStop -> ValidateService -> ApplicationStart
D. ApplicationStop -> BeforeInstall -> ValidateService -> ApplicationStart
Answer
B. ApplicationStop -> BeforeInstall -> AfterInstall -> ApplicationStart
Explanation
The correct answer is B. ApplicationStop -> BeforeInstall -> AfterInstall -> ApplicationStart.
This answer is based on the documentation of AWS CodeDeploy, which states that in an in-place deployment, including the rollback of an in-place deployment, event hooks are run in the following order:
- ApplicationStop: This event occurs before the existing application is stopped. It is used to gracefully stop tasks that do not stop when the application is stopped, such as tasks that are detached or forked.
- BeforeInstall: This event occurs before the updated application is installed. It is used to perform tasks such as backing up configuration files or creating directories.
- AfterInstall: This event occurs after the updated application is installed. It is used to perform tasks such as changing permissions, restarting services, or configuring settings.
- ApplicationStart: This event occurs after the updated application is started. It is used to perform tasks such as running tests or verifying the status of the application.
The other options are not correct because:
- Option A: BeforeInstall -> ApplicationStop -> ApplicationStart -> AfterInstall is not the correct order of hooks for in-place deployments. The ApplicationStop hook should be run before the BeforeInstall hook, not after it.
- Option C: BeforeInstall -> ApplicationStop -> ValidateService -> ApplicationStart is not the correct order of hooks for in-place deployments. The ValidateService hook is not used for in-place deployments, but for blue/green deployments.
- Option D: ApplicationStop -> BeforeInstall -> ValidateService -> ApplicationStart is not the correct order of hooks for in-place deployments. The ValidateService hook is not used for in-place deployments, but for blue/green deployments.
Therefore, option B is the best answer for this question.
The latest AWS Certified Developer – Associate DVA-C02 certification actual real practice exam question and answer (Q&A) dumps are available free, which are helpful for you to pass the AWS Certified Developer – Associate DVA-C02 exam and earn AWS Certified Developer – Associate DVA-C02 certification.