Soru

Zorluk: OrtaTroubleshooting CloudFormation and CI/CD Deployments

A developer is troubleshooting a failed AWS CodeDeploy deployment. The deployment was configured to update a containerized application running on an Amazon ECS service using a blue/green deployment strategy. The deployment failed during the validation phase with an error indicating that invalid lifecycle hooks were specified in the deployment specification file. Which of the following lifecycle hooks are unsupported for an Amazon ECS deployment and must be removed from the appspec.yaml file to resolve the issue? (Select TWO.)

  1. ApplicationStopCevap
  2. ApplicationStartCevap
  3. C
    BeforeInstall
  4. D
    BeforeAllowTraffic
  5. E
    AfterAllowTraffic

Cevap

The unsupported lifecycle hooks for an Amazon ECS deployment are ApplicationStop and ApplicationStart.
For an Amazon ECS deployment, CodeDeploy supports a specific, limited set of lifecycle hooks: BeforeInstall, AfterInstall, AfterAllowTestTraffic, BeforeAllowTraffic, and AfterAllowTraffic. The ApplicationStop and ApplicationStart hooks are only used in EC2/On-Premises deployments to manage on-instance application states and will fail validation if included in an ECS AppSpec template.

Adım Adım Çözüm

1
Determine the target compute platform for the CodeDeploy deployment.
The target platform is Amazon ECS.
CodeDeploy lifecycle hooks differ significantly depending on whether the deployment is for EC2/On-Premises, AWS Lambda, or Amazon ECS.
2
Review the list of valid lifecycle hooks for Amazon ECS in CodeDeploy.
The valid hooks for ECS are BeforeInstall, AfterInstall, AfterAllowTestTraffic, BeforeAllowTraffic, and AfterAllowTraffic.
This establishes which hooks CodeDeploy expects when parsing the ECS AppSpec file.
3
Identify the unsupported hooks from the choices.
ApplicationStop and ApplicationStart are invalid for ECS, as they are part of the EC2/On-Premises deployment lifecycle.
Adding EC2-specific hooks to an ECS AppSpec file triggers validation errors during the deployment phase.

Anahtar Kavram

AWS CodeDeploy AppSpec lifecycle hooks differ based on the target compute platform (EC2 vs. ECS vs. Lambda). Using hooks designed for EC2 (such as ApplicationStop and ApplicationStart) in an ECS deployment leads to validation failures.
Bu soruyu puanla