How do I resolve the error that I receive in AWS CodeDeploy when my deployment times out while waiting for a status callback?

2 minute read
0

My AWS CodeDeploy deployment times out and returns the following error: "The deployment timed out while waiting for a status callback. CodeDeploy expects a status callback within one hour after a deployment hook is invoked."

Short description

This issue can occur when you use CodeDeploy to deploy an Amazon Elastic Container Service (Amazon ECS) service with a validation test.

If the test doesn't return a Succeeded or Failed response within 60 minutes after a lifecycle event hook is invoked, then CodeDeploy returns the following error:

"The deployment timed out while waiting for a status callback. CodeDeploy expects a status callback within one hour after a deployment hook is invoked."

Note: The default timeout limit for a lifecycle hook AWS Lambda function's status callback is 60 minutes.

To resolve the error, verify that the lifecycle hook Lambda function has the required method and AWS Identity and Access Management (IAM) permissions.

Resolution

Confirm the cause of the error by reviewing your CloudWatch Logs

For instructions, see How do I retrieve log data from Amazon CloudWatch Logs?

Verify that the lifecycle hook Lambda function has the required IAM permissions

Make sure that the lifecycle hook Lambda function has an execution role that includes the following permission: PutLifecycleEventHookExecutionStatus.

Note: The PutLifecycleEventHookExecutionStatus permission isn't included by default in the AWS managed CodeDeployFullAccess IAM policy.

See the following example of a PutLifecycleEventHookExecutionStatus permissions statement:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "VisualEditor0",
      "Effect": "Allow",
      "Action": "codedeploy:PutLifecycleEventHookExecutionStatus",
      "Resource": "*"
    }
  ]
}

Verify that the lifecycle hook Lambda function includes the required method to return a status response to CodeDeploy

Make sure that the lifecycle hook Lambda function includes the putLifecycleEventHookExecutionStatus method.

For more information, see Step 3: Create a lifecycle hook Lambda function in the CodeDeploy User Guide.

See the following example of a putLifecycleEventHookExecutionStatus method for a lifecycle hook Lambda function:

codedeploy.putLifecycleEventHookExecutionStatus(params, function(err, data) {
     if (err) {
          // Validation failed.
          console.log('AfterAllowTestTraffic validation tests failed');
          console.log(err, err.stack);
          callback("CodeDeploy Status update failed");
     } else {
          // Validation succeeded.
          console.log("AfterAllowTestTraffic validation tests succeeded");callback(null, "AfterAllowTestTraffic validation tests succeeded");
         }

AWS OFFICIAL
AWS OFFICIALUpdated a year ago
No comments