user6380172 user6380172 - 21 days ago 5x
Git Question

AWS - Deployment Failed

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. If someone can guide me through this ASAP, it will be great.

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)

Please let me know if more information is required on the above issue.

Thanks in Advance


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