Soru

Zorluk: Çok zorDeployment Strategies

A developer is using AWS CodeDeploy to manage deployments for a containerized application running on Amazon ECS (Fargate) behind an Application Load Balancer (ALB). The application requires zero downtime during updates. The developer needs to implement a deployment strategy where a new version is validated with exactly 10%10\% of production traffic for 15 minutes before shifting the remaining 90%90\% of traffic. Additionally, a database migration script must be executed automatically after the new task set is created but before it receives any production traffic. The deployment must automatically roll back immediately if the load balancer target group's HTTP 5xx errors spike during the validation window.

Which TWO actions should the developer take to meet these requirements?

  1. Use the CodeDeployDefault.ECSCanary10Percent15Minutes deployment configuration.Cevap
  2. Define an AWS Lambda function under the AfterInstall hook in the AppSpec file to execute the database migration script.Cevap
  3. C
    Use the CodeDeployDefault.ECSLinear10PercentEvery15Minutes deployment configuration.
  4. D
    Define an AWS Lambda function under the ApplicationStart hook in the AppSpec file to execute the database migration script.
  5. E
    Configure a CloudWatch Alarm monitoring the HTTPCode_Target_5XX_Count metric with a 15-minute period, and link it to the CodeDeploy deployment group's alarm configuration.

Cevap

Use the CodeDeployDefault.ECSCanary10Percent15Minutes deployment configuration and define an AWS Lambda function under the AfterInstall hook in the AppSpec file to execute the database migration script.
The correct options are the strategy to use CodeDeployDefault.ECSCanary10Percent15Minutes and using the AfterInstall hook. The deployment configuration Canary10Percent15Minutes routes 10% of traffic to the new task set, waits for 15 minutes, and then routes the remaining 90%. The AfterInstall lifecycle hook in an ECS deployment runs immediately after the replacement task set is created but before it receives any traffic, making it the perfect stage to execute database migrations or pre-traffic checks.

Adım Adım Çözüm

1
Analyze the traffic shifting pattern requirements.
The requirement states that 10% of traffic must be routed to the new version for a 15-minute validation period, after which the remaining 90% is shifted. This corresponds directly to a Canary strategy: CodeDeployDefault.ECSCanary10Percent15Minutes.
This establishes the traffic routing configuration for CodeDeploy.
2
Determine the correct lifecycle hook for running database migrations in an ECS deployment.
Identify that the migration must run after the task set is created but before any traffic is routed. In ECS deployments, this matches the AfterInstall hook. EC2 hooks like ApplicationStart are invalid.
This ensures the migration script executes at the correct stage of the deployment sequence without failing due to unsupported platform hooks.
3
Evaluate the rollback trigger configurations.
To roll back immediately within a 15-minute window, the associated CloudWatch Alarm must use a short evaluation period (such as 1 minute or 60 seconds). A 15-minute period would delay the rollback response.
This rules out the incorrect CloudWatch Alarm configuration.

Anahtar Kavram

AWS CodeDeploy deployment strategies and AppSpec lifecycle hooks for ECS deployments
Tahmini Süre:3m 0s
Bu soruyu puanla