A developer is configuring a blue/green deployment for an Amazon ECS service using AWS CodeDeploy. The deployment must execute a validation test against the newly deployed tasks (the green task set) before any production traffic is shifted. If the validation test fails, the deployment must automatically roll back. The developer is defining the AppSpec file in YAML format and configuring the IAM permissions. Which of the following configurations are required to meet these requirements? (Select TWO.)
- Define the validation Lambda function ARN under the BeforeAllowTraffic hook in the hooks section of the AppSpec file.Cevap
- Grant the CodeDeploy service role the lambda:InvokeFunction permission for the validation Lambda function.Cevap
- CDefine a local shell script path under the BeforeAllowTraffic hook in the hooks section of the AppSpec file to execute the validation tests.
- DAttach the lambda:InvokeFunction permission to the Amazon ECS Task Execution Role to allow the task containers to invoke the validation Lambda function.
- EDefine the validation Lambda function under the ValidateService hook in the hooks section of the AppSpec file.
Cevap
Defining the validation Lambda function ARN under the BeforeAllowTraffic hook and granting the CodeDeploy service role the lambda:InvokeFunction permission.
The correct configurations involve using the BeforeAllowTraffic lifecycle hook inside the ECS AppSpec file to point to the validation Lambda function, and ensuring the CodeDeploy service role has the lambda:InvokeFunction permission to run it. The BeforeAllowTraffic hook executes after the green task set is provisioned but before production traffic shifts, enabling testing and automatic rollback on failure.
Adım Adım Çözüm
Anahtar Kavram
AWS CodeDeploy ECS Blue/Green lifecycle hooks and IAM permissions