Amazon CodeDeploy failing on invalid certificate

amazon-web-services

For the past year or so, I've been deploying to AMI ubuntu-trusty-14.04-amd64-server-20150325 (ami-d85e75b0) running on C3.large instances with Amazon CodeDeploy. I'm using the standard user-data script from the documentation to install the CodeDeploy agent:

#!/bin/bash
apt-get -y update
apt-get -y install awscli
apt-get -y install ruby2.0
cd /home/ubuntu
aws s3 cp s3://aws-codedeploy-us-east-1/latest/install . --region us-east-1
chmod +x ./install
./install auto

I recently found that I needed the performance offered by an M4.large, but in order to do that I needed to be running on HVM virtualization type, so I fired up ubuntu-trusty-14.04-amd64-server-20160114.5 (ami-fce3c696), SSD Volume AMI Type using the same exact script.

When I tried to deploy with CodeDeploy this time, CodeDeploy wasn't reporting any events, so I ssh'd into the new instance to read the CodeDeploy logs, and found two interesting lines:

2016-04-01 20:49:25 ERROR [codedeploy-agent(2080)]: Error validating 
    the SSL configuration: Invalid server certificate
2016-04-01 20:49:25 ERROR [codedeploy-agent(2080)]: booting child:
    error during start or run: SystemExit - Stopping CodeDeploy agent
    due to SSL validation error. 
    - /opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_poller.rb:53:in `abort'

I can't seem to find anything in the docs that is useful, and the few reports of this issue that I found via Google talked about HTTP proxys and SSL environment variables. This just confused me because there's no mention of any of these things in the docs.

Does anybody know what might be going on here?

Best Answer

I had this same problem. CodeDeploy had been working for a couple years with various personal projects on the same server. Last week, I noticed any attempted deployment failed with this error.

All of the (scant) advice found online was either not applicable or didn't do anything. I had no special SSL environment variables set. I had the latest version of the codedeploy agent. I even updated everything with yum update.

Solution: Restart the server.

No joke.

I had enabled verbose logs in /etc/codedeploy-agent/conf/codedeployagent.yml, and I restarted the server just to make sure it took effect. All deployments began working again.

Have you tried turning it off and turning it back on again?

Related Topic