4
votes

I am trying to set up AWS CodeDeploy for my PHP web app. I have created a CodeDeploy app and a deployment group on the AWS console. I have created the necessary revision bundle with the appspec yaml file. The revision bundle is stored on Amazon S3.

When I click 'Deploy this revision' button on the AWS console it gives me 'no hosts succeeded' error. I went through the Technical FAQ and could not find any answers. How can I counter this error?

UPDATE: I now understand that this error has something to do with Minimum Healthy Hosts count. But still I am not able to understand how does AWS calculate the healthiness of a host.

4
Are you getting the error during a deployment or preventing the deployment, this makes a difference. Typically the health of the host is the based on the result of the update, for example if you have 3 instances, and require 2 minimum healthy, if any of the instances fail, except for the last one, there would be no way for there to be 3 healthy hosts, since it has to take one offline to update it.Kevin
Please do post the solution if you have solved it. I'm facing the same error.hablema
same issue here. could you post you solution if you have you solve it? thanks.Shih-Min Lee

4 Answers

2
votes

Basically what its saying is "The codedeploy service on your ec2 instance is not running"...

1
votes

For why a deployment failed host health is fairly simple. A host is healthy if that host succeeded in deploying the last deployment to it. A host is unhealthy if it failed. A host is unknown if it was Skipped and had no previous deployment.

There are other aspects of host health that affect what order they are deployed to in the next deployment, but that's not going to affect you deployment failing with "No hosts succeeded".

A host can fail it's individual deployment if any of it's lifecycle events failed. A lifecycle event can fail due to service side timeout waiting for the agent to respond or because the host agent reports an error executing the command. You can check the host agent log for more details in exactly why the host agent reported a failure.

If you are hitting the server side timeouts, you should check that the host agent is running and is able to poll for commands correctly. You might have accidentally restricted access in your VPC configuration or didn't grant appropriate permissions to the instance to poll for commands in the instance profile.

0
votes

This error message means you are not running CodeDeploy service at the EC2 instance targeted by your deployment group.

1) Download latest version of codedeploy from S3 (choose your region)

PS> Read-S3Object -BucketName aws-codedeploy-eu-west-1 -Key latest/codedeploy-agent.msi -File c:\temp\codedeploy-agent.msi

2) Install codedeploy

cmd> c:\temp\codedeploy-agent.msi /quiet /l c:\temp\host-agent-install-log.txt

3) Start codeploy

PS> Start-Service -Name codedeployagent

AWS CodeDeploy guide: http://docs.aws.amazon.com/codedeploy/latest/userguide/how-to-run-agent.html#how-to-run-agent-install-windows

0
votes

I just ran into this issue myself. My solution was to run:

ntpdate-debian

If you are running centos it's something like

 ntpdate pool.ntp.org

For me the time was off and was causing issues with the codedeploy agent.

Now, if this doesn't solve your problem. First make sure your problem is that your CodeDeploy agent is not registering. I have had this issue before and it was because one of my instances was in a failed state from a botched deployment so be sure to double check. (ELB status, tests, etc)

Then you should enable logging for your CodeDeploy agent by setting log_aws_wire and verbose to true in /etc/codedeploy-agent/conf/codedeployagent.yml and then restart the CodeDeploy. Tail the logs and you should see the reason for your problems.