Question #574
For an in-place deployment using AWS CodeDeploy, what is the correct execution sequence of the lifecycle hooks?
ApplicationStart -> BeforeInstall -> AfterInstall -> ApplicationStop
BeforeInstall -> ApplicationStop -> AfterInstall -> ApplicationStart
ApplicationStop -> AfterInstall -> BeforeInstall -> ApplicationStart
ApplicationStop -> BeforeInstall -> AfterInstall -> ApplicationStart
Explanation
In AWS CodeDeploy's in-place deployment, the lifecycle hooks execute in the following order:
1. ApplicationStop: Stops the running application.
2. BeforeInstall: Prepares the environment before installing the new version.
3. AfterInstall: Performs post-installation tasks (e.g., file cleanup).
4. ApplicationStart: Restarts the application with the new version.
Why D is correct: It follows the logical flow: stop the app → prepare → install → start.
Why others are incorrect:
- A: Starts with BeforeInstall, skipping ApplicationStop.
- B: Places AfterInstall before BeforeInstall, violating the sequence.
- C: Starts with ApplicationStart, which is the final step.
Key Points:
- ApplicationStop is always first in in-place deployments.
- BeforeInstall and AfterInstall wrap the installation phase.
- ApplicationStart ensures the updated app is running.
Answer
The correct answer is: D