A production environment uses AWS CodeDeploy blue/green deployments with EC2 Auto Scaling groups that launch Amazon Linux 2 instances. You must run a script that downloads and installs a license file onto replacement instances before they begin serving traffic. Which appspec.yml hook should run that script?
Choose an answer
Tap an option to check your answer.
Correct answer: BeforeInstall.
Why this is the answer
The BeforeInstall hook is the correct choice because it executes scripts on new instances before the application revision is installed and before traffic is shifted. This ensures the license file is present and installed on the replacement instances before they are considered ready to serve traffic. AfterBlockTraffic runs after traffic is blocked from the original environment, which is too late for preparing new instances. BeforeBlockTraffic runs before traffic is blocked from the original environment, also too late for new instance preparation. DownloadBundle is an internal CodeDeploy lifecycle event that handles downloading the application revision; it's not a user-configurable hook for custom scripts.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed