Soru

Zorluk: OrtaAWS CodeDeploy

An organization is transitioning their microservices to Amazon ECS and plans to use AWS CodeDeploy for automated blue/green deployments. To ensure zero downtime, the deployment workflow must execute validation tests against the replacement task set on a secondary port before shifting any production traffic. Furthermore, AWS CodeDeploy must be authorized to interact with the ECS cluster and load balancer during the deployment execution.

Which TWO configuration actions should the developer perform to support this deployment flow?

  1. Define the validation test under the AfterAllowTestTraffic lifecycle hook in the AppSpec file to trigger a validation AWS Lambda function.Cevap
  2. Configure a trust policy on the CodeDeploy service role that allows the codedeploy.amazonaws.com service principal to perform the sts:AssumeRole action.Cevap
  3. C
    Define the validation test under the BeforeAllowTraffic lifecycle hook in the AppSpec file to execute a shell script that runs integration tests directly on the container.
  4. D
    Define the validation test under the AfterAllowTraffic lifecycle hook in the AppSpec file to verify the health of the replacement task set.
  5. E
    Configure the trust policy on the Amazon ECS task execution role to trust the codedeploy.amazonaws.com service principal.

Cevap

To support this deployment flow, the developer must configure the validation tests under the AfterAllowTestTraffic lifecycle hook in the AppSpec file to trigger a validation AWS Lambda function, and configure a trust policy on the CodeDeploy service role to allow the codedeploy.amazonaws.com service principal to perform the sts:AssumeRole action.
To run validation tests on a test listener before production traffic shifts, the AfterAllowTestTraffic hook must be used to trigger a validation Lambda function. Additionally, CodeDeploy requires a service role with a trust policy that allows codedeploy.amazonaws.com to assume the role via sts:AssumeRole so it has the permissions to execute the deployment.

Adım Adım Çözüm

1
Determine the deployment platform and validation timing requirement.
The target platform is Amazon ECS, and validation must occur on a test port before production traffic shifts.
This determines which AppSpec hooks and execution environments are valid.
2
Select the correct AppSpec hook and execution format for ECS.
The AfterAllowTestTraffic hook must be configured with a Lambda function reference. Script execution is not supported for ECS.
Only Lambda hooks are supported for ECS, and AfterAllowTestTraffic runs after the test listener routes traffic but before the production listener shifts.
3
Identify the service authorization mechanism.
CodeDeploy itself needs permissions, which requires a CodeDeploy service role with a trust policy for codedeploy.amazonaws.com.
This enables CodeDeploy to call ECS and Elastic Load Balancing APIs to execute the deployment.

Anahtar Kavram

AWS CodeDeploy ECS Deployment Validation and IAM Authorization
Bu soruyu puanla