AWS Deployment Failed due to “HEALTH_CONSTRAINTS”

I am working on a scenario, where I need to push the code from a GIT repository to AWS Instance. To achieve this I am using AWS CodeDeploy feature. But in the final step of the process to deploy the code, I am receiving the below error.

Deployment Failed
The overall deployment failed because too many individual instances failed deployment, too few healthy instances are available for deployment, or some instances in your deployment group are experiencing problems. (Error code: HEALTH_CONSTRAINTS)

  • AWS-Ubuntu-Git Setup error fatal: $HOME not set
  • Initialize Git Repository From Web Interface
  • Permission denied (publickey) copy from remote machine to local
  • AWS CodePipeline, build failed & getting error as YAML_FILE_ERROR M
  • Git remote push not working, SSH key issues
  • Why my deployment check failing here
  • AWS Elastic Beanstalk using PHP with Private Composer Repositories
  • What's the best way to run a platform with multiple git repositories with Amazon AWS Elastic Beanstalk?
  • How to pass in git rsa passphrase from remote ssh?
  • Sharing AWS Elastic Beanstalk configuration for git deployment to AWS
  • eb deploy --staged usage
  • Open a HTTP port on Amazon EC2
  • 3 Solutions collect form web for “AWS Deployment Failed due to “HEALTH_CONSTRAINTS””

    You can see this error if the EC2 instance does not have the correct IAM role. Create an IAM role with the policy “AmazonEC2RoleforAWSCodeDeploy”. You can’t add an IAM role to an existing instance, so you’ll have to launch a fresh one.

    Also make sure you’ve installed the CodeDeploy agent for the correct region, e.g. for us-east-1:

    apt-get -y install awscli ruby2.0
    aws s3 cp s3://aws-codedeploy-us-east-1/latest/install . --region us-east-1
    chmod +x ./install
    ./install auto

    I repeatedly get same error from CodeDeploy tool, if I forget to install CodeDeploy agent to the instance. Just in case here is the link to the documentation:

    The immediate reason you get that error is when CodeDeploy cannot continue the deployment as too many instances is unhealthy. The “minimumHealthyHosts” plays a part in determining the exact number. You can check that parameter [1][2].

    Having said that, for a start, it is easier if set that value to low (i.e. almost 0). Or select the “AllAtOnce” deployment config.



    Git Baby is a git and github fan, let's start git clone.