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

Last updated: 2020-12-28

I want to resolve the following error in AWS CodeDeploy: "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

Typically, you create AWS Lambda validation test functions for multiple lifecycle event hooks (such as BeforeInstall, AfterInstall, BeforeAllowTraffic, and AfterAllowTraffic) in your Amazon Elastic Container Service (Amazon ECS) deployments. Then, you expect a Succeeded or Failed response from the validation test.

However, you receive this error if your AWS Lambda function doesn't return an execution status of Succeeded or Failed to CodeDeploy within the default time limit of 60 minutes.


1.    Check your log data from AWS CloudWatch Logs to verify that the execution time of your Lambda function is more than 60 minutes.

2.    Attach the PutLifecycleEventHookExecutionStatus permission to your Lambda execution role. For example:

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

Note: The PutLifecycleEventHookExecutionStatus permission isn't included by default in the CodeDeployFullAccess AWS Identity and Access Management (IAM) policy managed by AWS. You must attach the policy manually.

3.    Verify that your Lambda function has the putLifecycleEventHookExecutionStatus method to return a response to CodeDeploy. For example:

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");