Soru

Zorluk: OrtaAWS CodeDeploy

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.)

  1. Define the validation Lambda function under the BeforeAllowTraffic hook in the hooks section of the AppSpec file.Cevap
  2. Attach a trust policy to the CodeDeploy service role that allows the codedeploy.amazonaws.com service principal to assume the role.Cevap
  3. C
    Define the validation Lambda function under the AfterAllowTestTraffic hook in the hooks section of the AppSpec file.
  4. D
    Configure the trust policy of the Lambda function's execution role to allow the codedeploy.amazonaws.com service principal to assume it.
  5. E
    Store 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

1
Determine the correct CodeDeploy lifecycle hook for validating an AWS Lambda function before traffic starts routing to the new version.
Identify the BeforeAllowTraffic lifecycle hook as the appropriate hook.
AWS Lambda deployments support only BeforeAllowTraffic and AfterAllowTraffic hooks. BeforeAllowTraffic executes prior to any traffic shifting, which meets the requirement of verifying the function before production traffic is routed.
2
Establish the correct trust policy for the IAM service role used by CodeDeploy.
Ensure the trust policy allows the codedeploy.amazonaws.com service principal to assume the role.
AWS CodeDeploy requires permissions to interact with AWS Lambda and other services during deployment. This requires a dedicated CodeDeploy service role that explicitly trusts the CodeDeploy service principal.

Anahtar Kavram

Configuring AWS CodeDeploy for Lambda deployments using AppSpec lifecycle hooks and establishing the correct trust policy for the service role.
Bu soruyu puanla