A developer is preparing to deploy updates to an AWS Lambda function using AWS CodeDeploy. The deployment must use a canary strategy (Canary10Percent5Minutes). The developer wants to execute a validation Lambda function to perform integration tests on the new version of the function before any production traffic is shifted to it. The deployment must also use a service role that grants CodeDeploy the necessary permissions to perform the deployment.
Which two actions should the developer take to configure this deployment? (Select TWO.)
- Define the validation Lambda function under the BeforeAllowTraffic hook in the hooks section of the AppSpec file.Cevap
- Attach a trust policy to the CodeDeploy service role that allows the codedeploy.amazonaws.com service principal to assume the role.Cevap
- CDefine the validation Lambda function under the AfterAllowTestTraffic hook in the hooks section of the AppSpec file.
- DConfigure the trust policy of the Lambda function's execution role to allow the codedeploy.amazonaws.com service principal to assume it.
- EStore the database credentials used by the validation Lambda function in AWS Systems Manager Parameter Store and enable automatic rotation.
Cevap
Define the validation Lambda function under the BeforeAllowTraffic hook in the hooks section of the AppSpec file, and attach a trust policy to the CodeDeploy service role that allows the codedeploy.amazonaws.com service principal to assume the role.
The correct options are to define the validation function in the BeforeAllowTraffic hook and configure the CodeDeploy service role trust policy. The BeforeAllowTraffic hook runs before any traffic is shifted to the new version, which allows the developer to run verification tests. The CodeDeploy service role must have a trust policy that allows codedeploy.amazonaws.com to assume the role in order to perform deployment tasks.
Adım Adım Çözüm
Anahtar Kavram
Configuring AWS CodeDeploy for Lambda deployments using AppSpec lifecycle hooks and establishing the correct trust policy for the service role.